5
什么是最简单的方法来创建一个不同的参考向量?Clojure向量的参考
使用(repeat 5 (ref nil))
将返回一个列表,但他们都将参考同一个参考:
user=> (repeat 5 (ref nil))
(#<[email protected]: nil> #<[email protected]: nil> #<[email protected]: nil> #<[email protected]: nil> #<R
[email protected]: nil>)
同样的结果与(replicate 5 (ref nil))
:
user=> (replicate 5 (ref nil))
(#<[email protected]: nil> #<[email protected]: nil> #<[email protected]: nil> #<[email protected]: nil>
#<[email protected]: nil>)
,然后包裹在(VEC(坐5(反复#(REF为零)))) – 2009-06-24 20:37:40