Provides an implementation of McCarthy's amb
operator with
binding forms and acceptance test operator.
Provides an implementation of McCarthy's `amb` operator with binding forms and acceptance test operator.
(accept condition ret)
(amb & [binds & body])
A macro that provides a non-deterministic way to traverse a space
and find a single solution amongst potentially many. If the search
space is exhausted then amb
will return nil
. The general form
of amb
is as follows:
(amb <bindings> <execution body>)
Where <bindings>
is a typical Clojure bindings form:
[<name1> <value1> ... <nameN> <valueN>]
And <execution body>
is one or more Clojure expressions.
Within the execution body the (accept <condition> <expression>)
form is used to test some combination of the bindings for adherence
to a <condition>
and return an <expression>
that serves as the
return value of the call to amb
.
A call to (amb)
(i.e. without bindings and body) will exhaust
immediately and thus result in nil
as its value.
A macro that provides a non-deterministic way to traverse a space and find a single solution amongst potentially many. If the search space is exhausted then `amb` will return `nil`. The general form of `amb` is as follows: (amb <bindings> <execution body>) Where `<bindings>` is a typical Clojure bindings form: [<name1> <value1> ... <nameN> <valueN>] And `<execution body>` is one or more Clojure expressions. Within the execution body the `(accept <condition> <expression>)` form is used to test some combination of the bindings for adherence to a `<condition>` and return an `<expression>` that serves as the return value of the call to `amb`. A call to `(amb)` (i.e. without bindings and body) will exhaust immediately and thus result in `nil` as its value.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close