public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Damien Mattei <damien.mattei@gmail.com>
To: kawa mailing list <kawa@sourceware.org>
Subject: macro error: ... follows template with no suitably-nested pattern variable
Date: Sat, 7 Oct 2023 00:01:10 +0200	[thread overview]
Message-ID: <CADEOaddzfLEG7YL+c2B_=Znh3s5_MaphZLkfDMr60tWHFfn8HQ@mail.gmail.com> (raw)

hello,

this macro seems not valid for kawa but is right with Racket and Guile:



(define-syntax <+
  (syntax-rules ()

    ((_ (var1 ...) expr) (begin
               (define-values (var1 ...) expr)
               (values var1 ...)))
    ;; (begin
    ;;   (define var1 '())
    ;;   ...
    ;;   ;;(display "<+ multiple") (newline)
    ;;   (set!-values (var1 ...) expr)))

    ;; > {(x y z) <+ (u v w) <+ (a b c)  <+ (values 2 4 5)}
    ;; 2
    ;; 4
    ;; 5
    ;; > (list x y z u v w a b c)
    ;; '(2 4 5 2 4 5 2 4 5)
    ((_ (var10 ...) (var11 ...) ... expr) (begin  ;; i do not do what
the syntax says (assignation not in the good order) but it gives the
same result
                        (define-values (var10 ...) expr)
                        (define-values (var11 ...) (values var10 ...))
                        ...
                        (values var10 ...)))

    ((_ var expr) (begin
            (define var expr)
            var))

     ;; > { y <+ z <+ 7 }
     ;; 7
     ;; > z
     ;; 7
     ;; > y
     ;; 7
     ;; > { x <+ y <+ z <+ 7 }
     ;; 7
     ;; > (list x y z)
     ;; '(7 7 7)
     ((_ var var1 ... expr) (begin ;; i do not do what the syntax says
(assignation not in the good order) but it gives the same result
                  (define var expr)
                  (define var1 var)
                  ...
                  var))

     ))

error:

... follows template with no suitably-nested pattern variable

the error is located on the second pattern:

((_ (var10 ...) (var11 ...) ... expr) (begin  ;; i do not do what the
syntax says (assignation not in the good order) but it gives the same
result
                        (define-values (var10 ...) expr)
                        (define-values (var11 ...) (values var10 ...))
                        ...
                        (values var10 ...)))

i had a few doubt long ago about multiple ... use but it worked well
with other scheme.

Damien

             reply	other threads:[~2023-10-06 22:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-06 22:01 Damien Mattei [this message]
2023-10-07  7:53 ` Damien Mattei

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

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

  git send-email \
    --in-reply-to='CADEOaddzfLEG7YL+c2B_=Znh3s5_MaphZLkfDMr60tWHFfn8HQ@mail.gmail.com' \
    --to=damien.mattei@gmail.com \
    --cc=kawa@sourceware.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).