”…why…”
I could imagine that it is a useful feature in certain situations to avoid "losing the overview" - in the broadest sense of the word. That's probably why - among other things - it's already built into other languages:
karl> (def gizmo (atom[])) #'karl/gizmo karl> (add-watch gizmo :dog (fn [key gizmo old new] (println key old new))) #<Atom@5f5a940a: []> karl> (swap! gizmo conj true) :dog [] [true] [true] karl> (if (seq? (seq @gizmo)) (swap! gizmo pop)) :dog [true] [] [] karl> (if (seq? (seq @gizmo)) (swap! gizmo pop)) nil
«The Crux of the Biscuit is the Apostrophe»
In reply to Re^2: how watch a variable
by karlgoethebier
in thread how watch a variable
by xiaoyafeng
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |