Essentials of Programming Languages Language
The Essentials of Programming Languages language in DrRacket
provides a subset of functions and syntactic forms of
racket—
#lang eopl | package: eopl |
The following bindings are re-provided from racket:
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
| |||
|
|
|
|
语法
(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 ...))
语法
语法
语法
语法
语法
语法
函数
(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)
值
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/ |