I'm working through the core.logic examples on http://objectcommando.com.
I want to develop a query that returns the child and his parents. The
gives me what I want:
(run* [q]
(fresh [m f c]
(== c 'Sonny)
(parent m c)
(parent f c)
(!= m f)
(== q {:child c :parents [m f]})))
I'd like to create a re-usable function for parent-of, so I have:
(defn parents-of [m f c]
(parent m c)
(parent f c)
(!= m f))
(run* [q]
(fresh [m f c]
(== c 'Sonny)
(parents-of m f c)
(== q {:child c :parents [m f]})))
produces ({:child Sonny, :parents [_.0 _.1]})
I'm obviously missing something about what I'm actually defining in the
defn but I'm struggling to figure out what it is.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en