19.8 History
The idea of quasiquotation is an old one. It was first developed by the philosopher Willard van Orman Quine73 in the early 1940s. It’s needed in philosophy because it helps when precisely delineating the use and mention of words, i.e. distinguishing between the object and the words we use to refer to that object.
Quasiquotation was first used in a programming language, Lisp, in the mid-1970s (Bawden 1999). Lisp has one quoting function `
, and uses ,
for unquoting. Most languages with a Lisp heritage behave similarly. For example, Racket (`
and @
), Clojure (`
and ~
), and Julia (:
and @
) all have quasiquotation tools that differ only slightly from Lisp. These languages have a single quoting function and you must call it explicitly.
In R, however, many functions quote one or more inputs. This introduces ambiguity (because you need to read the documentation to determine if an argument is quoted or not), but allows for concise and elegant data exploration code. In base R, only one function supports quasiquotation: bquote()
, written in 2003 by Thomas Lumley. However, bquote()
has some major limitations which prevented it from having a wide impact on R code (Section 19.5).
My attempt to resolve these limitations led to the lazyeval package (2014-2015). Unfortunately, my analysis of the problem was incomplete and while lazyeval solved some problems, it created others. It was not until I started working with Lionel Henry on the problem that all the pieces finally fell into place and we created the full tidy evaluation framework (2017). Despite the newness of tidy evaluation, I teach it here because it is a rich and powerful theory that, once mastered, makes many hard problems much easier.
References
Bawden, Alan. 1999. “Quasiquotation in Lisp.” In PEPM ’99, 4–12. http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.309.227.
You might be familiar with the name Quine from “quines”, computer programs that return a copy of their own source when run.↩︎