miniKanren language basics
appendo
type inferencer
small relational interpreter
larger relational interpreter
numbers
natural language grammar
resources
scratch 1
scratch 2
scratch 3
scratch 4
scratch 5
x
 
; motivation
;; 2 + 3 = 5
;; (+ 2 3) => 5 ; functional viewpoint
;; (+o 2 3 5) ; relational viewpoint
;; ; success
;; (+o 2 3 6)
;; ; failure
;; (+o 2 3 Z) ; Z <- logic variable   Z = 5
;; (+o X 3 5) ; X <- logic variable   X = 2
;; (+o X Y 5) ; x = 0, y = 5; ... x = 2, y = 3; ...
;; (+o X Y Z)
;; (FOO 2 3 5)
; Core operators
; ==  (unification)
(== 5 5)
(== 5 6)
(== x 5)
(== x y)
(== (list 2 3) (list x y))
(fresh ()
  (== x y)
  (== y 5))
(fresh ()
  (== x y)
  (== y 5)
  (== x 6))
(fresh ()
  (== y 5)
  (== x y))
(conde
  ((== x 5))
  ((== x 6)))
run!
vertical
present