我偶然发现了这个问题
Clojure
(get {:x (reduced 10)} :x)
=> #object[clojure.lang.Reduced 0x28494b99 {:status :ready, :val 10}]
(get-in {:x (reduced 10)} [:x])
=> #object[clojure.lang.Reduced 0x28494b99 {:status :ready, :val 10}]
Clojurescript
(get {:x (reduced 10)} :x)
=> #object[cljs.core.Reduced]
; 与Clojure相同的行为
(get-in {:x (reduced 10)} [:x])
=> 10
因此,get-in
在Clojurescript中似乎自动调用 deref
来处理 reduced
值吗?