On Nov 22, 1:07 pm, [EMAIL PROTECTED] wrote:
> In one of my data structures I have a vector as a buffer where things
> are appended to. In addition the things in that buffer sometimes get
> modified using map or filter. Now as map and filter return sequences I
> wonder how to get a vector back efficiently. I need a vector in order
> for conj to append and not to prepend as it happens with sequences,
> otherwise the order would be screwed. What is the most efficient (and
> still idiomatic) way to achieve this?
map and filter don't modify anything. What does it mean to filter a
vector?
In any case, the vector itself is immutable, so calling vec on the
return value of filter is fine.
As far as map, if you have a function that will only affect a few of
the items in the vector, you might want to reduce, making 'changes' as
you go.
Rich
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---