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
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,
(= (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
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
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
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
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
>
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)
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
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
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
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"
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
13 matches
Mail list logo