On 21 April 2010 17:23, Sean Devlin <francoisdev...@gmail.com> wrote: > I've had to code these guys up a few times:
Nice functions! I'd replace "collection" with "sequence" in the docstrings, though. (And rename the args accordingly.) You can also rewrite rotate as (defn rotate [n s] (lazy-cat (drop n s) (take n s))) which has the built-in assumption that n doesn't exceed the length of s, but won't force more than (inc n) elements of s before producing the first item of the result. (Additional forcing might happen due to chunking issues, of course.) As a final remark, I believe that rotate takes constant time to execute, followed by O(n) time to produce the first element. This is petty nitpicking, of course. ;-) Sincerely, Michał -- 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