unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Timothy Sample <samplet@ngyro.com>
To: Ekaitz Zarraga <ekaitz@elenq.tech>
Cc: 65132@debbugs.gnu.org
Subject: bug#65132: [PATCH] fix cond1 macro
Date: Mon, 07 Aug 2023 14:15:47 -0600	[thread overview]
Message-ID: <87bkfitxqk.fsf@ngyro.com> (raw)
In-Reply-To: <XRbVinGjytujN-sW7mORaEcOmvJZlR33N7DxYBjlJYck4jZXrh628_FFadSjEVkgJTHXGTZeQQgWztCXSQ-nVpo6HdJIcTLS_xV8_lijHiI=@elenq.tech> (Ekaitz Zarraga's message of "Mon, 07 Aug 2023 18:27:05 +0000")

Hi all,

Ekaitz Zarraga <ekaitz@elenq.tech> writes:

> From ab6e4980ea301b5d1e14a98464e5de3e726984f1 Mon Sep 17 00:00:00 2001
> From: Ekaitz Zarraga <ekaitz@elenq.tech>
> Date: Mon, 7 Aug 2023 20:23:42 +0200
> Subject: [PATCH] fix cond1 macro

Just adding some context, as we talked about this on IRC.

If you take the docs example as is,

    (define-syntax cond1
      (syntax-rules (=> else)
        ((cond1 test => fun)
         (let ((exp test))
           (if exp (fun exp) #f)))
        ((cond1 test exp exp* ...)
         (if test (begin exp exp* ...)))
        ((cond1 else exp exp* ...)
         (begin exp exp* ...))))

and invoke it as

    (cond1 else #t)

you get

    Syntax error:
    unknown location: else: bad use of 'else' syntactic keyword in
    subform else of else

This is because ‘else’ matches the ‘(cond1 test exp exp* ...)’ pattern
and gets inserted as the test:

    (if else (begin #t))

This patch puts the more specific ‘else’ pattern before the more general
‘test’ pattern so it has a chance to be matched.


-- Tim





  reply	other threads:[~2023-08-07 20:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-07 18:27 bug#65132: [PATCH] fix cond1 macro Ekaitz Zarraga
2023-08-07 20:15 ` Timothy Sample [this message]
2023-09-29 17:02 ` bug#65132: lloda

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=87bkfitxqk.fsf@ngyro.com \
    --to=samplet@ngyro.com \
    --cc=65132@debbugs.gnu.org \
    --cc=ekaitz@elenq.tech \
    /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).