malli icon indicating copy to clipboard operation
malli copied to clipboard

Incorrect base case for `-some-pred`

Open frenchy64 opened this issue 3 years ago • 1 comments

This should return false in Clojure. In ClojureScript it returns true.

((-some-pred []) true) ;=> true

I think this line needs to be configurable. https://github.com/metosin/malli/blob/bf92680ad76e57697261dd45c52dd31ffa9a8e1e/src/malli/impl/util.cljc#L59

I believe this is just morally incorrect since :or always has non-empty children (so preds are always non-empty).

frenchy64 avatar Sep 11 '22 19:09 frenchy64

or should it return true also in clojurescript? would be consistent with -every-pred. In clojure, every-fn and some-fn are not defined with zero predicates.

;; clj
((-every-pred []) 1) ; => true
((-some-pred []) 1) ; => true

;; cljs
((-every-pred []) 1) ; => true
((-some-pred []) 1) ; => false

ikitommi avatar Sep 18 '22 17:09 ikitommi