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: macro syntax-error works in prefix but not curly-infix Date: Mon, 20 Sep 2021 11:16:05 +0200 Message-ID: References: <44267709-9cc3-5185-86b7-02adc7a17d1e@posteo.de> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19598"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Guile User To: Zelphir Kaltstahl Original-X-From: guile-user-bounces+guile-user=m.gmane-mx.org@gnu.org Mon Sep 20 11:16:45 2021 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 1mSFPp-0004uw-Eu for guile-user@m.gmane-mx.org; Mon, 20 Sep 2021 11:16:45 +0200 Original-Received: from localhost ([::1]:56692 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mSFPn-00067m-I3 for guile-user@m.gmane-mx.org; Mon, 20 Sep 2021 05:16:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mSFPQ-00067N-4t for guile-user@gnu.org; Mon, 20 Sep 2021 05:16:20 -0400 Original-Received: from mail-io1-xd2b.google.com ([2607:f8b0:4864:20::d2b]:45657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mSFPO-0000wz-5g for guile-user@gnu.org; Mon, 20 Sep 2021 05:16:19 -0400 Original-Received: by mail-io1-xd2b.google.com with SMTP id a22so21099721iok.12 for ; Mon, 20 Sep 2021 02:16:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HAhUEF7d8+iH7oyOWG6bffGOqTF4G3xXGgfzjDvBt5k=; b=UEcqTy89a7XJSRX3Wzlk7Y/jigKi4xyomv+92O/ojMxu+O2B4woFUQyyajymUwkSEv Moy19mmiR8+UZtAv2P0jl0nFYl1tHM1/waqNCyTvpRY9o7XuJL7v8KfIYxgggm8cqQpP luPcNgIagGspTCrr4NWpHSuCkgOdSbzHGZHnNxQd3RpiyHv9k9QeWP+2+s5gJ+UXfu3Q G3ol9fGvMpHX7ul3u+58tgA32tR+rEL1XL6eumIR04oqxYxezQ/DWflTH72iHX/xO9qp rjFgWxYbRZEsEIifTBL7fg90mfmbh/yH3DoaVsmhpw8q92RH08B60h0BTlko34kSvp7p aAmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HAhUEF7d8+iH7oyOWG6bffGOqTF4G3xXGgfzjDvBt5k=; b=7Olm/+Bj/t+EomtdtT/Krk1hnjd4c8Ft5uB/j7j2GqOU6k6kIPkJ4GCEFX0SiGcZck NVWspAs2SeTVRjoEDwNrJFNqhXWAP8Fjhv6gkj+l2RSAQrgfmrYiHB/YmEnJZaPiXpbw iA6GAdCUtaLOurHeDk+NWEhoVzG3LBKah8o/pxS3BgA30r0BfDcngOtT+J1I3jJjvMYj Lq3cXlwsqkp1qrVPRJgzBvnKPc3JvBKCYiwvcuNjYfiujsuL8PNNjihcKm0K9b38h0p1 cIL5ShkoNFVihM0tKdAVMRX1ZK5F3rem3EGkLXM+8Wtph0Xx+p3kBocXM/Phds7HG83F iZ3Q== X-Gm-Message-State: AOAM533Qsf95Tlgxn2uJ6eCB8Q2ab7oNj/JGLPYMxIfVL69sNg93RcqC 7Cdpzo0X3bpf/JNC6PXiw+DsIi0pOmzcHKcN+8o= X-Google-Smtp-Source: ABdhPJzkGQvLoQFbXI7i0l8PVhyZmJdws5IgSxl9gKiGp1NQO0uGYDNbdZfDNUDokLRz3GvCMLeUpGFcLmyRgY2VrOs= X-Received: by 2002:a5e:c603:: with SMTP id f3mr14481438iok.14.1632129376551; Mon, 20 Sep 2021 02:16:16 -0700 (PDT) In-Reply-To: <44267709-9cc3-5185-86b7-02adc7a17d1e@posteo.de> Received-SPF: pass client-ip=2607:f8b0:4864:20::d2b; envelope-from=damien.mattei@gmail.com; helo=mail-io1-xd2b.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.23 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.lisp.guile.user:17766 Archived-At: hello Zelphir, i understood my error, all was ok is just that it convert this way: '{x <+ 2 3} ($nfx$ x <+ 2 3) in general the prefix notation of {1 <+ 2 3 4 ...} is not (<+ 1 2 3 4 ...) because (<+ 1 2 3 4 ...) in infix is {1 <+ 2 <+ 3 <+ 4 <+ ...} it a stupid error of mine i will drop the error case in macro and let Scheme deal with the error itself ,he do it fine... we message like that: Syntax error: unknown location: source expression failed to match any pattern in form <+ i find the error because thinking to ellipsis make me thiink to multiple expressions in my <+ operator,anyway you help me, thank you <+ is just in this case a define: scheme@(guile-user)> {x <+ 7} scheme@(guile-user)> x 7 he must be an unary operator , it does not allow multiple arity, but that could be an idea like in C or as far as i remember one can writ x=y=7, anyway in scheme it would be harder because SRFI 105 does not deal with precedence... well i will do that in the future and such writing as x=y=7 is not often used.... thank you damien On Sun, Sep 19, 2021 at 2:34 PM Zelphir Kaltstahl < zelphirkaltstahl@posteo.de> wrote: > Hi Damien! > > I think there might be too few expressions matched in the first case: (_ > var expr). Wouldn't it have to be: > > ~~~~ > (_ var expr1 expr2) > ;; or > (_ var exprs ...) > ~~~~ > > for > > ~~~~ > (<+ var expr1 expr2) > ~~~~ > > to work, simply because of the number of expressions there? > > But then you might need to use ellipsis in the resulting syntax somewhere, > otherwise you get: > > ~~~~ > syntax: missing ellipsis in form (syntax (define var expr)) > ~~~~ > > I don't know where that would go, but I also do not understand yet the > goal. I think it is best to always describe, what you want to achieve, when > you write a macro. > > Regards, > Zelphir > On 9/4/21 4:41 PM, Damien Mattei wrote: > > hi, > > i have this macro: > > (define-syntax <+ > (syntax-rules () > ((_ var expr) (define var expr)) > ((_ err ...) (syntax-error "Bad <- form")) ;; does not work in infix ! > )) > > why my syntax-error pattern never reach in infix: > > scheme@(guile-user)> {x <+ 7 8} > While compiling expression: > Syntax error: > unknown file:3:3: source expression failed to match any pattern in form <+ > > but ok in prefix: > > scheme@(guile-user)> (<+ x 9 10) > While compiling expression: > Syntax error: > unknown location: <+: Bad <- form in form (<+ x 9 10) > > why? > Regards, > Damien > > -- > repositories: https://notabug.org/ZelphirKaltstahl > >