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 <[email protected]> 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 /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 /c /4 /5 /6 /3 /6 /f /4 /3 /2 /4 /5 /7 /3 /6...) I want to
> transform it as follows:
>
> (/c /4 /f /b /3 /6 /5 /6 /3 /2 /f /4....)
>
> I can break the collection of sequences up into groups of 4 as
> follows:
>
> (map #(partition 4 %) coll)
>
> However I am having problems taking the resulting partitioned sequence
> and further subdividing into groups of 2 before reversing the paired
> groups order.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
To unsubscribe, reply using "remove me" as the subject.