core.logic, comparators

48 views
Skip to first unread message

Brent Millare

unread,
May 19, 2012, 4:27:38 PM5/19/12
to clo...@googlegroups.com
I understand how to construct goals using the primitives provided in core.logic, like a conjunction with fresh or all, and using relations defined with defrel. However, I don't really understand the protocols of goals once I no longer use these primitives.

How would I define my own comparison like function? Instead of unifying, I'd like to do a comparison.

Something like this:

...

(l/fact person :bob 3)
(l/fact person :april 2)

(l/run 5 [q]
    (l/> q 2)
    (l/fresh [name]
        (person name q)))
(3)

What would be the definition for l/>?

David Nolen

unread,
May 19, 2012, 4:53:28 PM5/19/12
to clo...@googlegroups.com
Such operators are available in core.logic.arithmetic. In general such operations are non-relational and require projection. cKanren offers a better story here.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
Reply all
Reply to author
Forward
0 new messages