-
-
Save danneu/d2177a9ca4be8d1190be to your computer and use it in GitHub Desktop.
This file contains 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 and | |
"Like and, but for selectors. Returns true iff all selectors match." | |
[& selectors] | |
(fn [loc] (every? identity (map #(% loc) selectors)))) | |
(defn and2 | |
"Like and, but for selectors. Returns true iff all selectors match." | |
[& selectors] | |
(fn [loc] ((apply every-pred selectors) loc))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Oh wow, no way. Edit: I think
partial
version is returning a function that passes the loc in as an arg toapply
.And yeah sure, I'll send a pull request.