Essentials of Programming Languages Language
The Essentials of Programming Languages language in DrRacket
provides a subset of functions and syntactic forms of
mzscheme—
#lang eopl |
The following bindings are re-provided from mzscheme:
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
|
| ||
|
|
|
|
(define-datatype id predicate-id (variant-id (field-id predicate-expr) ...) ...)
Each variant-id is defined as a constructor function that creates an instance of the datatype; the constructor takes as many arguments as the variant’s field-ids, and each argument is checked by applying the function produced by the variant’s predicate-expr.
In DrScheme v209 and older, when constructor-based printing was used, variant instances were printed with a make- prefix before the variant name. Thus, for compatibility, in addition to variant-id, make-variant-id is also defined for each variant-id (to the same constructor as variant-id).
(cases datatype-id expr (variant-id (field-id ...) result-expr ...) ...)
(cases datatype-id expr (variant-id (field-id ...) result-expr ...) ... (else result-expr ...))
sllgen:make-string-scanner
sllgen:make-string-parser
sllgen:make-stream-parser
sllgen:make-define-datatypes
sllgen:show-define-datatypes
sllgen:list-define-datatypes
(eopl:printf form v ...) → void? form : string? v : any/c
(eopl:pretty-print v [port]) → void? v : any/c port : output-port? = (current-output-port)
((list-of pred ...+) x) → boolean? pred : (any/c . -> . any) x : any/c
(always? x) → boolean? x : any/c
(maybe pred) → boolean? pred : (any/c . -> . boolean?)
empty : empty?
(time expr)
(collect-garbage) → void?
Tracing a function causes tail-calls in the original function to become non-tail calls.
(provide provide-spec ...)
The eopl library sets this variable to #f in the current namespace when it executes.
(install-eopl-exception-handler) → void?
The eopl library calls this function when it executes.
Bibliography
[EoPL] | “Essentials of Programming Languages, Third Edition,” MIT Press, 2008. http://www.eopl3.com/ |