Re: not= counterintuitive?

2011-09-06 Thread ax2groin
The clojure.contrib.combinatorics/combinations does do exactly what I was trying to do, although I was doing the problem as an exercise in how to do it, and not in really needing combinations for something else. The combinatorics library certainly does it in a more generic way. Since I knew that I

Re: not= counterintuitive?

2011-09-04 Thread Ken Wesson
On Sat, Sep 3, 2011 at 1:30 PM, Despite wrote: > So, you want to make sure each value in the vector is unique?  My > first thought was to put them into a set, then see if the set was > equal to the vector, but clojure's equality doesn't allow for that. > And if you put the set back into a vector,

Re: not= counterintuitive?

2011-09-03 Thread Alan Malloy
(= (seq v) (distinct v)) will short-circuit as soon as an inequality is found. On Sep 3, 12:47 pm, Meikel Brandmeyer wrote: > Hi, > > Am 03.09.2011 um 19:30 schrieb Despite: > > > So, you want to make sure each value in the vector is unique?  My > > first thought was to put them into a set, then

Re: not= counterintuitive?

2011-09-03 Thread Meikel Brandmeyer
Hi, Am 03.09.2011 um 19:30 schrieb Despite: > So, you want to make sure each value in the vector is unique? My > first thought was to put them into a set, then see if the set was > equal to the vector, but clojure's equality doesn't allow for that. > And if you put the set back into a vector, yo

Re: not= counterintuitive?

2011-09-03 Thread Despite
On Sep 2, 4:48 pm, ax2groin wrote: > That's what I get for posting a question while feeding a 1-year-old > child and getting ready to leave for lunch. > > I was trying to put together a (for) construct to output the > combinations of a set, and my logic was flawed. > > Here's what I really wanted

Re: not= counterintuitive?

2011-09-03 Thread Chouser
On Sat, Sep 3, 2011 at 10:59 AM, Alex Baranosky wrote: > Sounds like you want a function such as: > > none= ...which could be written as #(not-any? #{1} [1 2 3]) --Chouser -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: not= counterintuitive?

2011-09-03 Thread Alex Baranosky
Sounds like you want a function such as: none= On Sep 3, 2011 4:30 AM, "Vijay Lakshminarayanan" wrote: > ax2groin writes: > >> This code doesn't return the value I intuitively expect: >> >> user=> (not= 1 2 1) >> true >> >> When I write that, I was expecting the equivalent of (and (= 1 2) (= 1 >

Re: not= counterintuitive?

2011-09-03 Thread Vijay Lakshminarayanan
ax2groin writes: > This code doesn't return the value I intuitively expect: > > user=> (not= 1 2 1) > true > > When I write that, I was expecting the equivalent of (and (= 1 2) (= 1 > 1)), but the macro expansion is essentially (not (= 1 2 1)). If you were expecting (not (and (= 1 2) (= 1 1)

Re: not= counterintuitive?

2011-09-02 Thread ax2groin
That's what I get for posting a question while feeding a 1-year-old child and getting ready to leave for lunch. I was trying to put together a (for) construct to output the combinations of a set, and my logic was flawed. Here's what I really wanted [for sets of 3]: (for [m x n x o x :while (and

Re: not= counterintuitive?

2011-09-02 Thread Alan Malloy
On Sep 2, 11:14 am, ax2groin wrote: > This code doesn't return the value I intuitively expect: > >   user=> (not= 1 2 1) >   true > > When I write that, I was expecting the equivalent of (and (= 1 2) (= 1 > 1)), but the macro expansion is essentially (not (= 1 2 1)). This is not a macro. -- You

Re: not= counterintuitive?

2011-09-02 Thread Laurent PETIT
2011/9/2 Mark Engelberg > > On Fri, Sep 2, 2011 at 11:14 AM, ax2groin wrote: > >> This code doesn't return the value I intuitively expect: >> >> user=> (not= 1 2 1) >> true >> >> This is exactly what I expect. Those values are not all equal. > same for me > -- > You received this message b

Re: not= counterintuitive?

2011-09-02 Thread Mark Engelberg
On Fri, Sep 2, 2011 at 11:14 AM, ax2groin wrote: > This code doesn't return the value I intuitively expect: > > user=> (not= 1 2 1) > true > > This is exactly what I expect. Those values are not all equal. -- You received this message because you are subscribed to the Google Groups "Clojure"

not= counterintuitive?

2011-09-02 Thread ax2groin
This code doesn't return the value I intuitively expect: user=> (not= 1 2 1) true When I write that, I was expecting the equivalent of (and (= 1 2) (= 1 1)), but the macro expansion is essentially (not (= 1 2 1)). Note: This came out of the :while condition of a (for) expression not returnin