-
-
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))) |
Oh wow, no way. Edit: I think partial
version is returning a function that passes the loc in as an arg to apply
.
And yeah sure, I'll send a pull request.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Looks like it!
It'd be awesome if you could send me a pull request. Otherwise, I'll change it tomorrow (it's 2AM here).