Exo v0.1.1 Exo View Source
Logic programming in elixir.
Link to this section Summary
Functions
Infix version of eqo
A macro for conj — the logic and
Perform the unification
A macro to create fresh logic variables
A macro for disj — the logic or
One-step walking
Invers-η-delay
Link to this section Types
state_stream() :: maybe_improper_list(Exo.State.t(), state_stream()) | (() -> state_stream())
Link to this section Functions
Infix version of eqo
.
A macro for conj — the logic and.
Example macro expanding :
ando do
g1
g2
g3
end
# = expand to =>
conj(zzz(g1),
conj(zzz(g2),
zzz(g3)))
call_with_empty_state(goal()) :: state_stream()
Perform the unification.
A macro to create fresh logic variables.
Example macro expanding :
fresh [a, b, c] do
g1
g2
g3
end
# = expand to =>
call_with_fresh fn a ->
call_with_fresh fn b ->
call_with_fresh fn c ->
ando do
g1
g2
g3
end
end
end
end
mplus(state_stream(), state_stream()) :: state_stream()
A macro for disj — the logic or.
Just like ando.
- minikanren user should note that, we do no implement the conde macro of minikanren, we use oro instead.
reify_state_with_1st_var(Exo.State.t()) :: value()
take(state_stream(), non_neg_integer()) :: [Exo.State.t()]
take_all(state_stream()) :: [Exo.State.t()]
unify(substitution(), value(), value()) :: substitution() | false
One-step walking
Walking until the value is not Var.t, which does not care about other vars in the result value.
Invers-η-delay
The act of performing an inverse-η on a goal and then wrapping its body in a lambda we refer to as inverse-η-delay.
Invers-η-delay is an operation that takes a goal and returns a goal, as the result of doing so on any goal g is a function from a state to a stream.