Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Right Right. That makes sense. Thanks. On Thursday, 28 March 2013 17:05:58 UTC-4, David Nolen wrote: > > On Thu, Mar 28, 2013 at 5:01 PM, JvJ >wrote: > >> (defn hates-drink >>[d] >>(is-drink d) >>(not-likes-drink d)) >> > > This is a common mistake. But consider that the following ha

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
On Thu, Mar 28, 2013 at 5:01 PM, JvJ wrote: > (defn hates-drink >[d] >(is-drink d) >(not-likes-drink d)) > This is a common mistake. But consider that the following hardly makes any sense in Clojure either: (defn foo [a b] (+ a b) (- a b)) Clearly the addition is going to get

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Also, on a side note, what's the deal with this: (run* [q] (is-drink q) (not-likes-drink q)) (:dialogic2.bobbysally/Vodka :dialogic2.bobbysally/Daiquiri :dialogic2.bobbysally/Beer) (defn hates-drink [d] (is-drink d) (not-likes-drink d)) (run* [q] (hates-drink q)) (_.0) Why

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Also, on a side note, the following doesn't seem to make sense: (defn hates-drink [d] On Thursday, 28 March 2013 16:53:09 UTC-4, David Nolen wrote: > > Excellent! :) > > > On Thu, Mar 28, 2013 at 4:46 PM, JvJ >wrote: > >> HOORAY! I did it all by myself! (with your help) >> >> (defn not-memb

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
Excellent! :) On Thu, Mar 28, 2013 at 4:46 PM, JvJ wrote: > 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

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
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 bu

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
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. Y

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Btw if I sounded sarcastic I wasn't. I actually would love to spend time thinking about it. On Thursday, 28 March 2013 16:12:06 UTC-4, JvJ 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, J

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
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) ) >( (==

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
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 Mar

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
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 wrote: > Here's what I'm trying... > > (facts a [[1] > [2] > [3] > [4]]) > nil > (facts b [[3] > [4] > [5] > [6]]) > > (run*

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
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 Nole

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
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 wrote: > Thanks, but there's another a

Re: core.logic : In one list but not in another

2013-03-28 Thread David Nolen
You can express not member of list B with disequality. I could show you how to do this, but you'd probably learn more by giving it a try yourself ;) On Thu, Mar 28, 2013 at 2:47 PM, JvJ wrote: > In core.logic, how do the following: "Give me everything that is a member > of list A and not a memb

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
Actually, I found this post: https://groups.google.com/forum/?fromgroups=#!topic/clojure/hz63yeQfiQE But the not operator has to be used first to ensure that the term is ground. It was a little confusing. On Thursday, 28 March 2013 14:54:31 UTC-4, JvJ wrote: > > Thanks, but there's another asp

Re: core.logic : In one list but not in another

2013-03-28 Thread JvJ
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 >

Re: core.logic : In one list but not in another

2013-03-28 Thread Jim - FooBar();
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 "C

core.logic : In one list but not in another

2013-03-28 Thread JvJ
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 clojure@googlegroups.com Note that posts from ne