[plt-scheme] minor WHEN and UNLESS question

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Jul 5 16:42:21 EDT 2008

Like all Scheme conditionals, when/unless return the value of their  
sub-expressions if the condition is true. Otherwise, they produce  
false. The docs are wrong.

Thanks for reporting the problem. For future discoveries of mistakes,  
please use Help Desk to report them. -- Matthias



On Jul 5, 2008, at 4:19 PM, Yavuz Arkun wrote:

> This is a rather minor issue I noticed in the documentation:
>
> According to http://docs.plt-scheme.org/reference/when_unless.html,
> the results of evaluating WHEN and UNLESS are ignored. According to
> http://docs.plt-scheme.org/reference/when_unless.html, the result is
> #<void> (which is of course ignored by the REPL). Evaluating the
> following expression in module language
> shows that actually the result of the last expression in the body is
> available at least in some cases; didn't test extensively.
>
>> (+ 1 (when #t (+ 1 2) (+ 3 4)))
> 8
>
>> (+ 1 (unless #f (+ 1 2) (+ 3 4)))
> 8
>
> So the question is...which version is the correct one? Ignored,
> #<void>, value of the last expression in the body?
> --Yavuz
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.