Skip to content

sajonaro/microkanren-clojure

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

About

Adaptation in Clojure of W.Byrd's and Co. paper about µKanren (microKanren) - a subset of miniKanren focused on core relational programming operators and devoid of functions pertaining rather to the end-user's purview.

101 on µKanren

A microKanren program is a sequence of goals , each goal can either succed or fail. The result of a µKanren program is a stream of satisfying states, i.e. such that make succed all goals.

Goals constructors

In µKanren there are 4 primitive goal constructors:

  • unification constructor: ===

    ;; the goal `succeds` if A is `unified` with B
    (=== A B)
  • binary conjunction: conj

    ;; .. of the goals A and B, resulting in a goal that succeds if both A and B succed
    (conj 
       A
       B)
  • binary disjunction: disj

    ;; .. of the goals A and B, resulting in a goal that succeds if either A or B succeds
    (disj 
       A
       B)
  • operator fresh:

    ;; creates a fresh (i.e. new) logic variable X
    ;; accepts unary function fn_X: i.e. fn[X]( expression_with_X)
    ;; where variable X is a fresh logic variable bound to 
    ;; expression_with_X expression,
    ;; expression_with_X evaluates to a goal.
    (fresh fn_X)

Useful scripts

  • install clojure-cli
    $ curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh  \
        chmod +x linux-install.sh  \
        sudo ./linux-install.sh
  • run
    $ clj -M -m microkanren.main

About

Implementation of microkanren in clojure

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published