On 2024-05-22 18:07, Pierpaolo Bernardi wrote:
In chez:

(cond (else (define x 7) x))
7
x
7

which looks like a bug to me. You may check if x is defined outside of
the cond expression in the other implementations which do not raise an
error too?

Sure! And the result varies a lot!

(cond (#t (define x 7) x))
(cond (else (define y 7) y))

| System      | A     | x     | B         | y         |
|-------------|-------|-------|-----------|-----------|
| Bigloo      | 7     | x     | 7         | 7         |
| Biwa        | 7     | 7     | 7         | 7         |
| Chez        | error | error | 7         | 7         |
| Chibi       | error | error | 7         | 7         |
| Chicken     | 7     | 7     | 7         | 7         |
| Cyclone     | 7     | error | 7         | error     |
| Gambit      | error | error | error     | error     |
| Gauche      | 7     | 7     | 7         | 7         |
| Guile       | 7     | error | 7         | error     |
| Kawa        | 7     | error | 7         | 7         |
| LIPS        | 7     | error | error (*) | error (*) |
| Loko        | error | error | error     | error     |
| MIT         | error | error | error     | error     |
| Racket      | 7     | error | 7         | error     |
| Sagittarius | 7     | 7     | 7         | 7         |
| Scheme48    | error | error | 7         | 7         |
| Scheme 9    | error | error | 7         | 7         |
| SCM         | 7     | 7     | 7         | 7         |
| STklos      | 7     | 7     | 7         | 7         |
| Tinyscheme  | 7     | 7     | 7         | 7         |

* LIPS does not recognise the `else` clause when it's the only expression in `cond`.

J.

Reply via email to