Public Variables and Functions
!=
functionUsage: (!= u v)
Disequality constraint. Ensures that u and v will never
unify. u and v can be complex terms.
Source
->AnswerCache
functionUsage: (->AnswerCache ansl anss _meta)
Positional factory function for class clojure.core.logic.AnswerCache.
Source
->Choice
functionUsage: (->Choice a f)
Positional factory function for class clojure.core.logic.Choice.
Source
->ConstraintStore
functionUsage: (->ConstraintStore km cm cid running)
Positional factory function for class clojure.core.logic.ConstraintStore.
Source
->LCons
functionUsage: (->LCons a d cache meta)
Positional factory function for class clojure.core.logic.LCons.
Source
->LVar
functionUsage: (->LVar id unique name oname hash meta)
Positional factory function for class clojure.core.logic.LVar.
Source
->PMap
functionUsage: (->PMap)
Positional factory function for class clojure.core.logic.PMap.
Source
->Pair
functionUsage: (->Pair lhs rhs)
Positional factory function for class clojure.core.logic.Pair.
Source
->SubstValue
functionUsage: (->SubstValue v doms eset)
Positional factory function for class clojure.core.logic.SubstValue.
Source
->Substitutions
functionUsage: (->Substitutions s vs ts cs cq cqs oc _meta)
Positional factory function for class clojure.core.logic.Substitutions.
Source
->SuspendedStream
functionUsage: (->SuspendedStream cache ansv* f)
Positional factory function for class clojure.core.logic.SuspendedStream.
Source
==
functionUsage: (== u v)
A goal that attempts to unify terms u and v.
Source
all
macroUsage: (all)
(all & goals)
Like fresh but does does not create logic variables.
Source
and*
functionUsage: (and* goals)
A function version of all, which takes a list of goals and succeeds only if they all succeed.
Source
appendo
functionUsage: (appendo x y z)
A relation where x, y, and z are proper collections,
such that z is x appended to y
Source
conda
macroUsage: (conda & clauses)
Soft cut. Once the head of a clause has succeeded
all other clauses will be ignored. Non-relational.
Source
conde
macroUsage: (conde & clauses)
Logical disjunction of the clauses. The first goal in
a clause is considered the head of that clause. Interleaves the
execution of the clauses.
Source
condu
macroUsage: (condu & clauses)
Committed choice. Once the head (first goal) of a clause
has succeeded, remaining goals of the clause will only
be run once. Non-relational.
Source
conjo
functionUsage: (conjo coll & args)
A constraint version of conj
Source
conso
functionUsage: (conso a d l)
A relation where l is a collection, such that a is the first of l
and d is the rest of l. If ground d must be bound to a proper tail.
Source
copy-term
functionUsage: (copy-term u v)
Copies a term u into v. Non-relational.
Source
defna
macroUsage: (defna & rest)
Define a soft cut goal. See conda.
Source
defne
macroUsage: (defne & rest)
Define a goal fn. Supports pattern matching. All
patterns will be tried. See conde.
Source
defnu
macroUsage: (defnu & rest)
Define a committed choice goal. See condu.
Source
distincto
functionUsage: (distincto l)
A relation which guarantees no element of l will unify
with another element of l.
Source
emptyo
functionUsage: (emptyo a)
A relation where a is the empty list
Source
everyg
functionUsage: (everyg g coll)
A pseudo-relation that takes a coll and ensures that the goal g
succeeds on every element of the collection.
Source
fail
functionUsage: (fail a)
A goal that always fails.
Source
featurec
functionUsage: (featurec x fs)
Ensure that a map contains at least the key-value pairs
in the map fs. fs must be partially instantiated - that is,
it may contain values which are logic variables to support
feature extraction.
Source
firsto
functionUsage: (firsto l a)
A relation where l is a collection, such that a is the first of l
Source
fix-constraints
functionUsage: (fix-constraints a)
A goal to run the constraints in cq until it is empty. Of
course running a constraint may grow cq so this function
finds the fixpoint.
Source
fna
macroUsage: (fna & rest)
Define an anonymous soft cut goal. See conda.
Source
fnc
macroUsage: (fnc args & body)
Define an anonymous constraint that can be used with the unifier:
(let [oddc (fnc [x] (odd? x))]
(unifier {:a '?a} {:a 1} :when {'?a oddc})
;;=> {:a 1}
(unifier {:a '?a} {:a 2} :when {'?a oddc})
;;=> nil
)
Note, the constraint will not run until all arguments are fully ground.
Use defnc to define a constraint and assign a toplevel var.
Source
fne
macroUsage: (fne & rest)
Define an anonymous goal fn. Supports pattern matching. All
patterns will be tried. See conde.
Source
fnu
macroUsage: (fnu & rest)
Define an anonymous committed choice goal. See condu.
Source
fresh
macroUsage: (fresh [& lvars] & goals)
Creates fresh variables. Goals occuring within form a logical
conjunction.
Source
is
macroUsage: (is u v op)
Set the value of a var to value of another var with the operation
applied. Non-relational.
Source
lcons
functionUsage: (lcons a d)
Constructs a sequence a with an improper tail d if d is a logic variable.
Source
llist
macroUsage: (llist f s)
(llist f s & rest)
Constructs a sequence from 2 or more arguments, with the last argument as the
tail. The tail is improper if the last argument is a logic variable.
Source
log
macroUsage: (log & s)
Goal for println
Source
lvaro
macroUsage: (lvaro v)
A goal that succeeds if the argument is fresh. v must be a logic
variable. Non-relational.
Source
map->PMap
functionUsage: (map->PMap m#)
Factory function for class clojure.core.logic.PMap, taking a map of keywords to field values.
Source
map->SubstValue
functionUsage: (map->SubstValue m#)
Factory function for class clojure.core.logic.SubstValue, taking a map of keywords to field values.
Source
map->SuspendedStream
functionUsage: (map->SuspendedStream m#)
Factory function for class clojure.core.logic.SuspendedStream, taking a map of keywords to field values.
Source
master
functionUsage: (master argv cache)
Take the argument to the goal and check that we don't
have an alpha equivalent cached answer term in the cache.
If it doesn't already exist in the cache add the new
answer term.
Source
matcha
macroUsage: (matcha xs & cs)
Define a soft cut pattern match. See conda.
Source
matche
macroUsage: (matche xs & cs)
Pattern matching macro. All patterns will be tried.
See conde.
Source
matchu
macroUsage: (matchu xs & cs)
Define a committed choice goal. See condu.
Source
member1o
functionUsage: (member1o x l)
Like membero but uses to disequality further constraining
the results. For example, if x and l are ground and x occurs
multiple times in l, member1o will succeed only once.
Source
membero
functionUsage: (membero x l)
A relation where l is a collection, such that l contains x.
Source
nafc
functionUsage: (nafc c & args)
EXPERIMENTAL: negation as failure constraint. All arguments to the goal c
must be ground. If some argument is not ground the execution of this constraint
will be delayed.
Source
nilo
functionUsage: (nilo a)
A relation where a is nil
Source
nonlvaro
macroUsage: (nonlvaro v)
A goal that succeeds if the argument is not fresh. v must be a
logic variable. Non-relational.
Source
or*
functionUsage: (or* goals)
A function version of conde, which takes a list of goals and tries them as if via conde.
Note that or* only does disjunction, ie (or* [a b c]) is the same as (conde [a] [b] [c]).
If you need something like (conde [a b] [c]), you can use and*, or all:
(or* [(and* a b) c]).
Source
partial-map
functionUsage: (partial-map m)
Given map m, returns partial map that unifies with maps even if it
doesn't share all of the keys of that map.
Source
permuteo
functionUsage: (permuteo xl yl)
A relation that will permute xl into the yl. May not
terminate if xl is not ground.
Source
pred
macroUsage: (pred v f)
Check a predicate against the value logic var. Non-relational.
Source
project
macroUsage: (project [& vars] & goals)
Extract the values bound to the specified logic vars. Non-relational.
Source
rembero
functionUsage: (rembero x l o)
A relation between l and o where x is removed from
l exactly one time.
Source
resto
functionUsage: (resto l d)
A relation where l is a collection, such that d is the rest of l
Source
run
macroUsage: (run n bindings & goals)
Executes goals until a maximum of n results are found.
Source
run*
macroUsage: (run* bindings & goals)
Executes goals until results are exhausted.
Source
run-db
macroUsage: (run-db n db bindings & goals)
Executes goals until a maximum of n results are found. Uses a specified logic database.
Source
run-db*
macroUsage: (run-db* db bindings & goals)
Executes goals until results are exhausted. Uses a specified logic database.
Source
run-nc
macroUsage: (run-nc n bindings & goals)
Executes goals until a maximum of n results are found. Does not
occurs-check.
Source
run-nc*
macroUsage: (run-nc* & goals)
Executes goals until results are exhausted. Does not occurs-check.
Source
succeed
functionUsage: (succeed a)
A goal that always succeeds.
Source
tabled
macroUsage: (tabled args & grest)
Macro for defining a tabled goal. Prefer ^:tabled with the
defne/a/u forms over using this directly.
Source
trace-lvars
macroUsage: (trace-lvars title & lvars)
Goal for tracing the values of logic variables.
Source
trace-s
macroUsage: (trace-s)
Goal that prints the current substitution
Source
waiting-stream-check
functionUsage: (waiting-stream-check w success-cont failure-cont)
Take a waiting stream, a success continuation, and a failure continuation.
If we don't find any ready suspended streams, invoke the failure continuation.
If we find a ready suspended stream calculate the remainder of the waiting
stream. If we've reached the fixpoint just call the thunk of the suspended
stream, otherwise call mplus on the result of the thunk and the remainder
of the waiting stream. Pass this result to the success contination.
SourcePublic Variables and Functions
!=
functionUsage: (!= u v)
A finite domain constraint. u and v must not be equal. u and v
must eventually be given domains if vars.
Source
*
functionUsage: (* x y product)
A finite domain constraint for multiplication and
thus division. x, y & product must be eventually be given
domains if vars.
Source
+
functionUsage: (+ x y sum)
A finite domain constraint for addition and subtraction.
x, y & sum must eventually be given domains if vars.
Source
->FiniteDomain
functionUsage: (->FiniteDomain s min max)
Positional factory function for class clojure.core.logic.fd.FiniteDomain.
Source
->IntervalFD
functionUsage: (->IntervalFD lb ub)
Positional factory function for class clojure.core.logic.fd.IntervalFD.
Source
->MultiIntervalFD
functionUsage: (->MultiIntervalFD min max is)
Positional factory function for class clojure.core.logic.fd.MultiIntervalFD.
Source
-distinctc
functionUsage: (-distinctc x y* n*)
The real *individual* distinct constraint. x is a var that now is bound to
a single value. y* were the non-singleton bound vars that existed at the
construction of the constraint. n* is the set of singleton domain values
that existed at the construction of the constraint. We use categorize to
determine the current non-singleton bound vars and singleton vlaues. if x
is in n* or the new singletons we have failed. If not we simply remove
the value of x from the remaining non-singleton domains bound to vars.
Source
<
functionUsage: (< u v)
A finite domain constraint. u must be less than v. u and v
must eventually be given domains if vars.
Source
<=
functionUsage: (<= u v)
A finite domain constraint. u must be less than or equal to v.
u and v must eventually be given domains if vars.
Source
==
functionUsage: (== u v)
A finite domain constraint. u and v must be equal. u and v must
eventually be given domains if vars.
Source
>
functionUsage: (> u v)
A finite domain constraint. u must be greater than v. u and v
must eventually be given domains if vars.
Source
>=
functionUsage: (>= u v)
A finite domain constraint. u must be greater than or equal to v.
u and v must eventually be given domains if vars.
Source
bounded-listo
functionUsage: (bounded-listo l n)
Ensure that the list l never grows beyond bound n.
n must have been assigned a domain.
Source
distinct
functionUsage: (distinct v*)
A finite domain constraint that will guarantee that
all vars that occur in v* will be unified with unique
values. v* need not be ground. Any vars in v* should
eventually be given a domain.
Source
distinctc
functionUsage: (distinctc v*)
The real distinct constraint. v* can be seq of logic vars and
values or it can be a logic var itself. This constraint does not
run until v* has become ground. When it has become ground we group
v* into a set of logic vars and a sorted set of known singleton
values. We then construct the individual constraint for each var.
Source
dom
functionUsage: (dom x dom)
Assign a var x a domain.
Source
domain
functionUsage: (domain & args)
Construct a domain for assignment to a var. Arguments should
be integers given in sorted order. domains may be more efficient
than intervals when only a few values are possible.
Source
in
macroUsage: (in & xs-and-dom)
Assign vars to domain. The domain must come last.
Source
interval
functionUsage: (interval ub)
(interval lb ub)
Construct an interval for an assignment to a var. intervals may
be more efficient that the domain type when the range of possiblities
is large.
Source
process-dom
functionUsage: (process-dom x dom domp)
If x is a var we update its domain. If it's an integer
we check that it's a member of the given domain. dom is
then new domain, it should have already been calculated from
domp which was the previous domain.
Source