HOORAY! I did it all by myself! (with your help) (defn not-membero [x l] (fresh [head tail] (conde ( (== l ()) ) ( (conso head tail l) (!= x head) (not-membero x tail) ))))
On Thursday, 28 March 2013 16:21:41 UTC-4, David Nolen wrote: > > My point here isn't to tickle your brain but point out that there's a bit > of misunderstanding about how core.logic works and what facilities you > should use to handle your problem. > > It should be clear soon enough that it will be very difficult to formulate > your problem in terms of facts or conde. > > You said you wanted q to be a member of a some list A. Then why not use > membero? But you don't want q to be a member of some list B. Then try to > write a not-membero in terms of disequality. > > (run* [q] > (membero q '(1 2 3 4)) > (not-membero q '(3 4 5 6))) > > David > > > On Thu, Mar 28, 2013 at 4:12 PM, JvJ <kfjwh...@gmail.com <javascript:>>wrote: > >> Any other hints? I'd love to spend time on this brain tickler, but I >> have other things to do. >> >> >> On Thursday, 28 March 2013 16:05:00 UTC-4, JvJ wrote: >>> >>> Alright, I'm starting to get it.... but not quite there >>> >>> (run* [q] >>> (fresh [x] >>> (conde >>> ( (== q 1) ) >>> ( (== q 2) ) >>> ( (== q 3) ) >>> ( (== q 4) )) >>> >>> (conde >>> ( (== x 3) ) >>> ( (== x 4) ) >>> ( (== x 5) ) >>> ( (== x 6) )) >>> >>> (!= q x))) >>> (1 1 1 2 1 2 2 2 3 4 3 3 4 4) >>> >>> On Thursday, 28 March 2013 15:44:01 UTC-4, David Nolen wrote: >>>> >>>> This won't work. Rewrite this example w/o using facts and try to >>>> understand why it won't work. >>>> >>>> David >>>> >>>> On Thu, Mar 28, 2013 at 3:37 PM, JvJ <kfjwh...@gmail.com> wrote: >>>> >>>>> Here's what I'm trying... >>>>> >>>>> (facts a [[1] >>>>> [2] >>>>> [3] >>>>> [4]]) >>>>> nil >>>>> (facts b [[3] >>>>> [4] >>>>> [5] >>>>> [6]]) >>>>> >>>>> (run* [q] >>>>> (a q) >>>>> (fresh [x] >>>>> (b x) >>>>> (!= q x))) >>>>> (1 1 2 1 1 2 2 2 3 4 3 3 4 4) >>>>> >>>>> So what the heck is this all about? >>>>> >>>>> On Thursday, 28 March 2013 15:17:24 UTC-4, David Nolen wrote: >>>>> >>>>>> negation is hard. This has come up several times. It may be possible >>>>>> to a better form of negation as failure via delays, but this not high on >>>>>> my >>>>>> current priority list. Patches to make it work are of course most >>>>>> welcome. >>>>>> >>>>>> >>>>>> On Thu, Mar 28, 2013 at 2:54 PM, JvJ <kfjwh...@gmail.com> wrote: >>>>>> >>>>>>> Thanks, but there's another aspect to this. >>>>>>> >>>>>>> Let's say I had two relations A and B, and I wanted all q such that >>>>>>> (A q) >>>>>>> (not (B q)) >>>>>>> >>>>>>> How would that work? >>>>>>> >>>>>>> >>>>>>> On Thursday, 28 March 2013 14:50:33 UTC-4, Jim foo.bar wrote: >>>>>>> >>>>>>>> clojure.set/difference >>>>>>>> 'membero' combined with its negated form? >>>>>>>> >>>>>>>> Jim >>>>>>>> >>>>>>>> On 28/03/13 18:47, JvJ wrote: >>>>>>>> > In core.logic, how do the following: "Give me everything that is >>>>>>>> a >>>>>>>> > member of list A and not a member of list B"? >>>>>>>> > -- >>>>>>>> > -- >>>>>>>> > 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<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+u...@**googlegroups.com. >>>>>>>> > For more options, visit https://groups.google.com/**grou**** >>>>>>>> ps/opt_out <https://groups.google.com/groups/opt_out>. >>>>>>>> > >>>>>>>> > >>>>>>>> >>>>>>>> -- >>>>>>> -- >>>>>>> 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<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+u...@**googlegroups.com. >>>>>>> For more options, visit >>>>>>> https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out> >>>>>>> . >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>>> -- >>>>> -- >>>>> 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<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+u...@googlegroups.com. >>>>> For more options, visit >>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out> >>>>> . >>>>> >>>>> >>>>> >>>> >>>> -- >> -- >> 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<javascript:> >> 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 <javascript:> >> 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+u...@googlegroups.com <javascript:>. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- -- 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.