From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Damien Mattei Newsgroups: gmane.lisp.guile.user Subject: Re: cond clause does not allow definitions Date: Thu, 23 May 2024 00:09:53 +0200 Message-ID: References: <5d1be852da93dd324fdbcaa24ed1b444@aleph0.info> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12384"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jeronimo Pellegrini , guile-user To: Pierpaolo Bernardi Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Thu May 23 00:10:37 2024 Return-path: Envelope-to: guile-user@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1s9uAP-0002rQ-8a for guile-user@m.gmane-mx.org; Thu, 23 May 2024 00:10:37 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s9uA1-0000x3-BA; Wed, 22 May 2024 18:10:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s9u9x-0000wO-5q for guile-user@gnu.org; Wed, 22 May 2024 18:10:09 -0400 Original-Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s9u9u-0002BG-ID for guile-user@gnu.org; Wed, 22 May 2024 18:10:08 -0400 Original-Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-3c9cf863a58so2987665b6e.2 for ; Wed, 22 May 2024 15:10:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716415805; x=1717020605; darn=gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=PuT9Nn7lBX/ckKxAu+O40VqsYhpg97tvgFQP8v1ewjE=; b=jkzY5HGIiYTOlqkm0UUC1pjhQI421Mpnqv5i4Ux957HN8BEgTJDPn/VOZozAdtTGuS XZjX7EqwlyRP9sYej3s2RSwgES9gWeqMvxSO1pArN7UlTXhk93UCyhzFU22De1y5xUmr /nAgsx+j3lOoFAIeYOQh9eLiZS8/gaJ0dEuaapQ/uPPBQ04ewnmhfm6mHr5GzliynLfl eRPUH46Ta1A99/8fHXTAP17n1sbj+/mEMJuoUdHyhdgDFZgm3WU9rWElFSWMC+SVZ8Ak yF8ES24CalWUMI2fpIBk0//RGKCoFh3ydKorblfGaTDDp928oo7uT+j3N1/rpwFGSao5 Y0Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716415805; x=1717020605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PuT9Nn7lBX/ckKxAu+O40VqsYhpg97tvgFQP8v1ewjE=; b=l7cEeiU2bD3Qz8SbsSeo+Y6oC+Mf2GIs4ysDPGEgU9xrRotQ5U78u6MosT7rh21l8R TKxNoncVvbvjCAkMVtsT5c6ni/1Wz214Mjcduz7e6V+pxko47V+kd7QNC4FsE3ZScUYX vh8KXRUgya9UHwIwB+l9Ny48M/oF5qUETP/HOrUxU3cwckd3CWRrD4/Nlkn0y6VvgHfx 70QRjseFnVJQixne6mqmaEMAjG0dbjptJSJzN3zLAcfxR+dSVcgxb/8FE28K8vKqQn6I APDMDBGl9+AGc35LaWoq5gqR09ck6qgRcZu3gdzwy1veMu45zDL7wNkUvAA0VJJEe4DN ji0w== X-Forwarded-Encrypted: i=1; AJvYcCVTSn6uSMsiRskCk0KXDUi1a5goYvQplAFFpljo8aritBF15K4tBqfZQMbgKlo+InnRqO31MqtIbiFNqaNhH6PiRsE= X-Gm-Message-State: AOJu0YyCqNGIzXj+wXRlyOiulwQ/JRZ/hatVxGRtpbmEjuFORarYlr0h ++mbhRenWkXyvf/Zxs4hR5770OCG+lNiPWvflyQBaQqeJ/uagTZOIzwUV2MDqqlwIT+pTUgGa0G wDNnWy+DFZrsgIeTIjU2zMARSyG8= X-Google-Smtp-Source: AGHT+IHGpHiJ/mENp6UlRvU/5O3VUXlZpQbyUa9SvR/lWBfIbKdkhO2z/W4/05y+a7rqMLSYSvC7beZ10+MzTjZ3DU4= X-Received: by 2002:a05:6808:3a8f:b0:3c9:6cfb:bf4e with SMTP id 5614622812f47-3cdb1712ddbmr3164650b6e.7.1716415805067; Wed, 22 May 2024 15:10:05 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2607:f8b0:4864:20::22e; envelope-from=damien.mattei@gmail.com; helo=mail-oi1-x22e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.user:19680 Archived-At: in the version below it seems that else in cond with definition works alone but not when there is other conditions before: GNU Guile 3.0.8.99-f3ea8 Copyright (C) 1995-2022 Free Software Foundation, Inc. Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'. This program is free software, and you are welcome to redistribute it under certain conditions; type `,show c' for details. Enter `,help' for help. scheme@(guile-user)> (cond (else (define x 7) x)) $1 =3D 7 scheme@(guile-user)> (cond (#f 'never) (else (define x 7) x)) While compiling expression: Syntax error: unknown file:2:24: definition in expression context, where definitions are not allowed, in form (define x 7) i understand that because in my code, that i can not write all here, i had to change: #`(cond (#,test (let () #,@L-then)) (else #,@L-else))) #`(cond (#,test (let () #,@L-then)) (else (let () #,@L-else)))) add a (let () in the else of cond too to encapsulate the possible definitions in #,@L-else now i understand that and it is late here... good night On Wed, May 22, 2024 at 11:08=E2=80=AFPM Pierpaolo Bernardi wrote: > On Wed, May 22, 2024 at 10:08=E2=80=AFPM Jeronimo Pellegrini > wrote: > > > A: (cond (#t (define x 7) x)) > > B: (cond (else (define x 7) x)) > > > > | system | A | B | > > |-------------|-------|-------| > > | Bigloo | 7 | 7 | > > | Biwa | 7 | 7 | > > | Chez | error | 7 | > > | Chibi | error | 7 | > > 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? >