Re: [Scheme-reports] ANN: first draft of R7RS small language available Andrzej (03 May 2011 06:17 UTC)

Re: [Scheme-reports] ANN: first draft of R7RS small language available Andrzej 03 May 2011 06:17 UTC

Alex Shinn wrote:
> The implications for this are that while
>
>   (let ((else #f))
>     (cond (else (display "else clause matched"))))
>
> is required to not display anything as in R5RS,

I'm probably missing something obvious but can you please explain why
R5RS implementation should behave like this? To me it looks like such
behavior violates the specification:

| The last <clause> may be an ``else clause,'' which has the form
|
| (else <expression1> <expression2> ...).
|
[...]
| If all <test>s evaluate to false values, and there is no else
| clause, then the result of the conditional expression is
| unspecified; if there is an else clause, then its
| <expression>s are evaluated, and the value(s) of the
| last one is(are) returned.

Note that R5RS doesn't say anything about the value 'else' evaluates
to, only about its presence. Which makes sense, as if 'else' was to be
evaluated, the report wouldn't have to mention it at all, or it would
simply require '(define else #t)' somewhere in the library.

In my implementation I've implemented 'cond' so that it recognizes
'else' by looking at the name of the symbol. If I have to fix it I'd
like to know what the correct version is, why it is correct and why my
implementation is wrong.

Andrzej

_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports