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

Re: [Scheme-reports] r7rs-draft-6: examples for when and unless

Daniel Villeneuve scripsit:

> The examples of when and unless do not provide the "and prints ..." 
> block that normally accompanies examples that invoke write/display.  

True, but what is output is mentioned at the top of the examples.
However, I have pushed a change to trunk to make them look like `begin`.

> Having two expressions in the scope of when/unless and not showing any 
> output does not expose the implicit begin that comes with these 
> "one-sided if" syntaxes.

I don't understand this statement.

> Also, there is a missing closing bracket after 
> (display "2") in both current examples.

Fixed on trunk already.

> What about a joined example for both when and unless, such as:
> (begin
>    (when (= 1 1.0)
>      (display "1 and 1.0 are considered equal")
>      (newline))
> (unless (= 1 1.0)
>      (display "1 and 1.0 are not considered equal")
>      (newline)))
> prints exactly one of
>    1 and 1.0 are considered equal \emph{newline}
> or
>    1 and 1.0 are not considered equal\emph{newline}
> depending on the details of the implementation.
> Of course, that's an artificial example, but it confirms the existence 
> of the implicit begin to the reader.

It's so artificial as to be actually false:  `(= 1 1.0)` always returns
#t (which the current example depends on), whereas `(eqv? 1 1.0)` always
returns #f.

John Cowan <cowan@x>             http://www.ccil.org/~cowan
"Make a case, man; you're full of naked assertions, just like Nietzsche."
"Oh, i suffer from that, too.  But you know, naked assertions or GTFO."
                        --heard on #scheme, sorta

Scheme-reports mailing list