[racket] (if ...) form without an else

From: Joe Gilray (jgilray at gmail.com)
Date: Wed Apr 11 23:51:47 EDT 2012

Hi Lothar,

The if statement in Racket always requires three arguments:

(if<http://docs.racket-lang.org/reference/if.html?q=if&q=mapcar&q=map&q=foldl&q=take&q=append*&q=foldl&q=number-%3E&q=vector&q=for/&q=set#(form._((quote._~23~25kernel)._if))>
 test-expr then-expr else-expr)

if you only want a "then-expression", use "when" or "unless"
if you want more expressions, use "cond",  cond is a powerful and compact
construct in Racket

-Joe

On Wed, Apr 11, 2012 at 11:42 AM, lothar atheling <lothar_ at warpmail.net>wrote:

>
> usually an (if ...) form without an else part does not cause an error.
>
> but sometimes it does, as the following shows:
>
>
> if: bad syntax (must have an "else" expression) in: (if isinitialised
> (expose))
>
> why the different behavior?
>
> --
> http://www.fastmail.fm - A fast, anti-spam email service.
>
> ____________________
>  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/20120411/7fd02e16/attachment-0001.html>

Posted on the users mailing list.