Copying a snippet into HTML is where a documented language stops being the real one. Each block on the page is a program here with its recorded output beside it, and check.sh is what says the page is still true after a change.
17 lines
505 B
Plaintext
17 lines
505 B
Plaintext
(defstruct AssetMissing [id i32])
|
|
|
|
(defvar seen i64)
|
|
|
|
(defn load-all []
|
|
(signal (AssetMissing {:id 1})) ; Unit — the caller carries on
|
|
(signal (AssetMissing {:id 2})))
|
|
|
|
(defn main []
|
|
(load-all) ; no handler: a no-op
|
|
(print-i64 seen) (newline) ; 0
|
|
|
|
;; A handler that returns normally accumulates and lets the signaller run on.
|
|
(handler-bind [(AssetMissing [c] (set seen (+ seen (i64 (.id c)))))]
|
|
(load-all))
|
|
(print-i64 seen) (newline)) ; 3
|