Last active
November 26, 2018 23:32
-
-
Save aymanosman/a867681564cbecb40e6c252f1c7ea65c to your computer and use it in GitHub Desktop.
4clojure-30.clj
This file contains hidden or 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 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