Orelse
Evaluate an event and, if it fails, then evaluate a second event
NOTE: Also see orelse* for a similar utility that allows any
number of events.
General Form:
(orelse form1 form2
:quiet q ; default nil
:no-error n ; default nil
:expansion?p e ; default t
where form1 and form2 are events (see embedded-event-form) and the keywords have the indicated defaults. The
behavior is as follows: form1 is submitted and if that succeeds —
that is, if the result is an error-triple (mv nil val state)
— then the orelse call returns that error-triple. Otherwise, it
return the result of evaluating form2, except that if that evaluation
also fails and if :no-error is non-nil, then evaluation concludes by
submitting the event (value-triple :failed).
If :quiet has a non-nil value, then output is suppressed using
with-output with argument :stack :push, so that form1 and
form2 may recover the original output environment using with-output
with argument :stack :pop.
The sizes of certificate files may be reduced with :expansion?p
t (the default). That argument avoids storing a make-event
expansion for (orelse form1 form2 ...) when evaluation of the first event
form succeeds.
See community book kestrel/utilities/orelse.lisp for a utility, encapsulate-report-errors, that employs orelse.