macro error: ... follows template with no suitably-nested pattern variable
Damien Mattei
damien.mattei@gmail.com
Fri Oct 6 22:01:10 GMT 2023
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
More information about the Kawa
mailing list