Hmmm... good point. Now that I think about it, cycle is an artifact of an early implementation.
On Apr 21, 1:01 pm, Mark Engelberg <mark.engelb...@gmail.com> wrote: > On Wed, Apr 21, 2010 at 8:46 AM, Sean Devlin <francoisdev...@gmail.com> wrote: > > You're right about changing the docstring to read ""sequence" > > > I think the lazy-cat version looses the ability to rotate in reverse, > > which I've come to love from Ruby. Also, I have found use cases where > > I want to rotate a period longer than the sequence length. > > > Thanks for the feedback, though. > > Sean > > The use of concatenation as opposed to cycle does not affect the > ability to rotate in reverse or more than the sequence length provided > you use mod to get the number in range first: > > (defn rotate [n s] > (let [shift (mod n (count s))] > (concat (drop shift s) > (take shift s)))) > > [could use lazy-cat instead of concat, but I doubt it's worthwhile here] > > -- > 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 > athttp://groups.google.com/group/clojure?hl=en -- 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