Last active
March 21, 2016 14:09
-
-
Save w33tmaricich/e2a22d55284eaccc80d1 to your computer and use it in GitHub Desktop.
clj: checks if all keys are contained within a map
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 contains-keys? | |
"True if all keys are contained within the map" | |
[maps keywords] | |
(let [map-list maps | |
all-keys keywords] | |
(if (empty? all-keys) | |
true | |
(if (contains? map-list (first all-keys)) | |
(recur map-list (rest all-keys)) | |
false)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment