[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A macro containing a mini-macro?
From: |
HiPhish |
Subject: |
Re: A macro containing a mini-macro? |
Date: |
Sun, 16 Sep 2018 00:21:48 +0200 |
I don't quite follow; having a macro for the byte DSL is simple:
(define-syntax byte-dsl
(syntax-rules ()
((_ byte) (list byte))
((_ count byte) (make-list count byte byte))))
But this requires every byte specification to be written as `(byte-dsl 0x00)`,
which I want to avoid in my test-case DSL. I want to be able to write
(test-case 13 (#x01 #x02 (4 #xAB) #xFF))
This requires being able to match either `byte` or `(amount byte)` inside the
test-case pattern.
address@hidden wrote:
> You can implement the DSL that transforms bytevector descriptions like
> (#xDC (16 #x00)) into a bytevector as a procedure, suppose we call it
> byte-dsl. Then you only need to change u8-list->bytevector with
> byte-dsl. This lets you do what you wanted without the difficult task of
> macros inside macros.