Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
;; [1 2 3] -> [1 [2 [3]]]
(defn f [xs]
(if (next xs)
[(first xs) (vec (f (next xs)))]
(vec xs)))
(defn g [v]
(reduce (fn [acc x]
[x acc])
[(peek v)]
(rseq (pop v))))
;; prefer g, of course
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.