Re: re-arranging sub-partitions

2010-04-11 Thread ataggart
Or a more generic way: (defn bar [n m coll] (when-let [s (seq coll)] (let [a (take n s) b (take m (drop n s))] (concat b a (bar n m (drop (+ n m) s)) On Apr 11, 4:23 pm, ataggart wrote: > How about: > > (defn foo [coll] >   (apply concat >     (map (fn [[a b c d]] [c d a b]) >  

Re: re-arranging sub-partitions

2010-04-11 Thread ataggart
How about: (defn foo [coll] (apply concat (map (fn [[a b c d]] [c d a b]) (partition 4 coll On Apr 11, 3:25 pm, Glen Rubin wrote: > I am working with a collection of sequences ...(e.g. > coll: > ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6...) (/2 /b /c /4 / > 2 / > 6 /3

re-arranging sub-partitions

2010-04-11 Thread Glen Rubin
I am working with a collection of sequences ...(e.g. coll: ((/f /b /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6...) (/2 /b /c /4 / 2 / 6 /3 /7 /f /4 /3 /2 /4 /5 /7 /3 /6...)...) I want to rearange the sequence into groups of 4 where the later 2 elements are moved to the front for example: (/f /b