Usage: (!= u v)
Disequality constraint. Ensures that u and v will never unify. u and v can be complex terms.Source
Usage: (->AnswerCache ansl anss _meta)
Positional factory function for class clojure.core.logic.AnswerCache.Source
Usage: (->Choice a f)
Positional factory function for class clojure.core.logic.Choice.Source
Usage: (->ConstraintStore km cm cid running)
Positional factory function for class clojure.core.logic.ConstraintStore.Source
Usage: (->LCons a d cache meta)
Positional factory function for class clojure.core.logic.LCons.Source
Usage: (->LVar id unique name oname hash meta)
Positional factory function for class clojure.core.logic.LVar.Source
Usage: (->PMap)
Positional factory function for class clojure.core.logic.PMap.Source
Usage: (->Pair lhs rhs)
Positional factory function for class clojure.core.logic.Pair.Source
Usage: (->SubstValue v doms eset)
Positional factory function for class clojure.core.logic.SubstValue.Source
Usage: (->Substitutions s vs ts cs cq cqs oc _meta)
Positional factory function for class clojure.core.logic.Substitutions.Source
Usage: (->SuspendedStream cache ansv* f)
Positional factory function for class clojure.core.logic.SuspendedStream.Source
Usage: (and* goals)
A function version of all, which takes a list of goals and succeeds only if they all succeed.Source
Usage: (appendo x y z)
A relation where x, y, and z are proper collections, such that z is x appended to ySource
Usage: (conda & clauses)
Soft cut. Once the head of a clause has succeeded all other clauses will be ignored. Non-relational.Source
Usage: (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
Usage: (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
Usage: (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
Usage: (defne & rest)
Define a goal fn. Supports pattern matching. All patterns will be tried. See conde.Source
Usage: (distincto l)
A relation which guarantees no element of l will unify with another element of l.Source
Usage: (everyg g coll)
A pseudo-relation that takes a coll and ensures that the goal g succeeds on every element of the collection.Source
Usage: (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
Usage: (firsto l a)
A relation where l is a collection, such that a is the first of lSource
Usage: (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
Usage: (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
Usage: (fne & rest)
Define an anonymous goal fn. Supports pattern matching. All patterns will be tried. See conde.Source
Usage: (fresh [& lvars] & goals)
Creates fresh variables. Goals occuring within form a logical conjunction.Source
Usage: (is u v op)
Set the value of a var to value of another var with the operation applied. Non-relational.Source
Usage: (lcons a d)
Constructs a sequence a with an improper tail d if d is a logic variable.Source
Usage: (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
Usage: (lvaro v)
A goal that succeeds if the argument is fresh. v must be a logic variable. Non-relational.Source
Usage: (map->PMap m#)
Factory function for class clojure.core.logic.PMap, taking a map of keywords to field values.Source
Usage: (map->SubstValue m#)
Factory function for class clojure.core.logic.SubstValue, taking a map of keywords to field values.Source
Usage: (map->SuspendedStream m#)
Factory function for class clojure.core.logic.SuspendedStream, taking a map of keywords to field values.Source
Usage: (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
Usage: (matche xs & cs)
Pattern matching macro. All patterns will be tried. See conde.Source
Usage: (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
Usage: (membero x l)
A relation where l is a collection, such that l contains x.Source
Usage: (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
Usage: (nonlvaro v)
A goal that succeeds if the argument is not fresh. v must be a logic variable. Non-relational.Source
Usage: (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
Usage: (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
Usage: (permuteo xl yl)
A relation that will permute xl into the yl. May not terminate if xl is not ground.Source
Usage: (project [& vars] & goals)
Extract the values bound to the specified logic vars. Non-relational.Source
Usage: (rembero x l o)
A relation between l and o where x is removed from l exactly one time.Source
Usage: (resto l d)
A relation where l is a collection, such that d is the rest of lSource
Usage: (run n bindings & goals)
Executes goals until a maximum of n results are found.Source
Usage: (run-db n db bindings & goals)
Executes goals until a maximum of n results are found. Uses a specified logic database.Source
Usage: (run-db* db bindings & goals)
Executes goals until results are exhausted. Uses a specified logic database.Source
Usage: (run-nc n bindings & goals)
Executes goals until a maximum of n results are found. Does not occurs-check.Source
Usage: (run-nc* & goals)
Executes goals until results are exhausted. Does not occurs-check.Source
Usage: (tabled args & grest)
Macro for defining a tabled goal. Prefer ^:tabled with the defne/a/u forms over using this directly.Source
Usage: (trace-lvars title & lvars)
Goal for tracing the values of logic variables.Source
Usage: (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.Source
Usage: (<= x y)
Goal for testing whether x is less than or equal to y. Non-relational.Source
Usage: (>= x y)
Goal for testing whether x is greater than or equal to y. Non-relational.Source
Usage: (all-connected-to-allo l)
Collect all cliques in l. l must be bounded to ensure termination.Source
Usage: (connected-to-allo v vs)
Ensure that vertex v is connected to all vertices vs.Source
Usage: (!= u v)
A finite domain constraint. u and v must not be equal. u and v must eventually be given domains if vars.Source
Usage: (* x y product)
A finite domain constraint for multiplication and thus division. x, y & product must be eventually be given domains if vars.Source
Usage: (+ x y sum)
A finite domain constraint for addition and subtraction. x, y & sum must eventually be given domains if vars.Source
Usage: (->FiniteDomain s min max)
Positional factory function for class clojure.core.logic.fd.FiniteDomain.Source
Usage: (->IntervalFD lb ub)
Positional factory function for class clojure.core.logic.fd.IntervalFD.Source
Usage: (->MultiIntervalFD min max is)
Positional factory function for class clojure.core.logic.fd.MultiIntervalFD.Source
Usage: (-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
Usage: (< u v)
A finite domain constraint. u must be less than v. u and v must eventually be given domains if vars.Source
Usage: (<= 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
Usage: (== u v)
A finite domain constraint. u and v must be equal. u and v must eventually be given domains if vars.Source
Usage: (> u v)
A finite domain constraint. u must be greater than v. u and v must eventually be given domains if vars.Source
Usage: (>= 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
Usage: (bounded-listo l n)
Ensure that the list l never grows beyond bound n. n must have been assigned a domain.Source
Usage: (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
Usage: (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
Usage: (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
Usage: (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
Usage: (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
Usage: (->Nom lvar)
Positional factory function for class clojure.core.logic.nominal.Nom.Source
Usage: (->Tie binding-nom body)
Positional factory function for class clojure.core.logic.nominal.Tie.Source
Usage: (fresh [& noms] & goals)
Creates fresh noms. Goals occuring within form a logical conjunction.Source
Usage: (map->Tie m#)
Factory function for class clojure.core.logic.nominal.Tie, taking a map of keywords to field values.Source
Usage: (prep expr)
Prep a quoted expression. All symbols preceded by ? will be replaced with logic vars.Source
Usage: (unifier ts)
(unifier opts ts)
Return the unifier for terms ts. Will prep the terms.Source
Usage: (unifier* ts)
(unifier* opts ts)
Return the unifier that unifies terms ts. All terms in ts should prepped terms.Source
Usage: (unify ts)
(unify opts ts)
Unify the terms ts returning a the value that represents their unificaiton. Will prep the terms.Source