On 21 April 2010 19:57, Sean Devlin <francoisdev...@gmail.com> wrote:
> If you're gonna over engineer use a protocol :-p

You're absolutely right, of course; I stand corrected! Here's my new
attempt at overengineering then:

(defprotocol Rotator
  (rotate [self s]))

(extend-protocol Rotator
  Number
  (rotate
   [self s]
   (let [[front back] (split-at (mod self (count s)) s)]
     (concat back front)))
  clojure.lang.IFn
  (rotate
   [self s]
   (let [[front back] (split-with self s)]
     (concat back front))))

Funnily enough, I actually find this vaguely reasonable. :-)

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