On Nov 9, 2:47 pm, Shoeb Bhinderwala shoeb.bhinderw...@gmail.com
wrote:
([a] [a b] [a b c] [a b c d])
It should be pointed out that this result -- while it may be what you
actually want -- is not all subsets of [a b c d]. For that
you might want to use combinatorics/subsets:
user= (C/subsets [a
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 soldier