On Thu, Feb 3, 2011 at 5:22 PM, Alan <a...@malloys.org> wrote: > You don't need an extra element in the vector to distinguish between > empty and full. You can store (start, size) instead of (start, end).
I considered that, but it made the arithmetic much messier in various places. Count gets simpler, obviously, but things like conj now need to use (start + size + 1) mod capacity and some things get awkward elsewhere. My implementation probably saves a few cycles, at a cost of a few bytes more storage per ring buffer. I suppose either tradeoff is an acceptable choice for nearly all cases though. -- 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