Skip to content

Instantly share code, notes, and snippets.

Created July 23, 2014 04:29
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 anonymous/398e6732cae347d49339 to your computer and use it in GitHub Desktop.
Save anonymous/398e6732cae347d49339 to your computer and use it in GitHub Desktop.
(defn remove-first [e [x & rest]]
(lazy-seq
(cond (nil? rest) [x]
(= x e) rest
:def (cons x (remove-first e rest))
)))
(remove-first 3 [1 2 3 4 3 5]) ;=> (1 2 4 3 5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment