Skip to content

Instantly share code, notes, and snippets.

@kotarak
Last active August 29, 2015 14:12
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 kotarak/3400ddc79cf5449c6266 to your computer and use it in GitHub Desktop.
Save kotarak/3400ddc79cf5449c6266 to your computer and use it in GitHub Desktop.
rest returns seqables
(defn repeat-x
[x]
(reify clojure.lang.Seqable
(seq [this]
(reify clojure.lang.ISeq
(first [this] x)
(next [this] (seq (repeat-x x)))
(more [this] (next this))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment