Liking cljdoc? Tell your friends :D

clojure.core.logic


!=clj

(!= 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.
sourceraw docstring

!=cclj

(!=c p)
source

*locals*clj

source

*logic-dbs*clj

source

-conjoclj

(-conjo coll args out)
source

-featurecclj

(-featurec x fs)
source

-fixcclj

(-fixc x f reifier)
(-fixc x f runnable reifier)
source

-fnmcljmacro

(-fnm fn-gen t as & cs)
source

-inccljmacro

(-inc & rest)
source

-nafcclj

(-nafc c args)
source

-predcclj

(-predc x p)
(-predc x p pform)
source

-reifyclj

(-reify s v)
(-reify s v r)
source

-reify*clj

(-reify* s v)
source

-runcljmacro

(-run opts [x :as bindings] & goals)
source

==clj

(== u v)

A goal that attempts to unify terms u and v.

A goal that attempts to unify terms u and v.
sourceraw docstring

add-attrclj

(add-attr s x attr attrv)
source

add-domclj

(add-dom s x dom domv)
(add-dom s x dom domv seenset)
source

add-varclj

(add-var cs x c)
source

addcgclj

(addcg c)
source

allcljmacro

(all)
(all & goals)

Like fresh but does does not create logic variables.

Like fresh but does does not create logic variables.
sourceraw docstring

and*clj

(and* goals)

A function version of all, which takes a list of goals and succeeds only fi they all succeed.

A function version of all, which takes a list of goals and succeeds only fi they all succeed.
sourceraw docstring

annotateclj

(annotate k v)
source

answer-cacheclj

(answer-cache)
source

appendoclj

(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
sourceraw docstring

assoc-domclj

(assoc-dom x k v)
source

assoc-metaclj

(assoc-meta x k v)
source

bind*cljmacro

(bind* a g)
(bind* a g & g-rest)
source

bindable?clj

(bindable? x)
source

buildclj

(build s u)
source

cgoalclj

(cgoal c)
source

choiceclj

(choice a f)
source

composegclj

(composeg)
(composeg g0 g1)
source

composeg*cljmacro

(composeg* g0)
(composeg* g0 & gs)
source

condacljmacro

(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.
sourceraw docstring

condecljmacro

(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.
sourceraw docstring

conducljmacro

(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.
sourceraw docstring

conjoclj

(conjo coll & args)

A constraint version of conj

A constraint version of conj
sourceraw docstring

consoclj

(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.
sourceraw docstring

constrain-treeclj

(constrain-tree t fc)
source

copy-termclj

(copy-term u v)

Copies a term u into v. Non-relational.

Copies a term u into v. Non-relational.
sourceraw docstring

defnacljmacro

(defna & rest)

Define a soft cut goal. See conda.

Define a soft cut goal. See conda.
sourceraw docstring

defnccljmacro

(defnc name args & body)
source

defnecljmacro

(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.
sourceraw docstring

defnmcljmacro

(defnm t n & rest)
source

defnucljmacro

(defnu & rest)

Define a committed choice goal. See condu.

Define a committed choice goal. See condu.
sourceraw docstring

dissoc-domclj

(dissoc-dom x k)
source

dissoc-metaclj

(dissoc-meta x k)
source

distinctoclj

(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.
sourceraw docstring

distributeclj

(distribute v* strategy)
source

disunifyclj

(disunify s u v)
(disunify s u v cs)
source

empty-fclj

source

empty-sclj

source

emptyoclj

(emptyo a)

A relation where a is the empty list

A relation where a is the empty list
sourceraw docstring

enforce-constraintsclj

(enforce-constraints x)
source

enforceable-constrainedclj

(enforceable-constrained a)
source

entailed?clj

(entailed? c c' a)
source

entangleclj

(entangle s x y)
source

env-localsclj

(env-locals & syms)
source

everygclj

(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.
sourceraw docstring

extclj

(ext s u v)
source

ext-run-csgclj

(ext-run-csg u v)
source

failclj

(fail a)

A goal that always fails.

A goal that always fails.
sourceraw docstring

featurecclj

(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.
sourceraw docstring

firstoclj

(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
sourceraw docstring

fix-constraintsclj

(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.
sourceraw docstring

fixcclj

(fixc x f reifier)
(fixc x f runnable reifier)
source

fkclj

source

fnacljmacro

(fna & rest)

Define an anonymous soft cut goal. See conda.

Define an anonymous soft cut goal. See conda.
sourceraw docstring

fnccljmacro

(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.
sourceraw docstring

fnecljmacro

(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.
sourceraw docstring

fnmcljmacro

(fnm t as tabled? & cs)
source

fnucljmacro

(fnu & rest)

Define an anonymous committed choice goal. See condu.

Define an anonymous committed choice goal. See condu.
sourceraw docstring

force-ansclj

(force-ans x)
source

freshcljmacro

(fresh [& lvars] & goals)

Creates fresh variables. Goals occuring within form a logical conjunction.

Creates fresh variables. Goals occuring within form a logical
conjunction.
sourceraw docstring

get-attrclj

(get-attr s x attr)
source

get-domclj

(get-dom s x dom)
source

get-dom-fdclj

(get-dom-fd a x)
source

ground-term?clj

(ground-term? x s)
source

ientailed?clj

(ientailed? c)
source

ifa*cljmacro

(ifa*)
(ifa* [e & gs] & grest)
source

ifu*cljmacro

(ifu*)
(ifu* [e & gs] & grest)
source

iscljmacro

(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.
sourceraw docstring

lconsclj

(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.
sourceraw docstring

lcons?clj

(lcons? x)
source

let-domcljmacro

(let-dom a vars & body)
source

llistcljmacro

(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.
sourceraw docstring

logcljmacro

(log & s)

Goal for println

Goal for println
sourceraw docstring

lvarclj

(lvar)
(lvar name)
(lvar name unique)
source

lvar?clj

(lvar? x)
source

lvarocljmacro

(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.
sourceraw docstring

lvarsclj

(lvars n)
source

make-csclj

(make-cs)
source

make-suspended-streamclj

(make-suspended-stream cache ansv* f)
source

masterclj

(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.
sourceraw docstring

matchacljmacro

(matcha xs & cs)

Define a soft cut pattern match. See conda.

Define a soft cut pattern match. See conda.
sourceraw docstring

matchecljmacro

(matche xs & cs)

Pattern matching macro. All patterns will be tried. See conde.

Pattern matching macro. All patterns will be tried.
See conde.
sourceraw docstring

matchucljmacro

(matchu xs & cs)

Define a committed choice goal. See condu.

Define a committed choice goal. See condu.
sourceraw docstring

member1oclj

(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.
sourceraw docstring

memberoclj

(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.
sourceraw docstring

merge-domsclj

(merge-doms s x doms)
source

merge-with-rootclj

(merge-with-root s x root)
source

mplus*cljmacro

(mplus* e)
(mplus* e & e-rest)
source

nafcclj

(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.
sourceraw docstring

niloclj

(nilo a)

A relation where a is nil

A relation where a is nil
sourceraw docstring

nonlvarocljmacro

(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.
sourceraw docstring

normalize-storeclj

source

occurs-checkclj

(occurs-check s u v)
source

onceoclj

(onceo g)
source

or*clj

(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]).
sourceraw docstring

pairclj

source

partial-mapclj

(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.
sourceraw docstring

partial-map?clj

(partial-map? x)
source

permuteoclj

(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.
sourceraw docstring

predcljmacro

(pred v f)

Check a predicate against the value logic var. Non-relational.

Check a predicate against the value logic var. Non-relational.
sourceraw docstring

predcclj

(predc x p)
(predc x p pform)
source

projectcljmacro

(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.
sourceraw docstring

recover-varsclj

(recover-vars p)
source

recover-vars-from-termclj

(recover-vars-from-term x)
source

reify-constraintsclj

(reify-constraints v r a)
source

reify-lvar-nameclj

(reify-lvar-name s)
source

reifygclj

(reifyg x)
source

rem-attrclj

(rem-attr s x attr)
source

rem-domclj

(rem-dom s x dom)
(rem-dom s x dom seenset)
source

remberoclj

(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.
sourceraw docstring

remcgclj

(remcg c)
source

restoclj

(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
sourceraw docstring

runcljmacro

(run n bindings & goals)

Executes goals until a maximum of n results are found.

Executes goals until a maximum of n results are found.
sourceraw docstring

run*cljmacro

(run* bindings & goals)

Executes goals until results are exhausted.

Executes goals until results are exhausted.
sourceraw docstring

run-constraintclj

(run-constraint c)
source

run-constraintsclj

(run-constraints xcs)
source

run-constraints*clj

(run-constraints* xs cs ws)
source

run-dbcljmacro

(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.
sourceraw docstring

run-db*cljmacro

(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.
sourceraw docstring

run-nccljmacro

(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.
sourceraw docstring

run-nc*cljmacro

(run-nc* & goals)

Executes goals until results are exhausted. Does not occurs-check.

Executes goals until results are exhausted. Does not occurs-check.
sourceraw docstring

runcgclj

(runcg c)
source

s#clj

source

seqcclj

(seqc v)
source

solutionsclj

(solutions s g)
(solutions s q g)
source

sort-by-member-countclj

(sort-by-member-count a)
source

sort-by-strategyclj

(sort-by-strategy v x a)
source

stopcgclj

(stopcg c)
source

subst-valclj

(subst-val x)
(subst-val x doms)
(subst-val x doms _meta)
(subst-val x doms eset _meta)
source

subst-val?clj

(subst-val? x)
source

subst?clj

(subst? x)
source

succeedclj

(succeed a)

A goal that always succeeds.

A goal that always succeeds.
sourceraw docstring

suspended-stream?clj

(suspended-stream? x)
source

sync-esetclj

(sync-eset s v seenset f)
source

tabledcljmacro

(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.
sourceraw docstring

tabled-sclj

(tabled-s)
(tabled-s oc)
(tabled-s oc meta)
source

to-sclj

(to-s v)
source

to-streamclj

(to-stream aseq)
source

to-subst-valclj

(to-subst-val v)
source

trace-lvarclj

(trace-lvar a lvar)
source

trace-lvarscljmacro

(trace-lvars title & lvars)

Goal for tracing the values of logic variables.

Goal for tracing the values of logic variables.
sourceraw docstring

trace-scljmacro

(trace-s)

Goal that prints the current substitution

Goal that prints the current substitution
sourceraw docstring

trampclj

(tramp f)
source

tree-term?clj

(tree-term? x)
source

treecclj

(treec x fc reifier)
source

u#clj

source

uaicljmacro

(uai & args)
source

umicljmacro

(umi & args)
source

unbound-namesclj

source

unbound-randsclj

(unbound-rands a c)
source

unifyclj

(unify s u v)
source

unify-with-map*clj

(unify-with-map* u v s)
source

unify-with-pmap*clj

(unify-with-pmap* u v s)
source

unify-with-sequential*clj

(unify-with-sequential* u v s)
source

update-domclj

(update-dom s x dom f)
(update-dom s x dom f seenset)
source

update-esetclj

(update-eset s doms eset)
source

update-pvars!clj

(update-pvars! x vars)
source

updatecgclj

(updatecg c)
source

var-randsclj

(var-rands a c)
source

verify-all-boundclj

(verify-all-bound a constrained)
source

waiting-stream-checkclj

(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.
sourceraw docstring

waiting-stream?clj

(waiting-stream? x)
source

walk*clj

(walk* s v)
source

walk-record-termclj

(walk-record-term v f)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close