vadr
vadr copied to clipboard
syntax-groups
It appears that qq
and friends, as well as chain
and friends, really want to expand from the "inside out" rather than from the "outside in."
For example, current qq doesn't come close to handling the nested quasiquotation as discussed by Bawden and implemented in Scheme, Common Lisp et al.
Meanwhile, chain(x, foo, bar(1), ddply("group", chainf(rev, .[1])))
doesn't work because the '.' is buried all down there. It would be more intuitive if each 'chain' made a private scope for the null subject. But doing this directly requires 'chain' to know about 'chainf' and '%|>%', 'inject', 'alter' and all those things that make pseudo- scopes for '.'. Meanwhile 'qq' must when know about 'qe', 'qqply', 'qeply' and anything else I think of.
Might be remedied by putting related macros into a 'syntax group' which uses the quoting.env trick to expand selected macros from the inside out rather than from the outside in.