-
-
Save zane/33a5b77162441ec3a25e to your computer and use it in GitHub Desktop.
This file contains 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 changes | |
([coll] | |
(cons (first coll) | |
(lazy-seq (changes (rest coll) (first coll))))) | |
([coll last] | |
(when-let [next (first coll)] | |
(if (not= last next) | |
(cons next (lazy-seq (changes (rest coll) next))) | |
(lazy-seq (changes (rest coll) last)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment