unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* cond clause does not allow definitions
@ 2024-05-22 19:26 Damien Mattei
  2024-05-22 20:07 ` Jeronimo Pellegrini
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Damien Mattei @ 2024-05-22 19:26 UTC (permalink / raw)
  To: guile-user

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.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-05-24 14:27 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-22 19:26 cond clause does not allow definitions Damien Mattei
2024-05-22 20:07 ` Jeronimo Pellegrini
2024-05-22 20:33   ` Damien Mattei
2024-05-22 20:34     ` Damien Mattei
2024-05-22 20:37     ` lloda
2024-05-22 20:40       ` lloda
2024-05-22 21:07   ` Pierpaolo Bernardi
2024-05-22 22:09     ` Damien Mattei
2024-05-22 22:37     ` Jeronimo Pellegrini
2024-05-23 14:25       ` Damien Mattei
2024-05-23 14:59         ` Pierpaolo Bernardi
2024-05-22 22:12 ` Maxime Devos
2024-05-22 22:34   ` Damien Mattei
2024-05-24 14:27 ` Linus Björnstam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).