On Fri, Jan 23, 2009 at 4:04 PM, Mark Volkmann
<[email protected]> wrote:
>
> Why does this work
>
> (some (set "aeiou") "e")
>
> but this doesn't
>
> (some #{"aeiou"} "e")
>
> I thought (set ...) was equivalent to #{...}.
(hash-set ...) is equivalent to #{...}
'set' takes a single collection as an argument, which it will treat as
a seq and pour into a hash-set, so above the string behaves as a seq
of chars, and each char becomes an item in the set:
user=> (set "aeiou")
#{\a \e \i \o \u}
On the other hand, hash-set and #{} expect several args, each of which
becomes an item in the set:
user=> (hash-set "aeiou")
#{"aeiou"}
--Chouser
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---