On Mon, Jul 13, 2009 at 8:15 AM, Jan Rychter<j...@rychter.com> wrote:
> And while we're on the subject -- any hints for implementing a stack
> with a fast item count? (apart from a list with a separate counter)

Using conj and pop on vectors for stack operations should work just
fine.  Don't use subvec though; nested subvecs will really start to
slow things down.

Under some circumstances, lists cache their count, and therefore a
list implementation may be just as fast, but I can't remember the
exceptions off-hand, so a vector offers more of a promise of the
behavior you want.

--~--~---------~--~----~------------~-------~--~----~
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