Skip to content

Instantly share code, notes, and snippets.

@zane
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zane/33a5b77162441ec3a25e to your computer and use it in GitHub Desktop.
Save zane/33a5b77162441ec3a25e to your computer and use it in GitHub Desktop.
(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