Created
February 25, 2013 05:36
-
-
Save MarcoPolo/5027976 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn part-by-pattern [predi coll] | |
(reduce | |
(fn [result item] | |
(if (predi (last (last result)) item) | |
(conj (pop result) (conj (last result) item)) | |
(conj result [item]))) | |
[[(first coll)]] | |
(vec (rest coll)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You could knock a line off by making that anonymous function completely unreadable :P %1,%2