Skip to content

Instantly share code, notes, and snippets.

@danneu

danneu/laser.clj Secret

Created March 24, 2013 08:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danneu/d2177a9ca4be8d1190be to your computer and use it in GitHub Desktop.
Save danneu/d2177a9ca4be8d1190be to your computer and use it in GitHub Desktop.
(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)))
@danneu
Copy link
Author

danneu commented Mar 24, 2013

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