On 21 April 2010 19:35, Sean Devlin <[email protected]> wrote:
> I like that version :)
:-)
In this case, rotate-while could be rewritten like so:
(defn rotate-with [pred s]
(let [[front back] (split-with pred s)]
(concat back front)))
And to round it off with ridiculous overengineering ;-) --
(defn rotate* [n-or-pred s]
(let [with? (ifn? n-or-pred)
[front back] ((if with?
split-with
split-at)
(if with?
n-or-pred
(mod n-or-pred (count s)))
s)]
(concat back front)))
Sincerely,
Michał
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en