This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-11
Channels
- # announcements (2)
- # asami (10)
- # aws (2)
- # babashka (28)
- # beginners (103)
- # calva (2)
- # clj-kondo (10)
- # clojure (69)
- # clojure-austin (11)
- # clojure-europe (48)
- # clojure-nl (10)
- # clojure-switzerland (1)
- # clojure-uk (2)
- # clojurescript (6)
- # conjure (2)
- # consulting (1)
- # core-async (2)
- # core-typed (2)
- # cursive (5)
- # datomic (15)
- # jobs (1)
- # malli (4)
- # meander (7)
- # membrane (26)
- # missionary (6)
- # nbb (39)
- # reagent (3)
- # releases (1)
- # ring (3)
- # shadow-cljs (28)
- # spacemacs (2)
- # sql (6)
- # vim (5)
What's the restriction that stop me from using #js
in front of mapv
(mapv (fn [x] #js {:i (str x) :x x :y 0 :w 2 :h 2}) (range 2))
;; => [#js {:i "0", :x 0, :y 0, :w 2, :h 2} #js {:i "1", :x 1, :y 0, :w 2, :h 2}]
while:
(js/console.log #js (mapv (fn [x] #js {:i (str x) :x x :y 0 :w 2 :h 2}) (range 2)))
not working
(js/console.log (clj->js (mapv (fn [x] #js {:i (str x) :x x :y 0 :w 2 :h 2}) (range 2))))
this working
Is it because #js
can only apply to pure data? like #js []
, #js {}
#js
is a reader literal. so it converts the datastructure following it into the respective JS equivalent
1