in reply to Re: how watch a variable
in thread how watch a variable
”…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»
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: how watch a variable
by LanX (Saint) on Dec 10, 2023 at 20:27 UTC |