-
-
Save amalloy/1025420 to your computer and use it in GitHub Desktop.
Keywords as function parameters in clojure?
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 my-exists1? [lst obj & {:keys [testfn] :or {testfn =}}] | |
(loop [lst lst, obj obj] | |
(when lst | |
(if (testfn (first lst) obj) | |
lst | |
(recur (next lst) obj))))) | |
(my-exists1? '((1 2) (3 4) (5 6)) 3 :testfn #(= (first %1) %2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment