2023-03-03 22:32:31 +03:00
This transcript shows some syntax for raw text literals.
2023-03-03 18:02:10 +03:00
2024-07-10 17:46:18 +03:00
``` unison
2023-03-03 18:02:10 +03:00
lit1 = """
This is a raw text literal.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
The initial newline, if it exists, is ignored.
2023-07-21 07:55:12 +03:00
The last line, if it's just whitespace up to the closing quotes,
is ignored.
Use an extra blank line if you'd like a trailing newline. Like so:
2023-03-03 18:02:10 +03:00
"""
> lit1
2023-03-04 00:10:30 +03:00
> Some lit1
2023-03-03 18:02:10 +03:00
lit2 = """"
2023-03-04 00:10:30 +03:00
This is a raw text literal, indented.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
2023-03-03 18:02:10 +03:00
2023-03-04 00:10:30 +03:00
This doesn't terminate the literal - """
""""
2023-03-03 18:02:10 +03:00
> lit2
2023-03-03 22:32:31 +03:00
> Some lit2
2023-03-03 18:02:10 +03:00
```
2024-07-10 19:17:15 +03:00
``` ucm
2023-03-03 18:02:10 +03:00
2023-12-22 14:55:24 +03:00
Loading changes detected in scratch.u.
2023-03-03 18:02:10 +03:00
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update` , here's how your codebase would
change:
⍟ These new definitions are ok to `add` :
lit1 : Text
lit2 : Text
Now evaluating any watch expressions (lines starting with
`>` )... Ctrl+C cancels.
2023-07-21 07:55:12 +03:00
15 | > lit1
2023-03-03 18:02:10 +03:00
⧩
2023-03-04 00:10:30 +03:00
"""
This is a raw text literal.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
The initial newline, if it exists, is ignored.
2023-07-21 07:55:12 +03:00
The last line, if it's just whitespace up to the closing quotes,
is ignored.
Use an extra blank line if you'd like a trailing newline. Like so:
2023-03-04 00:10:30 +03:00
"""
2023-03-03 18:02:10 +03:00
2023-07-21 07:55:12 +03:00
16 | > Some lit1
2023-03-03 18:02:10 +03:00
⧩
2023-03-04 00:10:30 +03:00
Some
2023-07-21 07:55:12 +03:00
"This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThe initial newline, if it exists, is ignored.\nThe last line, if it's just whitespace up to the closing quotes,\nis ignored.\n\nUse an extra blank line if you'd like a trailing newline. Like so:\n"
2023-03-03 22:32:31 +03:00
2023-07-21 07:55:12 +03:00
27 | > lit2
2023-03-04 00:10:30 +03:00
⧩
""""
This is a raw text literal, indented.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
This doesn't terminate the literal - """
""""
2023-07-21 07:55:12 +03:00
28 | > Some lit2
2023-03-03 22:32:31 +03:00
⧩
Some
2023-07-21 07:55:12 +03:00
"This is a raw text literal, indented.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\""
2023-03-03 22:32:31 +03:00
```
2024-07-10 19:17:15 +03:00
``` ucm
2024-06-12 01:22:09 +03:00
scratch/main> add
2023-03-03 22:32:31 +03:00
⍟ I've added these definitions:
lit1 : Text
lit2 : Text
2024-06-12 01:22:09 +03:00
scratch/main> view lit1 lit2
2023-03-03 22:32:31 +03:00
lit1 : Text
lit1 =
2023-03-04 00:10:30 +03:00
"""
This is a raw text literal.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
The initial newline, if it exists, is ignored.
2023-07-21 07:55:12 +03:00
The last line, if it's just whitespace up to the closing quotes,
is ignored.
Use an extra blank line if you'd like a trailing newline. Like so:
2023-03-04 00:10:30 +03:00
"""
2023-03-03 22:32:31 +03:00
lit2 : Text
lit2 =
2023-03-04 00:10:30 +03:00
""""
This is a raw text literal, indented.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n
This doesn't terminate the literal - """
""""
2023-03-03 18:02:10 +03:00
```