Closed jarohen closed 10 years ago
Just spotted these aren't based on master - will re-base
Just spotted the Travis build - will put my tests in the test suite as well
(cc @lsnape)
The any
and all
macros replicate functionality already available in Clojure. Unless I've misread the code, the some-fn
and every-pred
functions in clojure.core should provide the same functionality, with the advantage that they're functions, rather than macros.
I can see why the ->%
and ->>%
macros might be useful, but I'd rather limit Medley to pure functions.
Other than that, I'm glad you're finding Medley useful!
Thanks for pointing me in the direction of every-pred
and some-fn
- thought I knew core reasonably well but haven't ever come across those. Also, no worries about the arrows, that's fair enough!
Cheers,
James
Hi James,
Here's a few additions to Medley that I find myself either wishing for on a regular basis, or duplicating in a number of projects!
all
andany
are two macros that take in a list of predicates and return another predicate that returns true if all/any of the passed predicates return true - useful for passing tofilter
/remove
.->%
and->>%
are maybe a bit more obscure - they're mostly to get around the restriction that you can't nest anonymous functions (of the#(...)
variety) - e.g. :and
I'm happy to change anything about the PR - names/docstrings/implementations - feedback welcome! Also, if you don't feel they belong in Medley, let me know and I'll release them separately.
Thanks for writing and maintaining Medley btw - we use it in a lot of projects at Likely, especially the
map-keys
andmap-vals
functions (which seem to turn up in almost every other namespace!).Hope you're keeping well,
James