On Wed, May 25, 2011 at 12:55 AM, Alex Robbins <
[email protected]> wrote:
> What is the difference between
> (into #{} (for x......))
> and
> (set (for x ......))
> Is one preferred?
>
>
I don't think one is preferred over the other in general.
Personally I prefer into, I find it generally more useful in more
situations.
If you are merging sets, or any seqs for that matter, `into` is useful.
(into #{1 2} (for x...))
I'm not sure about speed. `set` calls a PersistentSet Java factory method
and `into` uses reduce. I would imagine they are pretty close. NB:
speculation.
Thanks,
Ambrose
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
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