我偶然发现了这个
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
值吗?