with-early-exit
macroInspired by call-with-current-continuation
in Scheme.
(macro with-early-exit [[out] body] "Execute BODY, exiting early with `...' on (OUT ...)." `(let [sentinel# {}] (λ ,out [...] (error [sentinel# ...] 2)) (match (pcall #,body) (true result#) result# (false [sentinel# & rest#]) (table.unpack rest#) (false other#) (error other# 2))))