The Racket Reference has more details than this here page. I took these notes regarding Racket as a memory aid to help me get started with Racket.
Racket identifiers can contain any characters except for whitespace and the following special characters: '( ) [ ] { } “ , ' ` ; # | \
'. A special case is #
which is allowed at the beginning of a symbol.
Linked lists are favored in racket. Each element of the list can be a “pair” created by the cons
function. The first element of the pair is the current value and the second element of the pair is a pointer to the next pair or null
.
In Racket, null
is an empty list, which is a singleton.
The boolean true value.
The boolean false value.
The empty list.
Creates a newly allocated pair.
(cons <first-value> <second-value>)
Returns the first value of a pair created with cons
.
(car <pair-created-by-cons>)
Returns the second value of a pair created with cons
.
(cdr <par-created-by-cons>)
It's somewhat like a switch statement in other languages:
(cond (<condition> <value-if-true>) (<condition> <value-if-true>)... (<value if false>))
Appends strings. Arguments *must* be strings already.
(string-append <str1> <strN>...)
Converts a number to a string.
(number->string <number>)
Constructs a linked list from the specified arguments.
(list <arg1> <argN>...)
Note that the value returned is a pair containing the value of the first argument and pointer to the next pair in the list.