[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Scheme-reports] ANN: first draft of R7RS small language available

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.


Scheme-reports mailing list