ClojureDocs

Namespaces

clojure.core.logic

Core.logic is not provided as part of Clojure’s standard distribution, and must be included as a dependency.

Vars in clojure.core.logic

*^%

!=
Disequality constraint. Ensures that u and v will never unify. u and v can be complex terms.
!=c
no doc
*locals*
no doc
->AnswerCache
Positional factory function for class clojure.core.logic.AnswerCache.
->Choice
Positional factory function for class clojure.core.logic.Choice.
->ConstraintStore
Positional factory function for class clojure.core.logic.ConstraintStore.
->LCons
Positional factory function for class clojure.core.logic.LCons.
->LVar
Positional factory function for class clojure.core.logic.LVar.
->Pair
Positional factory function for class clojure.core.logic.Pair.
->PMap
Positional factory function for class clojure.core.logic.PMap.
->Substitutions
Positional factory function for class clojure.core.logic.Substitutions.
->SubstValue
Positional factory function for class clojure.core.logic.SubstValue.
->SuspendedStream
Positional factory function for class clojure.core.logic.SuspendedStream.
-conjo
no doc
-featurec
no doc
-fixc
no doc
-fnm
no doc
-inc
no doc
-nafc
no doc
-predc
no doc
-reify
no doc
-reify*
no doc
-run
no doc
==
A goal that attempts to unify terms u and v.

a

add-attr
no doc
add-dom
no doc
add-var
no doc
addcg
no doc
all
Like fresh but does does not create logic variables.
and*
A function version of all, which takes a list of goals and succeeds only fi they all succeed.
annotate
no doc
appendo
A relation where x, y, and z are proper collections, such that z is x appended to y
assoc-dom
no doc

b

bind*
no doc
bindable?
no doc
build
no doc

c

cgoal
no doc
choice
no doc
composeg
no doc
composeg*
no doc
conda
Soft cut. Once the head of a clause has succeeded all other clauses will be ignored. Non-relational.
conde
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
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
A constraint version of conj
conso
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
Copies a term u into v. Non-relational.

d

defna
Define a soft cut goal. See conda.
defnc
no doc
defne
Define a goal fn. Supports pattern matching. All patterns will be tried. See conde.
defnm
no doc
defnu
Define a committed choice goal. See condu.
distincto
A relation which guarantees no element of l will unify with another element of l.
disunify
no doc

e

empty-f
no doc
empty-s
no doc
emptyo
A relation where a is the empty list
entailed?
no doc
entangle
no doc
everyg
A pseudo-relation that takes a coll and ensures that the goal g succeeds on every element of the collection.
ext
no doc

f

fail
A goal that always fails.
featurec
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
A relation where l is a collection, such that a is the first of l
fix-constraints
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.
fixc
no doc
fk
no doc
fna
Define an anonymous soft cut goal. See conda.
fnc
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
Define an anonymous goal fn. Supports pattern matching. All patterns will be tried. See conde.
fnm
no doc
fnu
Define an anonymous committed choice goal. See condu.
force-ans
no doc
fresh
Creates fresh variables. Goals occuring within form a logical conjunction.

g

get-attr
no doc
get-dom
no doc

i

ifa*
no doc
ifu*
no doc
is
Set the value of a var to value of another var with the operation applied. Non-relational.

l

lcons
Constructs a sequence a with an improper tail d if d is a logic variable.
lcons?
no doc
let-dom
no doc
llist
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.
log
Goal for println
lvar
no doc
lvar?
no doc
lvaro
A goal that succeeds if the argument is fresh. v must be a logic variable. Non-relational.
lvars
no doc

m

make-cs
no doc
map->PMap
Factory function for class clojure.core.logic.PMap, taking a map of keywords to field values.
map->SubstValue
Factory function for class clojure.core.logic.SubstValue, taking a map of keywords to field values.
map->SuspendedStream
Factory function for class clojure.core.logic.SuspendedStream, taking a map of keywords to field values.
master
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
Define a soft cut pattern match. See conda.
matche
Pattern matching macro. All patterns will be tried. See conde.
matchu
Define a committed choice goal. See condu.
member1o
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
A relation where l is a collection, such that l contains x.
mplus*
no doc

n

nafc
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.
nilo
A relation where a is nil
nonlvaro
A goal that succeeds if the argument is not fresh. v must be a logic variable. Non-relational.

o

onceo
no doc
or*
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]).

p

pair
no doc
partial-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
A relation that will permute xl into the yl. May not terminate if xl is not ground.
pred
Check a predicate against the value logic var. Non-relational.
predc
no doc
project
Extract the values bound to the specified logic vars. Non-relational.

r

reifyg
no doc
rem-attr
no doc
rem-dom
no doc
rembero
A relation between l and o where x is removed from l exactly one time.
remcg
no doc
resto
A relation where l is a collection, such that d is the rest of l
run
Executes goals until a maximum of n results are found.
run*
Executes goals until results are exhausted.
run-db
Executes goals until a maximum of n results are found. Uses a specified logic database.
run-db*
Executes goals until results are exhausted. Uses a specified logic database.
run-nc
Executes goals until a maximum of n results are found. Does not occurs-check.
run-nc*
Executes goals until results are exhausted. Does not occurs-check.
runcg
no doc

s

s#
no doc
seqc
no doc
solutions
no doc
stopcg
no doc
subst-val
no doc
subst?
no doc
succeed
A goal that always succeeds.
sync-eset
no doc

t

tabled
Macro for defining a tabled goal. Prefer ^:tabled with the defne/a/u forms over using this directly.
tabled-s
no doc
to-s
no doc
to-stream
no doc
trace-lvars
Goal for tracing the values of logic variables.
trace-s
Goal that prints the current substitution
tramp
no doc
treec
no doc

w

waiting-stream-check
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.
walk*
no doc