public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* macro error: ... follows template with no suitably-nested pattern variable
@ 2023-10-06 22:01 Damien Mattei
  2023-10-07  7:53 ` Damien Mattei
  0 siblings, 1 reply; 2+ messages in thread
From: Damien Mattei @ 2023-10-06 22:01 UTC (permalink / raw)
  To: kawa mailing list

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-07  7:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-06 22:01 macro error: ... follows template with no suitably-nested pattern variable Damien Mattei
2023-10-07  7:53 ` Damien Mattei

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).