If you're gonna over engineer use a protocol :-p On Apr 21, 1:43 pm, Michał Marczyk <michal.marc...@gmail.com> wrote: > On 21 April 2010 19:35, Sean Devlin <francoisdev...@gmail.com> 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 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