@megavlad has joined the channel
Not with list alone, but you can use (list* 'a 'b (list 'c 'd)) or (append (list 'a 'b) (list 'c 'd)).
Well, with append, those would just be (append (list 'a 'b) (list 'c 'd) (list 'e 'f)). But you could also use flatten, if none of the subelements are lists.
I have a kind of silly macro question. I am using @samth’s parser tools. I wanted to define a form that would help me wrap all of a parser’s productions with enclosing source information.
That library provides a parser form (https://docs.racket-lang.org/parser-tools/LALR_1__Parsers.html#%28form._%28%28lib._parser-tools%2Fyacc..rkt%29._parser%29%29). That form expects several clauses. One of those has to be a grammar form, specifying the grammar along with productions for each rule. I wanted to create a macro that would replace grammar and then match against each parser action and wrap it in a specific thunk that added source information. When I tried to do this, the library gave me back (predictably) an error that it expected a grammar form rather than my instrumented-grammar form. Is there a way I could get past this?
I feel like maybe I could like elaborately treat the code that generates the parser as syntax and then like splice them together manually using quote-syntax and such..
@krismicinski You might find this blog post I wrote a little while ago relevant: https://lexi-lambda.github.io/blog/2018/10/06/macroexpand-anywhere-with-local-apply-transformer/
(I would not necessarily recommend literally using the expand-inside form defined in the blog post, but you might be able to reuse the same techniques.)
Also, I don’t think parser-tools is Sam’s, fwiw.
ah my mistake, it was his picture on github, but he’s probably mirroring
@lexi.lambda thanks! Looks great
wow, yes, this is great.