Major Section: ACL2-BUILT-INS
Example: (er-progn (check-good-foo-p (f-get-global 'my-foo state) state) (value (* (f-get-global 'my-foo state) (f-get-global 'bar state))))
This sequencing primitive is only useful when programming with state, something that very few users will probably want to do. See state.
Er-progn
is used much the way that progn
is used in Common Lisp,
except that it expects each form within it to evaluate to an ``error triple''
of the form (mv erp val state)
; see error-triples. The first such form,
if any, that evaluates to such a triple where erp
is not nil
yields
the error triple returned by the er-progn
. If there is no such form,
then the last form returns the value of the er-progn
form.
General Form: (er-progn <expr1> ... <exprk>)where each
<expri>
is an expression that evaluates to an error triple
(see programming-with-state). The above form is essentially equivalent to
the following (``essentially'' because in fact, care is taken to avoid
variable capture).
(mv-let (erp val state) <expr1> (cond (erp (mv erp val state)) (t (mv-let (erp val state) <expr2> (cond (erp (mv erp val state)) (t ... (mv-let (erp val state) <expr{k-1}> (cond (erp (mv erp val state)) (t <exprk>)))))))))