(examples-for ensure

("always gets called on the way out"
 (let x 10
   (ensure (assign x (+ x 11))
           (assign x (+ x 22)))
   x)
 43))

(examples-for on-err

("'handles errors"
 (let x nil
   (on-err (= x "impossible")
           (= x (nil nil nil)))
   x)
 "impossible")

("handles nested errors"
  (on-err (joinstr "\n" errors)
          (on-err (error "foo")
                  (on-err (error "bar")
                          (on-err (error "toto")
                                  (error "primum errorum")))))
  "foo

bar toto primum errorum“)

("handles errors but any ensuring clause gets called first"
 (with (x nil y nil)
       (on-err (= x 'impossible)
               (ensure (assign y 'ensure-clause)
                       (nil nil nil)))
       (list x y))
 (impossible ensure-clause)))