[r6rs-discuss] [Formal] Remove the (r6rs when-unless) library
On Tue, 13 Mar 2007, John Cowan wrote:
> AndrevanTonder scripsit:
>
>> I do not personally like one-armed IF, but let me point out that AND/OR
>> can also be used instead of WHEN/UNLESS.
>
> "when" and "unless", however, nicely discard all values except the value
> of the guard, which is not true of "and" or "or". (when p a b) evaluates
> b iff it evaluates a, regardless of the value of a; not so for (or p a b).
Well, I would write
(and p (begin a b))
which is a little longer. However, the following common case is shorter with
AND
(and p1 p2 p3 a)
(when (and p1 p2 p3) a)
Also, in the following cases OR is shorter
(or p a)
(unless p a)
(or p1 p2 p3 a)
(unless (or p1 p2 p3) a)
Andre
Received on Tue Mar 13 2007 - 13:58:10 UTC
This archive was generated by hypermail 2.3.0
: Wed Oct 23 2024 - 09:15:01 UTC