This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
amb_example(BestGuess) :- | |
run_with_monte_carlo_amb(1000, | |
( amb(BestGuess, [2,3,4,5,6,7,8,9,10,11,12]), | |
guess_the_dice_total(BestGuess) | |
)). | |
guess_the_dice_total(Total) :- | |
random_member(Dice1, [1,2,3,4,5,6]), | |
random_member(Dice2, [1,2,3,4,5,6]), | |
(Total =\= Dice1 + Dice2 -> amb(fail); true). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- modified version of https://package.elm-lang.org/packages/dvberkel/microkanren/latest/ | |
-- fixing a bug, and adding reification, some practical features, and an example logic problem | |
module MicroKanren.Kernel exposing | |
( Goal, State, Stream(..), Term(..), Var | |
, callFresh, conjoin, disjoin | |
, emptyState, unit | |
, walk | |
, Substitutions, fish, l, pull, unify, v | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Stumbling towards Y | |
; | |
; The applicative-order Y combinator is a function that allows one | |
; to create a recursive function without using define. | |
; This may seem strange. Usually a recursive function has to call | |
; itself, and thus relies on itself having been defined. | |
; | |
; Regardless, here we will stumble towards the implementation of the | |
; Y combinator (in Scheme). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Browser.Dom | |
import Element exposing (Element) | |
import Element.Background as Background | |
import Element.Border as Border | |
import Element.Font as Font | |
import Element.Input as Input | |
import Html | |
import Html.Attributes | |
import Html.Events | |
import Json.Decode as Decode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main exposing (..) | |
import Browser | |
import Html exposing (Html, button, div, span, text) | |
import Html.Attributes exposing (style) | |
import Html.Events exposing (onClick) | |
import Timeline exposing (Timeline) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Base.ListSet exposing | |
( Set | |
, diff | |
, empty | |
, filter | |
, foldl | |
, foldr | |
, fromList | |
, group | |
, insert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input [ | |
focus (item.id) (RequiresFocus_ Nothing) | |
else | |
none | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Stumbling towards Y (Clojure Version) | |
; | |
; (this tutorial can be cut & pasted into your IDE / editor) | |
; | |
; The applicative-order Y combinator is a function that allows one to create a | |
; recursive function without using define. | |
; This may seem strange, because usually a recursive function has to call | |
; itself, and thus relies on itself having been defined. | |
; | |
; Regardless, here we will stumble towards the implementation of the Y combinator. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @jsx React.DOM */ | |
"use strict"; | |
var util = { | |
// findPos() by quirksmode.org | |
// Finds the absolute position of an element on a page | |
findPos: function (obj) { | |
var curleft = 0, | |
curtop = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Stopwatch | |
import Html exposing (..) | |
import Html.App as App | |
import Html.Attributes exposing (..) | |
import Html.Events exposing (..) | |
main: Program Never | |
main = | |
App.program | |
{ init = init |
NewerOlder