Skip to content

Instantly share code, notes, and snippets.

@aymanosman
Last active November 26, 2018 23:32
Show Gist options
  • Save aymanosman/a867681564cbecb40e6c252f1c7ea65c to your computer and use it in GitHub Desktop.
Save aymanosman/a867681564cbecb40e6c252f1c7ea65c to your computer and use it in GitHub Desktop.
4clojure-30.clj
(defn f
([xs] (if (empty? xs) () (f (first xs) (rest xs))))
([x xs]
(cond
(empty? xs) (list x)
:else
(let [y (first xs)]
(cond
(= x y)
(f x (rest xs))
:else
(cons x (f y (rest xs))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment