Traditional Scheme has only a few kinds of values, and thus only a few builtin kinds of literals. Modern Scheme allows defining new types, so it is desirable to have a mechanism for defining literal values for the new types.
You can create a new instance of a
URI using a
This isn’t too bad, though the double-quote characters are an ugly distraction. However, if you need to construct the string it gets messy:
(URI (string-append base-uri "icon.png"))
Instead use can write:
This syntax is translated by the Scheme reader to the more familiar but more verbose equivalent forms:
($construct$:URI "http://example.com/") ($construct$:URI $<<$ base-uri $>>$ "icon.png")
So for this to work there just needs to be a definition
$construct$:URI, usually a macro.
Normal scope rules apply; typically you’d define
$>>$ are bound to unique zero-length strings.
They are used to allow the implementation of
to determine which arguments are literal and which come from
If you want to define your own
or to read motivation and details, see the
SRFI 108 specification.
any character except