开发者

Turning list-of-lists into set of lists in scheme for macro expansion body?

开发者 https://www.devze.com 2023-01-21 06:58 出处:网络
Is there a general way to take a list of items and flatten it to depth zero so that they can be spliced into a mac开发者_JAVA技巧ro expansion? For instance:

Is there a general way to take a list of items and flatten it to depth zero so that they can be spliced into a mac开发者_JAVA技巧ro expansion? For instance:

((+ 1 2) (+ 3 4) (+ 4 5)) -> (+ 1 2) (+ 3 4) (+ 4 5)


Note: This is based on Eli Barzilay's comment that never ended up getting turned into an answer. That's why it's community wiki.

If you want a sequence of expressions for the expansion of a macro, then you need to wrap them in a begin. As for the flattening, you can do that with a ... after the thing that you want to splice up. This is assuming that you're using syntax-rules or syntax-case, of course.

0

精彩评论

暂无评论...
验证码 换一张
取 消