Ant*_*ald 12 clojure clojurescript
在reduce循环中考虑这个:
(if (contains? m k)
(update m k conj v)
(assoc m k [v]))
Run Code Online (Sandbox Code Playgroud)
有没有办法摆脱if语句?
Dan*_*ton 19
使用fnil
处理的零值v
时,k
在地图上不存在:
(update m k (fnil conj []) v)
Run Code Online (Sandbox Code Playgroud)