On Mon, Mar 2, 2009 at 5:42 PM, Rich Hickey <richhic...@gmail.com> wrote:
>
> On Mar 2, 3:37 pm, Mark Volkmann <r.mark.volkm...@gmail.com> wrote:
>> On Mon, Mar 2, 2009 at 2:11 PM, MikeM <michael.messini...@invista.com> wrote:
>>
>> > I read the part of your article (on lists and vectors) that you linked
>> > to in another thread -
>>
>> > In the list section you show the function into and conj as applied to
>> > lists, but these can also be applied to vectors and will return
>> > vectors,
>>
>> > (into [1 2 3] [4 5]) => [1 2 3 4 5]
>> > (conj [1 2 3] 4 5) => [1 2 3 4 5]
>>
>> > so perhaps mention should be made in the vector section? or perhaps it
>> > would be better to discuss that many functions take a seq-able
>> > argument. Some will return a list if provided a vector, but into and
>> > conj preserve the type of their argument.
>>
>> At the end of the Vectors section I say this:
>> "All the code examples provided above for lists also work for vectors."
>>
>> Do you think I should provide more detail than that?
>>
>> > Also, you mention that vectors are "not efficient when new items need
>> > to be added or removed quickly", but subvec should perhaps be
>> > mentioned as an exception.
>>
>> Can you elaborate on that? You might be teaching me something new.
>>
>> > You've taken on a formidable task in writing this article, please know
>> > that these comments are meant to be constructive and not a criticism
>> > of your work.
>>
>> Thanks! I appreciate all the feedback I can get. I've already made
>> many updates to the article based on the feedback I've received. 
>> Seehttp://ociweb.com/mark/clojure/. I'd be glad add more updates based on
>> your feedback.
>
> Adding/removing items from the end of a vector (conj/pop) is
> efficient, so that statement should be changed.

Thanks for the feedback Rich!

Currently what the article says about Vectors is "They are ideal when
items need to be retrieved by index, but not efficient when new items
need to be added or removed quickly." It doesn't distinguish between
the working in the middle or at the ends. It sounds like it should.

Is it true that lists are more efficient than vectors when items need
to be added and removed from the middle? My goal is to say something
to help developers choose between using a list or a vector based on
the circumstances.

-- 
R. Mark Volkmann
Object Computing, Inc.

--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to