(!= u v)
Disequality constraint. Ensures that u and v will never unify. u and v can be complex terms.
Disequality constraint. Ensures that u and v will never unify. u and v can be complex terms.
(== u v)
A goal that attempts to unify terms u and v.
A goal that attempts to unify terms u and v.
(all)
(all & goals)
Like fresh but does does not create logic variables.
Like fresh but does does not create logic variables.
(and* goals)
A function version of all, which takes a list of goals and succeeds only if they all succeed.
A function version of all, which takes a list of goals and succeeds only if they all succeed.
(appendo x y z)
A relation where x, y, and z are proper collections, such that z is x appended to y
A relation where x, y, and z are proper collections, such that z is x appended to y
(conda & clauses)
Soft cut. Once the head of a clause has succeeded all other clauses will be ignored. Non-relational.
Soft cut. Once the head of a clause has succeeded all other clauses will be ignored. Non-relational.
(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.
Logical disjunction of the clauses. The first goal in a clause is considered the head of that clause. Interleaves the execution of the clauses.
(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.
Committed choice. Once the head (first goal) of a clause has succeeded, remaining goals of the clause will only be run once. Non-relational.
(conjo coll & args)
A constraint version of conj
A constraint version of conj
(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.
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.
(copy-term u v)
Copies a term u into v. Non-relational.
Copies a term u into v. Non-relational.
(defna & rest)
Define a soft cut goal. See conda.
Define a soft cut goal. See conda.
(defne & rest)
Define a goal fn. Supports pattern matching. All patterns will be tried. See conde.
Define a goal fn. Supports pattern matching. All patterns will be tried. See conde.
(defnu & rest)
Define a committed choice goal. See condu.
Define a committed choice goal. See condu.
(distincto l)
A relation which guarantees no element of l will unify with another element of l.
A relation which guarantees no element of l will unify with another element of l.
(emptyo a)
A relation where a is the empty list
A relation where a is the empty list
(everyg g coll)
A pseudo-relation that takes a coll and ensures that the goal g succeeds on every element of the collection.
A pseudo-relation that takes a coll and ensures that the goal g succeeds on every element of the collection.
(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.
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.
(firsto l a)
A relation where l is a collection, such that a is the first of l
A relation where l is a collection, such that a is the first of l
(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.
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.
(fna & rest)
Define an anonymous soft cut goal. See conda.
Define an anonymous soft cut goal. See conda.
(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.
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.
(fne & rest)
Define an anonymous goal fn. Supports pattern matching. All patterns will be tried. See conde.
Define an anonymous goal fn. Supports pattern matching. All patterns will be tried. See conde.
(fnu & rest)
Define an anonymous committed choice goal. See condu.
Define an anonymous committed choice goal. See condu.
(fresh [& lvars] & goals)
Creates fresh variables. Goals occuring within form a logical conjunction.
Creates fresh variables. Goals occuring within form a logical conjunction.
(is u v op)
Set the value of a var to value of another var with the operation applied. Non-relational.
Set the value of a var to value of another var with the operation applied. Non-relational.
(lcons a d)
Constructs a sequence a with an improper tail d if d is a logic variable.
Constructs a sequence a with an improper tail d if d is a logic variable.
(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.
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.
(lvaro v)
A goal that succeeds if the argument is fresh. v must be a logic variable. Non-relational.
A goal that succeeds if the argument is fresh. v must be a logic variable. Non-relational.
(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.
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.
(matcha xs & cs)
Define a soft cut pattern match. See conda.
Define a soft cut pattern match. See conda.
(matche xs & cs)
Pattern matching macro. All patterns will be tried. See conde.
Pattern matching macro. All patterns will be tried. See conde.
(matchu xs & cs)
Define a committed choice goal. See condu.
Define a committed choice goal. See condu.
(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.
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.
(membero x l)
A relation where l is a collection, such that l contains x.
A relation where l is a collection, such that l contains x.
(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.
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.
(nonlvaro v)
A goal that succeeds if the argument is not fresh. v must be a logic variable. Non-relational.
A goal that succeeds if the argument is not fresh. v must be a logic variable. Non-relational.
(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]).
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]).
(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.
Given map m, returns partial map that unifies with maps even if it doesn't share all of the keys of that map.
(permuteo xl yl)
A relation that will permute xl into the yl. May not terminate if xl is not ground.
A relation that will permute xl into the yl. May not terminate if xl is not ground.
(pred v f)
Check a predicate against the value logic var. Non-relational.
Check a predicate against the value logic var. Non-relational.
(project [& vars] & goals)
Extract the values bound to the specified logic vars. Non-relational.
Extract the values bound to the specified logic vars. Non-relational.
(rembero x l o)
A relation between l and o where x is removed from l exactly one time.
A relation between l and o where x is removed from l exactly one time.
(resto l d)
A relation where l is a collection, such that d is the rest of l
A relation where l is a collection, such that d is the rest of l
(run n bindings & goals)
Executes goals until a maximum of n results are found.
Executes goals until a maximum of n results are found.
(run* bindings & goals)
Executes goals until results are exhausted.
Executes goals until results are exhausted.
(run-db n db bindings & goals)
Executes goals until a maximum of n results are found. Uses a specified logic database.
Executes goals until a maximum of n results are found. Uses a specified logic database.
(run-db* db bindings & goals)
Executes goals until results are exhausted. Uses a specified logic database.
Executes goals until results are exhausted. Uses a specified logic database.
(run-nc n bindings & goals)
Executes goals until a maximum of n results are found. Does not occurs-check.
Executes goals until a maximum of n results are found. Does not occurs-check.
(run-nc* & goals)
Executes goals until results are exhausted. Does not occurs-check.
Executes goals until results are exhausted. Does not occurs-check.
(subst-val x)
(subst-val x doms)
(subst-val x doms _meta)
(subst-val x doms eset _meta)
(tabled args & grest)
Macro for defining a tabled goal. Prefer ^:tabled with the defne/a/u forms over using this directly.
Macro for defining a tabled goal. Prefer ^:tabled with the defne/a/u forms over using this directly.
(trace-lvars title & lvars)
Goal for tracing the values of logic variables.
Goal for tracing the values of logic variables.
(trace-s)
Goal that prints the current substitution
Goal that prints the current substitution
(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.
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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close