`gensym` doesn't create logic vars, `lvar` does. Use `lvar` not `gensym`. David
On Mon, Nov 26, 2012 at 12:48 PM, Frederik De Bleser <frede...@burocrazy.com > wrote: > Hey David, > > I don't quite understand how I would apply your suggestion this with my > example. > > 1. So the "all" function creates a choice point. How do I create lvars? I > tried: > > (run* [q] > (let [vars (repeatedly 3 #(gensym 'x))] > (all > (== q vars)))) > > ;=> ((x4388 x4389 x4390)) > > Shouldn't I get unbound lvars ((_.0 _.1 _.2)) back? What type should an > lvar be? > > 2. How do I call the other goals, like infd and distinctfd? > > I tried: > > (run* [q] > (let [vars (repeatedly 5 #(gensym 'x))] > (all > (infd vars (interval 1 3)) > (distinctfd vars) > (== q vars)))) > > But this gave an error: > > java.lang.ClassCastException: clojure.lang.LazySeq cannot be cast to > java.lang.Number > at clojure.lang.Numbers.gte (Numbers.java:231) > clojure.core.logic.IntervalFD.member_QMARK_ (logic.clj:499) > clojure.core.logic$process_dom$fn__3874.invoke (logic.clj:2959) > clojure.core.logic$composeg$fn__3102.invoke (logic.clj:1516) > clojure.core.logic$domfd$fn__3877.invoke (logic.clj:2971) > clojure.core.logic.Substitutions.bind (logic.clj:1051) > > > functional programming FTW ;) >> > > I'd love to apply what I've learned about Clojure – but for now, once I'm > in a "run*" I enter a mystical land of fairies and butterflies where none > of the functional rules apply :-) > > Thanks for your help, > > Frederik > > > -- > 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 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