| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
A miniKanren implementation in Elixir.
defmodule Demo do
import Ckini
alias Ckini.Var
def readme_demo do
run {x, y, z} do
# simple goal
eq(y, 1)
# a conde goal
conde do
_ -> eq(y, 2)
_ -> eq(z, 3)
_ -> eq(x, 4)
end
# you can create logic variable with fresh
fresh t do
eq(x, [y, z, t, "hello"])
end
end
end
end
test "demo in README should work correctly" do
assert [{[1, 3, :_0, "hello"], 1, 3}] == Demo.readme_demo()
endAPI available: run/2, run/3, eq (===), neq (=/=), cond{e,i,a,u}, match{e,i,a,u}, all, project, succ, fail, symbolo, absento, copy_termo, anyo, onceo.
Check out the https://github.com/shouya/ckini/blob/master/test/*_test.exs for more usage examples.
| Back | FazBrowse Home | New Git URL |