我在Clojure很新。我在Clojure Koans的帮助下学习。我找到了答案与下面的代码:Clojure的功能#(:jerry @%)是什么意思
(= ["Real Jerry" "Bizarro Jerry"]
(do
(dosync
(ref-set the-world {})
(alter the-world assoc :jerry "Real Jerry")
(alter bizarro-world assoc :jerry "Bizarro Jerry")
(vec (map #(:jerry @%) [the-world bizarro-world]))))))
来自:https://github.com/viebel/clojure-koans/blob/master/src/koans/16_refs.clj#L42
这是非常不友好的谷歌搜索,如 “Clojure的@%”。所以我从互联网上得不到什么。
它对函数“#(:jerry @%)”有效吗?
而下面的代码是我的答案,但它不起作用。
(= ["Real Jerry" "Bizarro Jerry"]
(do
(dosync
(ref-set the-world {})
(alter the-world assoc :jerry "Real Jerry")
(alter bizarro-world assoc :jerry "Bizarro Jerry")
(vec (map (fn [x] (:jerry x)) [the-world bizarro-world]))
)))
先生,你真的让我的一天! –
我很高兴能帮到你。 –