1
我想改变对象的状态andre和blastoise,向对象添加一个新的属性(属性/状态)...我想添加的这个新属性的名称是“tax ”。我tryed下面的代码,但没有工作了...帮助我PLZ:更改结构对象状态
(def andre {:owner "Andre" :type "car" :cur-speed 101 :license-plate "ABC"})
(def blastoise {:owner "Blastoise" :type "truck" :cur-speed 120 :license-plate "XYZ"})
(def car-tax[andre blastoise])
(defn calculate-car-tax [v]
(for [element v]
(if (> (element :cur-speed) 100) (dosync (alter element tax :20)))
)
)
(计算-车板含税车板含税)
非常感谢! – andre
@andre没有问题:) – edwardsmatt