Previous: Boolean Tests, Up: Gathering Clauses

2.3.5 Aggregated Boolean Tests

— Clause: always expr

If expr ever evaluates to nil, then nil is immediately returned; the epilogue code is not executed. If expr never evaluates to nil, the epilogue code is executed and the last value of expr (or t if expr was never evaluated) is returned (whereas loop would constantly return t).

— Clause: never expr

Like (always (not expr)), except it does not influence the last value returned by a possible other always clause. That is,

       (iter (repeat 2)
             (always 2)
             (never nil)) => 2 ; not t

— Clause: thereis expr

If expr is ever non-nil, its value is immediately returned without running epilogue code. Otherwise, the epilogue code is performed and nil is returned.

This clause cannot be used together with always or never, because their defaults are opposed (similarly, (loop always 3 thereis nil) refuses to compile in some implementations of loop).