The read syntax for strings is an arbitrarily long sequence of
characters enclosed in double quotes (
Backslash is an escape character and can be used to insert the following
\\ are R5RS standard,
\| is R7RS standard, the next seven are R6RS standard —
notice they follow C syntax — and the remaining four are Guile
Double quote character (an unescaped
" is otherwise the end
of the string).
Vertical bar character.
Bell character (ASCII 7).
Formfeed character (ASCII 12).
Newline character (ASCII 10).
Carriage return character (ASCII 13).
Tab character (ASCII 9).
Vertical tab character (ASCII 11).
Backspace character (ASCII 8).
NUL character (ASCII 0).
Open parenthesis. This is intended for use at the beginning of lines in multiline strings to avoid confusing Emacs lisp modes.
\followed by newline (ASCII 10)
Nothing. This way if
\ is the last character in a line, the
string will continue with the first character from the next line,
without a line break.
hungry-eol-escapes reader option is enabled, which is not
the case by default, leading whitespace on the next line is discarded.
"foo bar" ⇒ "foo bar" (read-enable 'hungry-eol-escapes) "foo bar" ⇒ "foobar"
Character code given by two hexadecimal digits. For example
\x7f for an ASCII DEL (127).
Character code given by four hexadecimal digits. For example
\u0100 for a capital A with macron (U+0100).
Character code given by six hexadecimal digits. For example
The following are examples of string literals:
"foo" "bar plonk" "Hello World" "\"Hi\", he said."
The three escape sequences
chosen to not break compatibility with code written for previous versions of
Guile. The R6RS specification suggests a different, incompatible syntax for hex
\xHHHH; – a character code followed by one to eight hexadecimal
digits terminated with a semicolon. If this escape format is desired instead,
it can be enabled with the reader option
For more on reader options, See Scheme Read.