[racket] Cond function with test-expr = then-body works but is it wise?
Would
(cond
[testing => values]
...)
work for you? That returns the value of the testing expression w/o evaluating it twice.
On May 24, 2013, at 12:08 PM, Don Green wrote:
> It is possible to create a cond test-expr that also serves as the then-body, however, this means that the expression would be executed twice.
> This seems to be ill advised in principle.
>
> Question: If it is ill-advised to create a cond test-expression that also serves as the then body, then what function is recommend?
>
> I am aware of the (cdr (or ... form.
> I am aware of the cond ... test-expr => proc-expr] form option.
> Thanks
> Don Green
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130524/a461f256/attachment.html>