core: move juxt/every-pred/some-fn to Clojure

Three pure function combinators into the collection tier, as compositions of
mapv/every?/some/apply. Three more core-* primitives + table entries gone.
Battery 3916 -> 3920 (the canonical defs are more correct than the prior Janet
ones — some-fn returns the matching value, every-pred is properly boolean).
Conformance 218/218 all modes.
This commit is contained in:
Yogthos 2026-06-06 18:09:42 -04:00
parent 57b8ffcb9b
commit 3638521e2d
3 changed files with 17 additions and 21 deletions

View file

@ -51,3 +51,13 @@
(let [w (first more) kw (k w)]
(if (<= kw kv) (recur w kw (next more)) (recur v kv (next more))))
v)))))
;; Function combinators (pure HOFs).
(defn juxt [& fs]
(fn [& args] (mapv (fn [f] (apply f args)) fs)))
(defn every-pred [& preds]
(fn [& xs] (every? (fn [p] (every? p xs)) preds)))
(defn some-fn [& preds]
(fn [& xs] (some (fn [p] (some p xs)) preds)))