On Apr 6, 12:16 am, Alex Osborne wrote:
> Calling the set as if it is a fn is a short-hand for "get", that is
> retrieving an element from the set. Why would you want to do this, when
> to look it up you need to know what element is? Sets are based on
> value-equality not reference-equality. T
B Smith-Mannschott writes:
>> Calling the set as if it is a fn is a short-hand for "get", that is
>> retrieving an element from the set. Why would you want to do this, when
>> to look it up you need to know what element is?
>
> Since you asked: canonicalization. I've wanted this on occasion (in
>
On Tue, Apr 6, 2010 at 07:16, Alex Osborne wrote:
> Mark Engelberg writes:
>
>> filter works just as well with a function that returns true and false,
>> so that's not a particularly good example.
>
> Calling the set as if it is a fn is a short-hand for "get", that is
> retrieving an element from
Mark Engelberg writes:
> filter works just as well with a function that returns true and false,
> so that's not a particularly good example.
Calling the set as if it is a fn is a short-hand for "get", that is
retrieving an element from the set. Why would you want to do this, when
to look it up y
On Apr 6, 2010, at 12:20 AM, Mark Engelberg
wrote:
On Mon, Apr 5, 2010 at 8:56 PM, Richard Newman
wrote:
Why this behavior?
It's useful: e.g., you can use a set as a filter.
user=> (filter #{2 3 4 5} (range 1 10))
(2 3 4 5)
filter works just as well with a function that returns true
filter works just as well with a function that returns true and
false, so that's not a particularly good example.
Heh, that's true. Should have re-read :)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@
On Mon, Apr 5, 2010 at 8:56 PM, Richard Newman wrote:
> Why this behavior?
>>
>
> It's useful: e.g., you can use a set as a filter.
>
> user=> (filter #{2 3 4 5} (range 1 10))
> (2 3 4 5)
>
>
filter works just as well with a function that returns true and false, so
that's not a particularly good
Why this behavior?
It's useful: e.g., you can use a set as a filter.
user=> (filter #{2 3 4 5} (range 1 10))
(2 3 4 5)
If you want your alternative, use contains?:
user=> (contains? #{true false} false)
true
--
You received this message because you are subscribed to the Google
Groups "Clojur
Why this behavior?
user=> (#{5 nil} 5)
5
user=> (#{5 nil} 4)
nil
user=> (#{5 nil} nil)
nil
rather than the seemingly more informative:
user=> (#{5 nil} 5)
true
user=> (#{5 nil} 4)
false
user=> (#{5 nil} nil)
true
user=> (#{5 false} true)
false
user=> (#{5 false} false)
true
i.e. set as character