Exo v0.1.3 Exo View Source
Logic programming in elixir.
Link to this section Summary
Types
We tried to support all unifiable datatype of elixir
Functions
Perform the unification
A goal that fails
A macro to create fresh logic variables
A goal that succeeds
One-step walking
Invers-η-delay
Link to this section Types
state_stream() :: maybe_improper_list(Exo.State.t(), state_stream()) | (() -> state_stream())
We tried to support all unifiable datatype of elixir.
Link to this section Functions
Infix version of eqo/2.
The Law of <~>
v <~> w is the same as w <~> v.
A macro for conj/2 — 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()
A macro for a list ando/1 in oro/1.
The Law of conde
To get more values from conde ,
pretend that the successful conde
line has failed, refreshing all variables
that got an association from that line.
conde is written conde and is pronounced “con-dee”.
conde is the default control mechanism of Prolog. See William F. Clocksin. Clause and Effect. Springer, 1997.
Perform the unification.
A goal that fails.
A macro to create fresh logic variables.
The Law of Fresh
If x is fresh, then v <~> x succeeds
and associates x with v.
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()
reify_state_with_1st_var(Exo.State.t()) :: value()
A goal that succeeds.
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.