On Sat, Jul 6, 2013 at 3:16 PM, Adam Saleh <adamthecam...@gmail.com> wrote:

>
> =>  (run 1 [q]
> #=>   (membero :a q))
> ((:a . _0))
>
> Unfortunately when I try to do something \w it, it throws exception
>
> => (first *1)
> (1 . _0)
> => (first *1)
> IllegalArgumentException Don't know how to create ISeq from:
> clojure.core.logic.LCons  clojure.lang.RT.seqFrom (RT.java:505)
>
> I guess I need to somehow convert the "logic-based" list to
> "clojure-based", how do I do it?
>

A cons cell doesn't really convert to a clojure list, especially when the
last item is fresh.  I guess the real question is: what result do you want
from Clojure?

If you just want to access the values you have now, you can get them with
lfirst/lnext (in clojure.core.logic.protocols) but maybe the better
question to ask is: what clojure result do you actually want?

If you want all the possible proper lists, then I'd suggest constraining it
to be such:

(defn listo [l]
  (conde [(emptyo l)]
             [(fresh [a d]
                 (conso a d l)
                 (listo d))]))


In my experience, calling core.logic from real application code works best
when you write programs that produce fully realized results without any
fresh values

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to