"a {b} c" (template-str "a " b " c")
A
The abbreviation for template-str
.
As far as the parser and printer are concerned, "x {y}"
and
(template-str "x " y)
are exactly equivalent.
To be more specific: when parsing a string, {
switches from parsing characters to parsing
forms, and }
switches back to parsing characters. The template string as a whole is
terminated with "
, as usual.
Curly braces can be escaped in a normal string literal using {{
or }}
. In a
raw string literal, curly braces are ignored, so they don't need to be escaped.
(let form '(template-str "hello, " planet))
(prn form) ; prints "hello, {planet}"