Re: All subsets of a vector

2011-11-11 Thread neveu
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

loop/recur stack overflow

2010-08-28 Thread neveu
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