Dan Schemeπ i
This is a little Scheme-like language for situations in which
simplicity is preferred over convenience.
Creates a pair whose
car is
a and whose
cdr is
d.
Finds the first element of p.
Finds the second element of p.
Returns
#t if
p is a pair of the sort built with
cons , or
#f otherwise.
2Quotationsπ i
Suspends evaluation of e, constructing an S-expression data structure. Often written with an apostrophe.
Suspends evaluation of
e, allowing a return to evaluation using
unquote . Often written with a back-quote.
Resumes evaluation of
e within a
quasiquote . Often written with a comma.
3Equality Predicatesπ i
Recursively compares a and b for equality.
Return #f if a difference is found, or #t if not.
Non-recursively compares x and y for equality.
Return #f if a difference is found, or #t if not.
This should be used to compare symbols.
4Arithmeticπ i
Checks whether v is a number.
Computes the sum of
x... . If no numbers are provided, returns
0.
Computes the difference of
x0 and
x1... .
Computes the product of
x... . If no numbers are provided, returns
1.
If exactly one number
x0 is provided, returns its reciprocal. Otherwise, the quotient of
x0 and the product of
x1... is returned.
Returns one greater than x.
Returns one less than x.
5Numeric Comparisonsπ i
Checks whether all arguments are equal numbers.
Checks whether
x0x1x2... form a strictly increasing sequence of numbers.
Checks whether
x0x1x2... form a strictly decreasing sequence of numbers.
Checks whether
x0x1x2... form an increasing sequence of numbers.
Checks whether
x0x1x2... form a decreasing sequence of numbers.
6Membershipπ i
Returns the first pair of
haystack whose
car is
eqv? with
needle, or
#f if no such pair exists in
haystack.
Returns the first pair found in
associations whose
car is
eqv? with
key, or
#f if the key has no association in
associations.
Checks whether v is a proper list.
Finds the nth element of haystack, where the first element is 0.
Apply f to each element of list in order, constructing a new list of the results.
8Functionsπ i
Apply
f to the argument list constructed from
arg... and
args.
In the first form, construct a function that binds
x... in
body. In the second form, construct a function that binds
args to the entire list of arguments. However, in Dan Scheme, the second form of
lambda must pass its argument list directly to a helper.
If any of
b... are
#f, this form evaluates to
#f. Otherwise, it evaluates to the last
b, or
#t if
b... is empty.
If all of
b... are
#f, this form evaluates to
#f. Otherwise, it evaluates to the first non-
#f b, or
#f if
b... is empty.
Evaluates to #t if b is #f, or #f otherwise.
Evaluates to #t if v is either #t or #f, or #f if v is anything else.
Evaluates to t if c is not #f, or e otherwise.
Evaluates each
c in turn, until one is non-
"#f". The result is the corresponding
"e". If there is an
else -clause, it is used if non of the
c... are non-
#f.
#t if v is a symbol, #f otherwise.
11Definitions and Other Bindersπ i
In the first form, binds
x to the value of
e.
The second form is equivalent to
(define f(lambda (x... )e)).
Binds each
x... to the value of the corresponding
e... in
body.
Attempts to match each
pattern against the syntax being transformed, hygienically expanding to the corresponding
stx when one matches. The identifiers in
literal... are matched directly as keywords.
Specifies zero or more repetitions of a form.
Because simplicity is not always to be valued over convenience, Dan Scheme supports importing Racket identifiers. See Racket’s documentation for the meanings of require , provide , all-defined-out , and for-syntax .