guile-user
[Top][All Lists]
Advanced

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

cond clause does not allow definitions


From: Damien Mattei
Subject: cond clause does not allow definitions
Date: Wed, 22 May 2024 21:26:09 +0200

scheme@(guile-user)> (cond (#t (define x 7) x))
While compiling expression:
Syntax error:
unknown file:7:10: definition in expression context, where definitions are
not allowed, in form (define x 7)

but it is allowed in else clause:
scheme@(guile-user)> (cond (else (define x 7) x))
$4 = 7

not really logic

it is allowed in Kawa and Racket but they are not scheme references
the R5RS and R7RS talk about 'clause' without more information

is it normal for Guile to consider clause for cond to be an expression
context and not a definition context?

should not be better to consider definition context? that would allow more
possibilities.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]