Closed kdmoreira closed 1 year ago
Thinking this through a bit more since first bringing it up: another possibility is to let it validate an empty sequence. That would align with Clojure's handling of sequences in general e.g. (map f []) ;; => ()
An argument against doing this is that it could lead to false positives.
WDYT?
Thinking this through a bit more since first bringing it up: another possibility is to let it validate an empty sequence. That would align with Clojure's handling of sequences in general e.g.
(map f []) ;; => ()
An argument against doing this is that it could lead to false positives.
WDYT?
Also:
> (every? odd? [])
true
I'd be up for doing a breaking change (4.0.0?) to fix this to be in-line with clojure's behavior
We could also deprecate seq-of
and add an every
matcher to avoid a breaking change.
I kind of liked that we had these *-of
matchers: any-of
, all-of
, and seq-of
.
If we rename seq-of
to every
, should we also rename any-of
and all-of
? If so do you have good name suggestions that consider https://github.com/nubank/matcher-combinators/pull/191#discussion_r1090881179 ?
There is also the downside of shadowing clojure.core
with every
.
Matcher
seq-of
expects a non-empty sequence, but it wasn't clear from the docs.