On 21 April 2010 17:46, Sean Devlin <francoisdev...@gmail.com> wrote:
> 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.

Right. I don't mind rotate being strict, actually, I'm just playing
around and being silly:

(defn rotate [n s]
  (if-let [remaining (and (not (neg? n))
                          (seq (drop n s)))]
    (lazy-cat remaining
              (take n s))
    (let [c (count s)]
      (take c (drop (mod n c) (cycle s))))))

Seriously though, I'd vote for your original versions to go into c.c.seq.

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

Reply via email to