From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Vivien Kraus Newsgroups: gmane.lisp.guile.user Subject: Re: Control the order of expansion of syntax-case macros Date: Fri, 20 Dec 2024 18:01:16 +0100 Message-ID: <921392f0731f858b29f65b8a011693a810b96551.camel@planete-kraus.eu> References: <1bfa042ed3719a10006789205e954bb53c83cf45.camel@planete-kraus.eu> <20241220101531.qxFW2D00E2kJuzj01xFXPe@xavier.telenet-ops.be> 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="8487"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.48.4 To: Maxime Devos , Guile User Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Fri Dec 20 18:01:57 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 1tOgNx-0001yZ-Ja for guile-user@m.gmane-mx.org; Fri, 20 Dec 2024 18:01:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOgNZ-0001Fd-5G; Fri, 20 Dec 2024 12:01:33 -0500 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 1tOgNW-0001Dn-IN for guile-user@gnu.org; Fri, 20 Dec 2024 12:01:30 -0500 Original-Received: from planete-kraus.eu ([2a00:5881:4008:2810::309]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1tOgNU-0003Qw-B5 for guile-user@gnu.org; Fri, 20 Dec 2024 12:01:30 -0500 Original-Received: from planete-kraus.eu (localhost.lan [127.0.0.1]) by planete-kraus.eu (OpenSMTPD) with ESMTP id 83353dcc; Fri, 20 Dec 2024 17:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=planete-kraus.eu; h= message-id:subject:from:to:date:in-reply-to:references :content-type:content-transfer-encoding:mime-version; s= albinoniB; bh=PRzuD368bAbtpl5NAI+kltj/EWE=; b=FtbEZN4F+6rvHcglTR ygzcNJIak9/Hs8RJ39ivBVIPmbZGIlVSMxh4WPsgSNMz2V9xeNmgzmgFPD3AOkKd pq87dXwSM2NHhY+FZtqO3eLl5wAQo/yFLqhwg9xB/mLTQ6WhqfdiCXcL59FA5Ohr lf2HzIFGtHpJITbMgRxonvonc+mbzRQcxXhu/OqVd7vfpE8CWooiLDOv5DLNamyd cms2TPxQabpqRPDDJ5ieZL/a9lDjVTvNPcreKFSNiA8WNGdGYFkCIOUYUI2JJzoK fznjfxty8q1SoMV0CikTkD/sggmeJCS76D0bJQzeoHYJn+maNLpOJ4Xcut9W1RiE CgIg== Original-Received: by planete-kraus.eu (OpenSMTPD) with ESMTPSA id 9efb98bb (TLSv1.3:TLS_CHACHA20_POLY1305_SHA256:256:NO); Fri, 20 Dec 2024 17:01:18 +0000 (UTC) In-Reply-To: <20241220101531.qxFW2D00E2kJuzj01xFXPe@xavier.telenet-ops.be> Received-SPF: pass client-ip=2a00:5881:4008:2810::309; envelope-from=vivien@planete-kraus.eu; helo=planete-kraus.eu 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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:20018 Archived-At: Hello! Le vendredi 20 d=C3=A9cembre 2024 =C3=A0 10:15 +0100, Maxime Devos a =C3=A9= crit=C2=A0: > (define-syntax hello > =C2=A0 (lambda (stx) > =C2=A0=C2=A0=C2=A0 (syntax-case stx () > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (_ > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (begin > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (format (current-error-p= ort) "Hello!\n") > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (datum->syntax #f "hello= ")))))) > =C2=A0 > You can simplify this to: > =C2=A0 > (define-syntax hello > =C2=A0 (lambda (stx) > =C2=A0=C2=A0=C2=A0=C2=A0 (format (current-error-port) "Hello!\n") > =C2=A0=C2=A0=C2=A0=C2=A0 (datum->syntax #f "hello"))) This was an eye-opening moment for me: syntax-case is its own thing and I don=E2=80=99t need the full define-syntax / lambda / syntax-case combo. > I wonder, did you copy-paste all four blocks (both the define-syntax > forms and the ,expand) at the same time, or one-by-one? Oops, I was evaluating everything at once, so I did not notice the format took place at definition time. > Another option is to just let =E2=80=98hello=E2=80=99 and =E2=80=98world= =E2=80=99 be procedure (that > happen to accept syntax and produce syntax) I=E2=80=99ll have to examine my new options now that I can think outside th= e define-syntax / lambda / syntax-case box. Anyway, thank you again for your help. Best regards, Vivien