8.16.0.4
Dan Scheme
#lang dan-scheme | package: dan-scheme |
This is a little Scheme-like language for situations in which
simplicity is preferred over convenience.
1 Pairs
Finds the first element of p.
Finds the second element of p.
2 Quotations
syntax
(quote e)
Suspends evaluation of e, constructing an S-expression data structure. Often written with an apostrophe.
syntax
(quasiquote e)
Suspends evaluation of e, allowing a return to evaluation using unquote. Often written with a back-quote.
syntax
(unquote e)
Resumes evaluation of e within a quasiquote. Often written with a comma.
3 Equality Predicates
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.
4 Arithmetic
Checks whether v is a number.
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.
5 Numeric Comparisons
Checks whether all arguments are equal numbers.
6 Membership
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.
7 Lists
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.
8 Functions
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.
See lambda.
9 Booleans
syntax
(and b ...)
If any of b ... are #f, this form evaluates to #f. Otherwise, it evaluates to the last b, or #t if b ... is empty.
syntax
(or b ...)
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.
syntax
(if c t e)
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.
10 Symbols
#t if v is a symbol, #f otherwise.
11 Definitions and Other Binders
In the first form, binds x to the value of e.
The second form is equivalent to
(define f (lambda (x ...) e)).
syntax
(let ((x e) ...) body)
12 Macros
syntax
(define-syntax op (syntax-rules (literal ...) (pattern expr) ...))
Associates the new special form op with the macro defined by the syntax-rules form. In Dan Scheme, define-syntax must be followed by syntax-rules.
syntax
(syntax-rules (literal ...) (pattern stx) ...)
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.
syntax
Specifies zero or more repetitions of a form.
13 Modules
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.