On Sat, Jul 28, 2012 at 8:53 PM, JvJ <[email protected]> wrote:
> I'm having trouble translating some Prolog code to core.logic.
>
> In particular, I'd like to do something like this:
>
>> 2 ?- assert(a(b)).
>> true.
>> 3 ?- assert(a(a(b))).
>> true.
>> 4 ?- a(X).
>> X = b ;
>> X = a(b).
>> 5 ?- a(a(X)).
>> X = b.

While there is no direct translation as far as I can see, something
like the following accomplishes pretty much the same thing:

(defne foo [x]
  ([[:a :b]])
  ([[:a [:a :b]]]))

(run* [q]
  (foo [:a q]))
;; => (:b [:a :b])

-- 
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

Reply via email to