(ns clojure.examples.example
(:gen-class))
(defn Example []
(def counter (ref 0))
(defn change [counter]
(dosync
(commute counter inc)))
(change counter)
(println @counter)
(change counter)
(println @counter))
(Example)
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265725.html