Share your thoughts in the 2024 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.logic by

This macro was somewhat useful when I was implementing static analysis for a compiler with core.logic.

(defmacro ==>> (link: expr-in & rel-forms)
"Thread the expr-in through rel-forms then unify with last rel-forms
(the 'out expression').

Example:

 (==>> (link: [1]) (firsto) (firsto) x))
 ;; 'x' will become bound to value 1

This macro expands to:
(fresh (link: _A _B)

 (firsto (link: [1])  _A)
 (firsto _A     _B)
 (==     _B     q))

If you imagine that the 'return value' of firsto is its last parameter,
then it works just like clojure.core/-> as return value of each form is
first argument of the following form."

3 Answers

0 votes
by

Comment made by: jasonjckn

There might be a better name, not sure.

0 votes
by

Comment made by: jasonjckn

renamed ==>> to ==->

0 votes
by
Reference: https://clojure.atlassian.net/browse/LOGIC-38 (reported by jasonjckn)
...