Finished koan 17

This commit is contained in:
Matt Davidson 2022-11-24 20:22:18 +00:00
parent 12a5b7aaec
commit ab7536f8da

View file

@ -5,29 +5,29 @@
(meditations (meditations
"Atoms are like refs" "Atoms are like refs"
(= __ @atomic-clock) (= 0 @atomic-clock)
"You can change at the swap meet" "You can change at the swap meet"
(= __ (do (= 1 (do
(swap! atomic-clock inc) (swap! atomic-clock inc)
@atomic-clock)) @atomic-clock))
"Keep taxes out of this: swapping requires no transaction" "Keep taxes out of this: swapping requires no transaction"
(= 5 (do (= 5 (do
__ (swap! atomic-clock + 4)
@atomic-clock)) @atomic-clock))
"Any number of arguments might happen during a swap" "Any number of arguments might happen during a swap"
(= __ (do (= 20 (do
(swap! atomic-clock + 1 2 3 4 5) (swap! atomic-clock + 1 2 3 4 5)
@atomic-clock)) @atomic-clock))
"Atomic atoms are atomic" "Atomic atoms are atomic"
(= __ (do (= 20 (do
(compare-and-set! atomic-clock 100 :fin) (compare-and-set! atomic-clock 100 :fin)
@atomic-clock)) @atomic-clock))
"When your expectations are aligned with reality, things proceed that way" "When your expectations are aligned with reality, things proceed that way"
(= :fin (do (= :fin (do
(compare-and-set! __ __ __) (compare-and-set! atomic-clock 20 :fin)
@atomic-clock))) @atomic-clock)))