The script is in tools/ rather than thrown away, because two lanes are
writing Flan in the old spelling right now and their files need the same
pass at merge.
It works on forms, not on text: a keyword becomes a dot only where it sits
in a field-label position inside a brace, so an enum member in value
position, a map key inside an EDN string and a type-position {K V} are all
left alone. :keys keeps its colon -- it names no field.
25 lines
674 B
Plaintext
25 lines
674 B
Plaintext
(defstruct AssetMissing [id i32])
|
|
|
|
(defvar cleanups i64)
|
|
|
|
(defn load [n i32] i32
|
|
(signal (AssetMissing {.id n}))
|
|
100)
|
|
|
|
(defn middle [n i32] i32
|
|
(defer (set cleanups (+ cleanups 1))) ; runs on the transfer too
|
|
(+ (load n) 1))
|
|
|
|
(defn fetch [n i32] i32
|
|
(restart-case (middle n) ; its value if nothing transfers
|
|
(use-placeholder [] -1)
|
|
(retry [] 7)))
|
|
|
|
(defn main []
|
|
(print (fetch 1)) (println "") ; 101 — nothing handled it
|
|
|
|
(handler-bind [(AssetMissing [c] (invoke-restart 'use-placeholder))]
|
|
(print (fetch 2)) (println "")) ; -1
|
|
|
|
(print cleanups) (println "")) ; 2 — the defer ran both times
|