RL provides the following literals.
Note that term literals are described elsewhere.
An odd property of the literals is that, while each has a default type, you can override the type if you wish.
A symbol has two forms.
'..'), including the special escape sequences \n (newline), \r (carriage return), \t (tab), \\ (backslash), \“ (double quotation mark), \' (single quotation mark), and \\u{N} where N is a hexadecimal number of up to six characters specifying a Unicode code point.While you don't really need to escape double quotation marks in a symbol, the choice to allow the escape makes this consistent with strings.
The following are examples of symbols.
fred _primary_ '' '5' '$ 9\'-' Set_3
The default type for all symbols is the root type SYMBOL, but the type of a symbol can be given explicitly. This allows distinguishing between root types (like STRING:^ROOT) and symbols with the same name (like STRING:SYMBOL). The following are legal symbols.
'_' | Would otherwise conflict with the wildcard '_' |
'^ROOT' | Would otherwise conflict with the root term |
'ANY' and ANY:SYMBOL | Would otherwise conflict with the wildcard 'ANY' |
'NONE' and NONE:SYMBOL | Would otherwise conflict with the wildcard 'NONE' |
'INTEGER' and INTEGER:SYMBOL | Would otherwise conflict with the root type 'INTEGER' |
A string has two forms.
".."), including the special escape sequences \n (newline), \r (carriage return), \t (tab), \\ (backslash), \” (double quotation mark), \' (single quotation mark), and \\u{N} where N is a hexadecimal number of up to six characters specifying a Unicode code point.“”“..”“”). Character escapes are not interpreted; all characters are preserved as-is.
As we will see later, strings can be composed with the applicative dot, so “Hello ”.“”“world”“” becomes the string “Hello world”.