This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-17
Channels
- # announcements (7)
- # architecture (12)
- # babashka (5)
- # bangalore-clj (4)
- # beginners (70)
- # biff (23)
- # calva (21)
- # clojure (130)
- # clojure-bay-area (3)
- # clojure-berlin (1)
- # clojure-brasil (1)
- # clojure-europe (55)
- # clojure-finland (4)
- # clojure-greece (5)
- # clojure-nl (3)
- # clojure-norway (10)
- # clojurescript (52)
- # code-reviews (4)
- # community-development (1)
- # data-science (7)
- # datahike (6)
- # datomic (1)
- # events (1)
- # figwheel-main (7)
- # fulcro (23)
- # helix (2)
- # honeysql (32)
- # malli (18)
- # membrane (6)
- # nbb (22)
- # nyc (1)
- # off-topic (26)
- # pathom (2)
- # polylith (34)
- # quil (13)
- # releases (1)
- # remote-jobs (4)
- # scittle (1)
- # shadow-cljs (52)
- # sql (24)
- # tools-deps (17)
- # vim (11)
- # web-security (15)
- # xtdb (6)
What's the reason for this seperate comp
implementation in malli and why are the clj and cljs versions different?
(defn -comp
([] identity)
([f] f)
([f g] (fn [x] (f (g x))))
([f g h] (fn [x] (f (g (h x)))))
#?@(:clj [([f1 f2 f3 f4] (fn [x] (-> x f4 f3 f2 f1)))
([f1 f2 f3 f4 f5] (fn [x] (-> x f5 f4 f3 f2 f1)))
([f1 f2 f3 f4 f5 f6] (fn [x] (-> x f6 f5 f4 f3 f2 f1)))
([f1 f2 f3 f4 f5 f6 f7] (fn [x] (-> x f7 f6 f5 f4 f3 f2 f1)))
([f1 f2 f3 f4 f5 f6 f7 f8] (fn [x] (-> x f8 f7 f6 f5 f4 f3 f2 f1)))
([f1 f2 f3 f4 f5 f6 f7 f8 & fs]
(-comp
(apply -comp fs)
(fn [x] (-> x f8 f7 f6 f5 f4 f3 f2 f1))))]
:cljs [([f1 f2 f3 & fs]
(-comp
(apply -comp fs)
(fn [x] (-> x f3 f2 f1))))]))
https://github.com/metosin/malli/blob/a75bffcdf5443323a9e5491e9f8c2cd578b368d6/src/malli/core.cljc#L174