Thanks for the replies, everyone.

@Mr. Gilardi, this is for a one-time only thing. I have a function,
called rep*, that builds up a vector from left to right. Another,
separate function, called rep+, calls rep*, but it needs to slip in an
element at the vector's beginning.

I'm considering changing rep+'s documentation to state that it will
return a "collection" rather than a "vector", and then just use cons
without vec.

On Jun 24, 3:58 pm, "Stephen C. Gilardi" <squee...@mac.com> wrote:
> On Jun 24, 2009, at 6:44 PM, arasoft wrote:
>
> > This also works:
> > (into [-1] [0 1 2 3 4])
> > but I am more than uncertain whether it is "proper".
>
> Generally, the need to insert at the beginning of a vector should  
> trigger some close scrutiny as to whether vector is the right data  
> type to use in this case.
>
> The choice of which operations Clojure provides for each data type was  
> driven by a guiding principle of providing only those operations that  
> are efficient and appropriate for that type.
>
> Of the Clojure collections, "list" is the one best suited for  
> insertion at the front.
>
> --Steve
>
>  smime.p7s
> 3KViewDownload
--~--~---------~--~----~------------~-------~--~----~
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to