On Wed, Nov 27, 2013 at 12:10 AM, Darius Bacon <wit...@gmail.com> wrote: > For a quasiquote in Scheme that works like the Common Lisp one: > https://github.com/darius/sketchbook/blob/master/misc/quasiquote.scm > > Alan Bawden's paper referenced from there gives the rationale. > Your implementation is so simple that I'd be happily surprised if it got things like ,@, and ,@,@ processed correctly. And it obviously doesn't handle #() and such. Once again, see my http://cliki.net/fare-quasiquote for a complete CL implementation.
> Faré wrote: >> That's an area where indeed maru could improve on CL, by e.g. >> specifying a meta-quasiquote protocol for how quoting interacts with >> user-defined syntax. > > It might be worth looking at E's quasiliterals design for ideas there. > http://erights.org/elang/grammar/quasi-overview.html > It has some good ideas, but plenty of bad ideas too. It makes ${0} ${1}, etc., without providing hygiene for cases where users would like ${0} as an actual literal in the text (e.g. because of recursive patterns). A kludgy solution along those lines would at least use a cryptographic gensym to prevent collisions, and pass that as argument in the expansion, and/or somehow escape the dollars in the text. A real solution would have a notion of parametrized extensible grammars, so that the escaping happens properly at all levels. A formalization of this extension mechanism is what I'm seeking. E also falls short by distinguishing quasiquoting for expressions and patterns ${x} and @{x}. The two should be dual and disambiguation should happen from context, and to get the equivalent of E's ${x} in a pattern context should just be @{kwote(x)}, where (kwote x) is as in traditional Lisp: (defun kwote (x) (list 'quote x)). —♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org There are three types of people in the world; those who can count, and those who can't. _______________________________________________ fonc mailing list fonc@vpri.org http://vpri.org/mailman/listinfo/fonc