Hi
On 28 August 2010 02:25, neveu wrote:
> I implemented the "Flavius Josephus" algorithm from Programming Praxis
> in Clojure using loop/recur. My first version looked like this:
>
> (defn rotate-left
> ([ln n m]
> (take n (drop (dec m) (cycle ln
> ([ln m] (rotate-left ln (count ln) m)
I implemented the "Flavius Josephus" algorithm from Programming Praxis
in Clojure using loop/recur. My first version looked like this:
(defn rotate-left
([ln n m]
(take n (drop (dec m) (cycle ln
([ln m] (rotate-left ln (count ln) m)))
(defn josephus3 [N M] ;; execute every mth soldie