Michael Sperber wrote:
> >>>>> "Andreas" == Andreas Bernauer <andreas.bernauer@gmx.de> writes:
>
> Andreas> R5RS says (4.2.4):
>
> Andreas> If <test> evaluates to a true value, then ... . If no <expression>s
> Andreas> are present, then the value of the `do' expression is unspecified.
>
> Andreas> So I expected the unspecified value when there is no
> Andreas> expression.
>
> You misunderstand R5RS.
>
> When R5RS says some value is unspecified, it means that the Scheme
> system can choose whatever value it wants as that value.
Oh, really? Well, it makes sense and I admit that I really
misunderstood R5RS. I thought that it is a "feature" of Scheme that
the functions `if', `set!', etc. return a special
"unspecific/unspecified" value (as opposed to other values like
numbers, strings, etc.).
So, if I understand you correctly, I should rather never leave the
alternate clause of an if empty (not that I usually do that), if
that's the last statement of a form, right? Like
(define (try-to-find-it thing)
(let ((found (try-to-find-help thing '())))
(if found
found)))
(a rather silly example, I know). A Scheme implementation might
decide to return as value of the `if' the empty list or the symbol
'unspecific or some other arbitrary value try-to-find-help might
return also.
I'll keep that in mind. Thanks a lot for the clarification.
Andreas.
pgpIcNNAy5PCw.pgp
Description: PGP signature
|