1.2 Simple Data

Plait supports various kinds of numbers, all with type Number:

> 1

- Number

1

> 0.5

- Number

0.5

> 1/2

- Number

1/2

> 1+2i

- Number

1+2i

The number 1/2 is a literal number, not a division operation. Similarly, 1+2i is a literal complex number. The full syntax of numbers is probably not important, but it’s Racket’s number syntax.

The booleans true and false are written #t and #f, but you can also write them #true and #false:

> #t

- Boolean

#t

> #f

- Boolean

#f

> #true

- Boolean

#t

> #false

- Boolean

#f

Strings are written the usual way with a starting and ending ":

> "apple"

- String

"apple"

> "banana cream pie"

- String

"banana cream pie"

> "yes, \"escape\" quotes with backslash"

- String

"yes, \"escape\" quotes with backslash"

In addition to strings, Plait includes string-like values called symbols. A symbol is written with a single quote ' followed by a sequence of non-whitespace characters.

> 'apple

- Symbol

'apple

> 'banana-cream-pie

- Symbol

'banana-cream-pie

> 'a->b

- Symbol

'a->b

> '#%$^@*&?!

- Symbol

'#%$^@*&?!

Almost any non-whitespace character is allowed in a symbol, except for the following characters:

   ( ) [ ] { } " , ' ` ;

Characters like -, >, and ? are not only allowed in symbols, they are frequently used that way. The | and \ characters are allowed, but they’re treated as quoting and escaping characters, so don’t use them.

Individual characters are infrequently used in Plait, but they’re written with #\:

> #\a

- Char

#\a

> #\b

- Char

#\b

> #\A

- Char

#\A

> #\space ; same as #\ followed by a space

- Char

#\space