unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: guile-user <guile-user@gnu.org>
Subject: cond clause does not allow definitions
Date: Wed, 22 May 2024 21:26:09 +0200	[thread overview]
Message-ID: <CADEOaddz=+Teyh2U98TOMjH4_N7K7UjBiNYj5=Jr0=KPbOrsVw@mail.gmail.com> (raw)

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	other threads:[~2024-05-22 19:26 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 19:26 Damien Mattei [this message]
2024-05-22 20:07 ` cond clause does not allow definitions 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CADEOaddz=+Teyh2U98TOMjH4_N7K7UjBiNYj5=Jr0=KPbOrsVw@mail.gmail.com' \
    --to=damien.mattei@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).