On Friday, September 9, 2016 at 6:36:17 AM UTC-5, puzzler wrote:
>
> ...
> You can use `into` to "pour" the sequence into the collection of your
> choice. If you're using `into`, then most of these sequence functions
> support transducers to avoid allocation of intermediate sequences,
> providing a speed boost.
>
I routinely use `vec` for the kind of case that Colin described. The
effect is the same as `(into [] ...)` but it's more concise and doesn't
require that extra tenth of a moment to figure out what kind of thing
`into` is sending the sequence into. I have no idea whether this is more
or less efficient than using `into`, however.
A succinct summary of the basic idea implicit or explicit in other answers
in this thread:
Most Clojure sequence functions produce lazy sequences.
If you want something anything other than a lazy sequence, convert it
(with vec, into, etc.).
Bit me, too, but the correct rule is very simple, and easy to
remember--which doesn't mean that I always remember to follow it!
Lazy sequences are the Clojure Way.
I love 'em.
And hate them.
It depends.
But they are the Clojure Way.
(Well--until transducers.)
--
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
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.