r5rs and srfi docs and bindings
svn: r9336
|
@ -20,9 +20,9 @@
|
|||
|
||||
@title{@bold{R5RS}: Legacy Standard Language}
|
||||
|
||||
The ``The Revised@superscript{5} Report on the Algorithmic Language
|
||||
Scheme'' @cite["Kelsey98"] defines a dialect of Scheme. We use
|
||||
@defterm{@|r5rs|} to refer to both the standard and the language
|
||||
The @link["../r5rs-std/index.html"]{The Revised@superscript{5} Report
|
||||
on the Algorithmic Language Scheme} defines a dialect of Scheme. We
|
||||
use @defterm{@|r5rs|} to refer to both the standard and the language
|
||||
defined by the standard.
|
||||
|
||||
The default dialect of Scheme provided by @exec{mzscheme} and other
|
||||
|
@ -31,6 +31,8 @@ includes tools and libraries for running @|r5rs| programs.
|
|||
|
||||
@table-of-contents[]
|
||||
|
||||
@redirects[]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@section[#:tag "running"]{Running @|r5rs| Programs}
|
||||
|
@ -150,24 +152,19 @@ The @scheme[cons] of @schememodname[r5rs] corresponds to
|
|||
is @scheme[mcdr], and @scheme[map] is @schememodname[scheme/mpair]'s
|
||||
@scheme[mmap], and so on.
|
||||
|
||||
@defproc[(eval [expr any/c] [environment namespace?]) any]{
|
||||
|
||||
An @|r5rs| @defterm{environment} is implemented as a
|
||||
@scheme[scheme/base] @defterm{namespace}. Also, relative to
|
||||
@scheme[scheme/base], the @scheme[expr] passed to @scheme[eval] is
|
||||
constructed using mutable pairs.}
|
||||
constructed using mutable pairs.
|
||||
|
||||
@defproc[(scheme-report-environment [n (one-of/c 5)]) namespace?]{
|
||||
The @scheme[scheme-report-environment] function returns a namespace
|
||||
containing the bindings of @schememodname[r5rs]. Procedure values are
|
||||
installed into the namespace using @scheme[namespace-require/copy], so
|
||||
that they can be redefined.
|
||||
|
||||
Returns a namespace containing the bindings of @schememodname[r5rs].
|
||||
Procedure values are installed into the namespace using
|
||||
@scheme[namespace-require/copy], so that they can be redefined.}
|
||||
|
||||
@defproc[(scheme-null-environment [n (one-of/c 5)]) namespace?]{
|
||||
|
||||
Returns a namespace containing the syntactic forms of
|
||||
@schememodname[r5rs], not including @scheme[#%module-begin] (which is
|
||||
not useful outside of a module).}
|
||||
The @scheme[scheme-null-environment] function returns a namespace
|
||||
containing the syntactic forms of @schememodname[r5rs], not including
|
||||
@scheme[#%module-begin] (which is not useful outside of a module).
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
|
@ -194,12 +191,228 @@ importing @schememodname[r5rs/init].
|
|||
|
||||
@; ----------------------------------------
|
||||
|
||||
@(bibliography
|
||||
@(define (redirects)
|
||||
(make-binding-redirect-elements
|
||||
'r5rs
|
||||
(map (lambda (b)
|
||||
(list (string->symbol (car b))
|
||||
(cadr b)
|
||||
(build-path 'up "r5rs-std" (caddr b))
|
||||
(cadddr b)))
|
||||
bindings)))
|
||||
|
||||
(bib-entry #:key "Kelsey98"
|
||||
#:author "Richard Kelsey, William Clinger, and Jonathan Rees (editors)"
|
||||
#:title @elem{The Revised@superscript{5} Report on the Algorithmic Language Scheme}
|
||||
#:date "1998"
|
||||
#:url "http://schemers.org/Documents/Standards/R5RS/")
|
||||
@; This list was extracted from the old "keywords" and "hdindex" files:
|
||||
@(define bindings
|
||||
'(("lambda" #t "r5rs-Z-H-7.html" "%_idx_96")
|
||||
("set!" #t "r5rs-Z-H-7.html" "%_idx_104")
|
||||
("quote" #t "r5rs-Z-H-7.html" "%_idx_86")
|
||||
("quasiquote" #t "r5rs-Z-H-7.html" "%_idx_154")
|
||||
("or" #t "r5rs-Z-H-7.html" "%_idx_122")
|
||||
("and" #t "r5rs-Z-H-7.html" "%_idx_120")
|
||||
("define" #t "r5rs-Z-H-8.html" "%_idx_194")
|
||||
("define-syntax" #t "r5rs-Z-H-8.html" "%_idx_202")
|
||||
("let" #t "r5rs-Z-H-7.html" "%_idx_126")
|
||||
("let*" #t "r5rs-Z-H-7.html" "%_idx_130")
|
||||
("let-syntax" #t "r5rs-Z-H-7.html" "%_idx_184")
|
||||
("letrec" #t "r5rs-Z-H-7.html" "%_idx_134")
|
||||
("letrec-syntax" #t "r5rs-Z-H-7.html" "%_idx_186")
|
||||
("cond" #t "r5rs-Z-H-7.html" "%_idx_108")
|
||||
("delay" #t "r5rs-Z-H-7.html" "%_idx_146")
|
||||
("do" #t "r5rs-Z-H-7.html" "%_idx_140")
|
||||
("if" #t "r5rs-Z-H-7.html" "%_idx_98")
|
||||
("case" #t "r5rs-Z-H-7.html" "%_idx_116")
|
||||
("begin" #t "r5rs-Z-H-7.html" "%_idx_138")
|
||||
|
||||
)
|
||||
("zero?" #f "r5rs-Z-H-9.html" "%_idx_268")
|
||||
("write-char" #f "r5rs-Z-H-9.html" "%_idx_666")
|
||||
;; ("write-char" #f "r5rs-Z-H-9.html" "%_idx_664")
|
||||
("write" #f "r5rs-Z-H-9.html" "%_idx_654")
|
||||
;; ("write" #f "r5rs-Z-H-9.html" "%_idx_652")
|
||||
("with-output-to-file" #f "r5rs-Z-H-9.html" "%_idx_624")
|
||||
("with-input-from-file" #f "r5rs-Z-H-9.html" "%_idx_622")
|
||||
("vector?" #f "r5rs-Z-H-9.html" "%_idx_556")
|
||||
("vector-set!" #f "r5rs-Z-H-9.html" "%_idx_568")
|
||||
("vector-ref" #f "r5rs-Z-H-9.html" "%_idx_566")
|
||||
("vector-length" #f "r5rs-Z-H-9.html" "%_idx_564")
|
||||
("vector-fill!" #f "r5rs-Z-H-9.html" "%_idx_574")
|
||||
("vector->list" #f "r5rs-Z-H-9.html" "%_idx_570")
|
||||
("vector" #f "r5rs-Z-H-9.html" "%_idx_562")
|
||||
("values" #f "r5rs-Z-H-9.html" "%_idx_594")
|
||||
("truncate" #f "r5rs-Z-H-9.html" "%_idx_318")
|
||||
("transcript-on" #f "r5rs-Z-H-9.html" "%_idx_670")
|
||||
("transcript-off" #f "r5rs-Z-H-9.html" "%_idx_672")
|
||||
("tan" #f "r5rs-Z-H-9.html" "%_idx_334")
|
||||
("symbol?" #f "r5rs-Z-H-9.html" "%_idx_460")
|
||||
("symbol->string" #f "r5rs-Z-H-9.html" "%_idx_462")
|
||||
("substring" #f "r5rs-Z-H-9.html" "%_idx_542")
|
||||
("string?" #f "r5rs-Z-H-9.html" "%_idx_508")
|
||||
("string>?" #f "r5rs-Z-H-9.html" "%_idx_528")
|
||||
("string>=?" #f "r5rs-Z-H-9.html" "%_idx_532")
|
||||
("string=?" #f "r5rs-Z-H-9.html" "%_idx_522")
|
||||
("string<?" #f "r5rs-Z-H-9.html" "%_idx_526")
|
||||
("string<=?" #f "r5rs-Z-H-9.html" "%_idx_530")
|
||||
("string-set!" #f "r5rs-Z-H-9.html" "%_idx_520")
|
||||
("string-ref" #f "r5rs-Z-H-9.html" "%_idx_518")
|
||||
("string-length" #f "r5rs-Z-H-9.html" "%_idx_516")
|
||||
("string-fill!" #f "r5rs-Z-H-9.html" "%_idx_552")
|
||||
("string-copy" #f "r5rs-Z-H-9.html" "%_idx_550")
|
||||
("string-ci>?" #f "r5rs-Z-H-9.html" "%_idx_536")
|
||||
("string-ci>=?" #f "r5rs-Z-H-9.html" "%_idx_540")
|
||||
("string-ci=?" #f "r5rs-Z-H-9.html" "%_idx_524")
|
||||
("string-ci<?" #f "r5rs-Z-H-9.html" "%_idx_534")
|
||||
("string-ci<=?" #f "r5rs-Z-H-9.html" "%_idx_538")
|
||||
("string-append" #f "r5rs-Z-H-9.html" "%_idx_544")
|
||||
("string->symbol" #f "r5rs-Z-H-9.html" "%_idx_464")
|
||||
("string->number" #f "r5rs-Z-H-9.html" "%_idx_370")
|
||||
;; ("string->number" #f "r5rs-Z-H-9.html" "%_idx_368")
|
||||
("string->list" #f "r5rs-Z-H-9.html" "%_idx_546")
|
||||
("string" #f "r5rs-Z-H-9.html" "%_idx_514")
|
||||
("sqrt" #f "r5rs-Z-H-9.html" "%_idx_344")
|
||||
("sin" #f "r5rs-Z-H-9.html" "%_idx_330")
|
||||
("set-cdr!" #f "r5rs-Z-H-9.html" "%_idx_418")
|
||||
("set-car!" #f "r5rs-Z-H-9.html" "%_idx_416")
|
||||
("scheme-report-environment" #f "r5rs-Z-H-9.html" "%_idx_602")
|
||||
("round" #f "r5rs-Z-H-9.html" "%_idx_320")
|
||||
("reverse" #f "r5rs-Z-H-9.html" "%_idx_440")
|
||||
("remainder" #f "r5rs-Z-H-9.html" "%_idx_302")
|
||||
("real?" #f "r5rs-Z-H-9.html" "%_idx_248")
|
||||
("real-part" #f "r5rs-Z-H-9.html" "%_idx_352")
|
||||
("read-char" #f "r5rs-Z-H-9.html" "%_idx_640")
|
||||
;; ("read-char" #f "r5rs-Z-H-9.html" "%_idx_638")
|
||||
("read" #f "r5rs-Z-H-9.html" "%_idx_636")
|
||||
;; ("read" #f "r5rs-Z-H-9.html" "%_idx_634")
|
||||
("rationalize" #f "r5rs-Z-H-9.html" "%_idx_322")
|
||||
("rational?" #f "r5rs-Z-H-9.html" "%_idx_250")
|
||||
("quotient" #f "r5rs-Z-H-9.html" "%_idx_300")
|
||||
("procedure?" #f "r5rs-Z-H-9.html" "%_idx_576")
|
||||
("positive?" #f "r5rs-Z-H-9.html" "%_idx_270")
|
||||
("peek-char" #f "r5rs-Z-H-9.html" "%_idx_644")
|
||||
;; ("peek-char" #f "r5rs-Z-H-9.html" "%_idx_642")
|
||||
("pair?" #f "r5rs-Z-H-9.html" "%_idx_406")
|
||||
("output-port?" #f "r5rs-Z-H-9.html" "%_idx_616")
|
||||
("open-output-file" #f "r5rs-Z-H-9.html" "%_idx_628")
|
||||
("open-input-file" #f "r5rs-Z-H-9.html" "%_idx_626")
|
||||
("odd?" #f "r5rs-Z-H-9.html" "%_idx_274")
|
||||
("numerator" #f "r5rs-Z-H-9.html" "%_idx_310")
|
||||
("number?" #f "r5rs-Z-H-9.html" "%_idx_244")
|
||||
("number->string" #f "r5rs-Z-H-9.html" "%_idx_366")
|
||||
;; ("number->string" #f "r5rs-Z-H-9.html" "%_idx_364")
|
||||
("null?" #f "r5rs-Z-H-9.html" "%_idx_428")
|
||||
("null-environment" #f "r5rs-Z-H-9.html" "%_idx_604")
|
||||
("not" #f "r5rs-Z-H-9.html" "%_idx_386")
|
||||
("newline" #f "r5rs-Z-H-9.html" "%_idx_662")
|
||||
;; ("newline" #f "r5rs-Z-H-9.html" "%_idx_660")
|
||||
("negative?" #f "r5rs-Z-H-9.html" "%_idx_272")
|
||||
("modulo" #f "r5rs-Z-H-9.html" "%_idx_304")
|
||||
("min" #f "r5rs-Z-H-9.html" "%_idx_280")
|
||||
("memv" #f "r5rs-Z-H-9.html" "%_idx_448")
|
||||
("memq" #f "r5rs-Z-H-9.html" "%_idx_446")
|
||||
("member" #f "r5rs-Z-H-9.html" "%_idx_450")
|
||||
("max" #f "r5rs-Z-H-9.html" "%_idx_278")
|
||||
("map" #f "r5rs-Z-H-9.html" "%_idx_580")
|
||||
("make-vector" #f "r5rs-Z-H-9.html" "%_idx_560")
|
||||
;; ("make-vector" #f "r5rs-Z-H-9.html" "%_idx_558")
|
||||
("make-string" #f "r5rs-Z-H-9.html" "%_idx_512")
|
||||
;; ("make-string" #f "r5rs-Z-H-9.html" "%_idx_510")
|
||||
("make-rectangular" #f "r5rs-Z-H-9.html" "%_idx_348")
|
||||
("make-polar" #f "r5rs-Z-H-9.html" "%_idx_350")
|
||||
("magnitude" #f "r5rs-Z-H-9.html" "%_idx_356")
|
||||
("log" #f "r5rs-Z-H-9.html" "%_idx_328")
|
||||
("load" #f "r5rs-Z-H-9.html" "%_idx_668")
|
||||
("list?" #f "r5rs-Z-H-9.html" "%_idx_432")
|
||||
("list-tail" #f "r5rs-Z-H-9.html" "%_idx_442")
|
||||
("list-ref" #f "r5rs-Z-H-9.html" "%_idx_444")
|
||||
("list->vector" #f "r5rs-Z-H-9.html" "%_idx_572")
|
||||
("list->string" #f "r5rs-Z-H-9.html" "%_idx_548")
|
||||
("list" #f "r5rs-Z-H-9.html" "%_idx_434")
|
||||
("length" #f "r5rs-Z-H-9.html" "%_idx_436")
|
||||
("lcm" #f "r5rs-Z-H-9.html" "%_idx_308")
|
||||
("interaction-environment" #f "r5rs-Z-H-9.html" "%_idx_606")
|
||||
("integer?" #f "r5rs-Z-H-9.html" "%_idx_252")
|
||||
("integer->char" #f "r5rs-Z-H-9.html" "%_idx_500")
|
||||
("input-port?" #f "r5rs-Z-H-9.html" "%_idx_614")
|
||||
("inexact?" #f "r5rs-Z-H-9.html" "%_idx_256")
|
||||
("inexact->exact" #f "r5rs-Z-H-9.html" "%_idx_362")
|
||||
("imag-part" #f "r5rs-Z-H-9.html" "%_idx_354")
|
||||
("gcd" #f "r5rs-Z-H-9.html" "%_idx_306")
|
||||
("force" #f "r5rs-Z-H-9.html" "%_idx_584")
|
||||
("for-each" #f "r5rs-Z-H-9.html" "%_idx_582")
|
||||
("floor" #f "r5rs-Z-H-9.html" "%_idx_314")
|
||||
("expt" #f "r5rs-Z-H-9.html" "%_idx_346")
|
||||
("exp" #f "r5rs-Z-H-9.html" "%_idx_326")
|
||||
("exact?" #f "r5rs-Z-H-9.html" "%_idx_254")
|
||||
("exact->inexact" #f "r5rs-Z-H-9.html" "%_idx_360")
|
||||
("even?" #f "r5rs-Z-H-9.html" "%_idx_276")
|
||||
("eval" #f "r5rs-Z-H-9.html" "%_idx_600")
|
||||
("eqv?" #f "r5rs-Z-H-9.html" "%_idx_214")
|
||||
("equal?" #f "r5rs-Z-H-9.html" "%_idx_222")
|
||||
("eq?" #f "r5rs-Z-H-9.html" "%_idx_220")
|
||||
("eof-object?" #f "r5rs-Z-H-9.html" "%_idx_646")
|
||||
("dynamic-wind" #f "r5rs-Z-H-9.html" "%_idx_598")
|
||||
("display" #f "r5rs-Z-H-9.html" "%_idx_658")
|
||||
;; ("display" #f "r5rs-Z-H-9.html" "%_idx_656")
|
||||
("denominator" #f "r5rs-Z-H-9.html" "%_idx_312")
|
||||
("current-output-port" #f "r5rs-Z-H-9.html" "%_idx_620")
|
||||
("current-input-port" #f "r5rs-Z-H-9.html" "%_idx_618")
|
||||
("cos" #f "r5rs-Z-H-9.html" "%_idx_332")
|
||||
("cons" #f "r5rs-Z-H-9.html" "%_idx_408")
|
||||
("complex?" #f "r5rs-Z-H-9.html" "%_idx_246")
|
||||
("close-output-port" #f "r5rs-Z-H-9.html" "%_idx_632")
|
||||
("close-input-port" #f "r5rs-Z-H-9.html" "%_idx_630")
|
||||
("char?" #f "r5rs-Z-H-9.html" "%_idx_466")
|
||||
("char>?" #f "r5rs-Z-H-9.html" "%_idx_472")
|
||||
("char>=?" #f "r5rs-Z-H-9.html" "%_idx_476")
|
||||
("char=?" #f "r5rs-Z-H-9.html" "%_idx_468")
|
||||
("char<?" #f "r5rs-Z-H-9.html" "%_idx_470")
|
||||
("char<=?" #f "r5rs-Z-H-9.html" "%_idx_474")
|
||||
("char-whitespace?" #f "r5rs-Z-H-9.html" "%_idx_492")
|
||||
("char-upper-case?" #f "r5rs-Z-H-9.html" "%_idx_494")
|
||||
("char-upcase" #f "r5rs-Z-H-9.html" "%_idx_502")
|
||||
("char-ready?" #f "r5rs-Z-H-9.html" "%_idx_650")
|
||||
;; ("char-ready?" #f "r5rs-Z-H-9.html" "%_idx_648")
|
||||
("char-numeric?" #f "r5rs-Z-H-9.html" "%_idx_490")
|
||||
("char-lower-case?" #f "r5rs-Z-H-9.html" "%_idx_496")
|
||||
("char-downcase" #f "r5rs-Z-H-9.html" "%_idx_504")
|
||||
("char-ci>?" #f "r5rs-Z-H-9.html" "%_idx_482")
|
||||
("char-ci>=?" #f "r5rs-Z-H-9.html" "%_idx_486")
|
||||
("char-ci=?" #f "r5rs-Z-H-9.html" "%_idx_478")
|
||||
("char-ci<?" #f "r5rs-Z-H-9.html" "%_idx_480")
|
||||
("char-ci<=?" #f "r5rs-Z-H-9.html" "%_idx_484")
|
||||
("char-alphabetic?" #f "r5rs-Z-H-9.html" "%_idx_488")
|
||||
("char->integer" #f "r5rs-Z-H-9.html" "%_idx_498")
|
||||
("ceiling" #f "r5rs-Z-H-9.html" "%_idx_316")
|
||||
("cdr" #f "r5rs-Z-H-9.html" "%_idx_414")
|
||||
("cddddr" #f "r5rs-Z-H-9.html" "%_idx_426")
|
||||
("cdddar" #f "r5rs-Z-H-9.html" "%_idx_424")
|
||||
("car" #f "r5rs-Z-H-9.html" "%_idx_410")
|
||||
("call-with-values" #f "r5rs-Z-H-9.html" "%_idx_596")
|
||||
("call-with-output-file" #f "r5rs-Z-H-9.html" "%_idx_612")
|
||||
("call-with-input-file" #f "r5rs-Z-H-9.html" "%_idx_610")
|
||||
("call-with-current-continuation" #f "r5rs-Z-H-9.html" "%_idx_588")
|
||||
("cadr" #f "r5rs-Z-H-9.html" "%_idx_422")
|
||||
("caar" #f "r5rs-Z-H-9.html" "%_idx_420")
|
||||
("boolean?" #f "r5rs-Z-H-9.html" "%_idx_388")
|
||||
("atan" #f "r5rs-Z-H-9.html" "%_idx_342")
|
||||
;; ("atan" #f "r5rs-Z-H-9.html" "%_idx_340")
|
||||
("assv" #f "r5rs-Z-H-9.html" "%_idx_454")
|
||||
("assq" #f "r5rs-Z-H-9.html" "%_idx_452")
|
||||
("assoc" #f "r5rs-Z-H-9.html" "%_idx_456")
|
||||
("asin" #f "r5rs-Z-H-9.html" "%_idx_336")
|
||||
("apply" #f "r5rs-Z-H-9.html" "%_idx_578")
|
||||
("append" #f "r5rs-Z-H-9.html" "%_idx_438")
|
||||
("angle" #f "r5rs-Z-H-9.html" "%_idx_358")
|
||||
("acos" #f "r5rs-Z-H-9.html" "%_idx_338")
|
||||
("abs" #f "r5rs-Z-H-9.html" "%_idx_298")
|
||||
(">=" #f "r5rs-Z-H-9.html" "%_idx_266")
|
||||
(">" #f "r5rs-Z-H-9.html" "%_idx_262")
|
||||
("=" #f "r5rs-Z-H-9.html" "%_idx_258")
|
||||
("<=" #f "r5rs-Z-H-9.html" "%_idx_264")
|
||||
("<" #f "r5rs-Z-H-9.html" "%_idx_260")
|
||||
("/" #f "r5rs-Z-H-9.html" "%_idx_296")
|
||||
;;("/" #f "r5rs-Z-H-9.html" "%_idx_294")
|
||||
;;("/" #f "r5rs-Z-H-9.html" "%_idx_292")
|
||||
("-" #f "r5rs-Z-H-9.html" "%_idx_290")
|
||||
;;("-" #f "r5rs-Z-H-9.html" "%_idx_288")
|
||||
;;("-" #f "r5rs-Z-H-9.html" "%_idx_286")
|
||||
("+" #f "r5rs-Z-H-9.html" "%_idx_282")
|
||||
("*" #f "r5rs-Z-H-9.html" "%_idx_284")))
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
(error 'help
|
||||
"no documentation found for: ~e provided by: ~a"
|
||||
(syntax-e id)
|
||||
(module-path-index-resolve (caddr b)))))
|
||||
(module-path-index-resolve (caddr (or lb b))))))
|
||||
(search-for-exports xref (syntax-e id)))))
|
||||
|
||||
(define (search-for-exports xref sym)
|
||||
|
|
|
@ -111,10 +111,16 @@
|
|||
(unless (null? parts)
|
||||
(let ([s (car parts)])
|
||||
(collect-part s d p-ci
|
||||
(cons (if (unnumbered-part? s) #f pos)
|
||||
(cons (if (or (unnumbered-part? s)
|
||||
(part-style? s 'unnumbered))
|
||||
#f
|
||||
pos)
|
||||
number))
|
||||
(loop (cdr parts)
|
||||
(if (unnumbered-part? s) pos (add1 pos))))))
|
||||
(if (or (unnumbered-part? s)
|
||||
(part-style? s 'unnumbered))
|
||||
pos
|
||||
(add1 pos))))))
|
||||
(let ([prefix (part-tag-prefix d)])
|
||||
(for ([(k v) (collect-info-ht p-ci)])
|
||||
(when (cadr k)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
setup/main-collects
|
||||
mzlib/list
|
||||
net/url
|
||||
scheme/serialize
|
||||
(prefix-in xml: xml/xml)
|
||||
(for-syntax scheme/base))
|
||||
(provide render-mixin
|
||||
|
@ -49,23 +50,27 @@
|
|||
;; (i.e., the ones that are not allowed as-in in URI
|
||||
;; codecs) by using "~" followed by a hex encoding.
|
||||
(define (anchor-name v)
|
||||
(let loop ([s (format "~a" v)])
|
||||
(cond
|
||||
[(regexp-match-positions #rx"[A-Z.]" s)
|
||||
=> (lambda (m)
|
||||
(string-append
|
||||
(loop (substring s 0 (caar m)))
|
||||
"."
|
||||
(substring s (caar m) (cdar m))
|
||||
(loop (substring s (cdar m)))))]
|
||||
[(regexp-match-positions #rx"[^-a-zA-Z0-9_!*'().]" s)
|
||||
=> (lambda (m)
|
||||
(string-append
|
||||
(substring s 0 (caar m))
|
||||
"~"
|
||||
(format "~x" (char->integer (string-ref s (caar m))))
|
||||
(loop (substring s (cdar m)))))]
|
||||
[else s])))
|
||||
(if (literal-anchor? v)
|
||||
(literal-anchor-string v)
|
||||
(let loop ([s (format "~a" v)])
|
||||
(cond
|
||||
[(regexp-match-positions #rx"[A-Z.]" s)
|
||||
=> (lambda (m)
|
||||
(string-append
|
||||
(loop (substring s 0 (caar m)))
|
||||
"."
|
||||
(substring s (caar m) (cdar m))
|
||||
(loop (substring s (cdar m)))))]
|
||||
[(regexp-match-positions #rx"[^-a-zA-Z0-9_!*'().]" s)
|
||||
=> (lambda (m)
|
||||
(string-append
|
||||
(substring s 0 (caar m))
|
||||
"~"
|
||||
(format "~x" (char->integer (string-ref s (caar m))))
|
||||
(loop (substring s (cdar m)))))]
|
||||
[else s]))))
|
||||
|
||||
(define-serializable-struct literal-anchor (string))
|
||||
|
||||
(define literal
|
||||
(let ([loc (xml:make-location 0 0 0)])
|
||||
|
@ -229,10 +234,18 @@
|
|||
(let ([key (generate-tag (target-element-tag i) ci)])
|
||||
(collect-put! ci
|
||||
key
|
||||
(vector (path->relative (current-output-file))
|
||||
#f
|
||||
(vector (path->relative (let ([p (current-output-file)])
|
||||
(if (redirect-target-element? i)
|
||||
(let-values ([(base name dir?) (split-path p)])
|
||||
(build-path
|
||||
base
|
||||
(redirect-target-element-alt-path i)))
|
||||
p)))
|
||||
#f
|
||||
(page-target-element? i)
|
||||
key))))
|
||||
(if (redirect-target-element? i)
|
||||
(make-literal-anchor (redirect-target-element-alt-anchor i))
|
||||
key)))))
|
||||
|
||||
(define (dest-path dest)
|
||||
(if (vector? dest) ; temporary
|
||||
|
|
|
@ -68,7 +68,8 @@
|
|||
(if no-number?
|
||||
"*"
|
||||
""))
|
||||
(when (not (part-style? d 'hidden))
|
||||
(when (not (or (part-style? d 'hidden)
|
||||
no-number?))
|
||||
(printf "[")
|
||||
(parameterize ([disable-images #t])
|
||||
(render-content (part-title-content d) d ri))
|
||||
|
|
|
@ -437,6 +437,55 @@
|
|||
(lambda () (car content))
|
||||
(lambda () (car content))))))
|
||||
|
||||
|
||||
(define (make-binding-redirect-elements mod-path redirects)
|
||||
(let ([taglet (path->main-collects-relative
|
||||
(resolved-module-path-name
|
||||
(module-path-index-resolve
|
||||
(module-path-index-join mod-path #f))))])
|
||||
(make-element
|
||||
#f
|
||||
(map
|
||||
(lambda (redirect)
|
||||
(let ([id (car redirect)]
|
||||
[form? (cadr redirect)]
|
||||
[path (caddr redirect)]
|
||||
[anchor (cadddr redirect)])
|
||||
(let ([make-one
|
||||
(lambda (kind)
|
||||
(make-redirect-target-element
|
||||
#f
|
||||
null
|
||||
(list kind (list taglet id))
|
||||
path
|
||||
anchor))])
|
||||
(make-element
|
||||
#f
|
||||
(list (make-one (if form? 'form 'def))
|
||||
(make-one 'dep)
|
||||
(make-index-element #f
|
||||
null
|
||||
(list (if form? 'form 'def)
|
||||
(list taglet id))
|
||||
(list (symbol->string id))
|
||||
(list
|
||||
(make-element
|
||||
"schemesymbol"
|
||||
(list
|
||||
(make-element
|
||||
(if form?
|
||||
"schemesyntaxlink"
|
||||
"schemevaluelink")
|
||||
(list (symbol->string id))))))
|
||||
((if form?
|
||||
make-form-index-desc
|
||||
make-procedure-index-desc)
|
||||
id
|
||||
(list mod-path))))))))
|
||||
redirects))))
|
||||
|
||||
(provide make-binding-redirect-elements)
|
||||
|
||||
(define current-signature (make-parameter #f))
|
||||
|
||||
(define-syntax-rule (sigelem sig elem)
|
||||
|
|
|
@ -159,6 +159,8 @@
|
|||
[(target-element element) ([tag tag?])]
|
||||
[(toc-target-element target-element) ()]
|
||||
[(page-target-element target-element) ()]
|
||||
[(redirect-target-element target-element) ([alt-path path-string?]
|
||||
[alt-anchor string?])]
|
||||
[(link-element element) ([tag tag?])]
|
||||
[(index-element element) ([tag tag?]
|
||||
[plain-seq (listof string?)]
|
||||
|
|
3
collects/srfi/info.ss
Normal file
|
@ -0,0 +1,3 @@
|
|||
#lang setup/infotab
|
||||
|
||||
(define scribblings '(("srfi.scrbl" (multi-page))))
|
898
collects/srfi/srfi.scrbl
Normal file
|
@ -0,0 +1,898 @@
|
|||
#lang scribble/doc
|
||||
@(require scribble/manual
|
||||
(for-syntax scheme/base))
|
||||
|
||||
@(define-syntax (srfi stx)
|
||||
(syntax-case stx ()
|
||||
[(_ num #:subdir dir . title)
|
||||
(with-syntax ([srfi/n (string->symbol
|
||||
(format "srfi/~a" (syntax-e #'num)))])
|
||||
#'(begin
|
||||
(section #:tag (format "srfi-~a" num)
|
||||
#:style 'unnumbered
|
||||
(format "SRFI ~a: " num)
|
||||
. title)
|
||||
(defmodule srfi/n)
|
||||
"Original specification: " @link[(format "../srfi-std/~asrfi-~a.html" dir num)
|
||||
"SRFI "
|
||||
(number->string num)]))]
|
||||
[(_ num . title) #'(srfi num #:subdir "" . title)]))
|
||||
|
||||
@;{ The `lst' argument is a list of
|
||||
(list sym syntactic-form? html-anchor) }
|
||||
@(define (redirect n lst)
|
||||
(let ([file (format "srfi-~a.html" n)]
|
||||
[mod-path (string->symbol (format "srfi/~a" n))])
|
||||
(make-binding-redirect-elements mod-path
|
||||
(map (lambda (b)
|
||||
(list (car b) (cadr b)
|
||||
(build-path 'up "srfi-std" file)
|
||||
(caddr b)))
|
||||
lst))))
|
||||
|
||||
@(define in-core
|
||||
(case-lambda
|
||||
[() (in-core ".")]
|
||||
[(k)
|
||||
@elem{This SRFI's bindings are also available in @schememodname[scheme/base]@|k|}]))
|
||||
|
||||
@; ----------------------------------------------------------------------
|
||||
|
||||
@title{@bold{SRFIs}: Libraries}
|
||||
|
||||
The @link["http://srfi.schemers.org/"]{Scheme Requests for
|
||||
Implementation} (a.k.a. @deftech{SRFI}) process allows the Scheme
|
||||
community as a whole to propose extensions of Scheme to be supported
|
||||
by multiple implementations.
|
||||
|
||||
PLT Scheme is distributed with implementations of many SRFIs, most of
|
||||
which can be implemented as libraries. To import the bindings of SRFI
|
||||
@math{n}, use
|
||||
|
||||
@schemeblock[
|
||||
(require #, @elem{@schemeidfont{srfi/}@math{n}})
|
||||
]
|
||||
|
||||
This document lists the SRFIs that are supported by PLT Scheme and
|
||||
provides a link to the original SRFI specification (which is also
|
||||
distributed as part of PLT Scheme's documentation).
|
||||
|
||||
@table-of-contents[]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[1]{List Library}
|
||||
|
||||
@redirect[1 '(
|
||||
(cons #f "cons")
|
||||
(list #f "list")
|
||||
(xcons #f "xcons")
|
||||
(cons* #f "cons*")
|
||||
(make-list #f "make-list")
|
||||
(list-tabulate #f "list-tabulate")
|
||||
(list-copy #f "list-copy")
|
||||
(circular-list #f "circular-list")
|
||||
(iota #f "iota")
|
||||
(pair? #f "pair-p")
|
||||
(null? #f "null-p")
|
||||
(proper-list? #f "proper-list-p")
|
||||
(circular-list? #f "circular-list-p")
|
||||
(dotted-list? #f "dotted-list-p")
|
||||
(not-pair? #f "not-pair-p")
|
||||
(null-list? #f "null-list-p")
|
||||
(car #f "car")
|
||||
(cdr #f "cdr")
|
||||
(cddadr #f "cddadr")
|
||||
(cddddr #f "cddddr")
|
||||
(list-ref #f "list-ref")
|
||||
(first #f "first")
|
||||
(second #f "second")
|
||||
(third #f "third")
|
||||
(fourth #f "fourth")
|
||||
(fifth #f "fifth")
|
||||
(sixth #f "sixth")
|
||||
(seventh #f "seventh")
|
||||
(eighth #f "eighth")
|
||||
(ninth #f "ninth")
|
||||
(tenth #f "tenth")
|
||||
(car+cdr #f "car+cdr")
|
||||
(take #f "take")
|
||||
(drop #f "drop")
|
||||
(take-right #f "take-right")
|
||||
(drop-right #f "drop-right")
|
||||
(take! #f "take!")
|
||||
(drop-right! #f "drop-right!")
|
||||
(split-at #f "split-at")
|
||||
(split-at! #f "split-at!")
|
||||
(last #f "last")
|
||||
(last-pair #f "last-pair")
|
||||
(length #f "length")
|
||||
(length+ #f "length+")
|
||||
(append #f "append")
|
||||
(append! #f "append!")
|
||||
(concatenate #f "concatenate")
|
||||
(concatenate! #f "concatenate!")
|
||||
(reverse #f "reverse")
|
||||
(reverse! #f "srfi-1.html")
|
||||
(append-reverse #f "append-reverse")
|
||||
(append-reverse! #f "append-reverse!")
|
||||
(zip #f "zip")
|
||||
(unzip1 #f "unzip1")
|
||||
(unzip2 #f "unzip2")
|
||||
(unzip3 #f "unzip3")
|
||||
(unzip4 #f "unzip4")
|
||||
(unzip5 #f "unzip5")
|
||||
(count #f "count")
|
||||
(fold #f "fold")
|
||||
(fold-right #f "fold-right")
|
||||
(pair-fold #f "pair-fold")
|
||||
(pair-fold-right #f "pair-fold-right")
|
||||
(reduce #f "reduce")
|
||||
(reduce-right #f "reduce-right")
|
||||
(unfold #f "unfold")
|
||||
(map #f "map")
|
||||
(for-each #f "srfi-1.html")
|
||||
(append-map #f "append-map")
|
||||
(append-map! #f "append-map!")
|
||||
(map! #f "map!")
|
||||
(map-in-order #f "map-in-order")
|
||||
(pair-for-each #f "pair-for-each")
|
||||
(filter-map #f "filter-map")
|
||||
(filter #f "filter")
|
||||
(filter! #f "filter!")
|
||||
(partition! #f "partition!")
|
||||
(remove! #f "remove!")
|
||||
(remove #f "remove")
|
||||
(partition #f "partition")
|
||||
(find #f "find")
|
||||
(find-tail #f "find-tail")
|
||||
(take-while #f "take-while")
|
||||
(take-while! #f "take-while!")
|
||||
(drop-while #f "drop-while")
|
||||
(span #f "span")
|
||||
(span! #f "span!")
|
||||
(break #f "break")
|
||||
(break! #f "break!")
|
||||
(any #f "any")
|
||||
(every #f "every")
|
||||
(list-index #f "list-index")
|
||||
(member #f "member")
|
||||
(memq #f "memq")
|
||||
(memv #f "memv")
|
||||
(delete #f "delete")
|
||||
(delete-duplicates #f "delete-duplicates")
|
||||
(delete! #f "delete!")
|
||||
(delete-duplicates! #f "delete-duplicates!")
|
||||
(assoc #f "assoc")
|
||||
(assq #f "assq")
|
||||
(assv #f "assv")
|
||||
(alist-cons #f "alist-cons")
|
||||
(alist-copy #f "alist-copy")
|
||||
(alist-delete #f "alist-delete")
|
||||
(alist-delete! #f "alist-delete!")
|
||||
(lset #f "lset")
|
||||
(lset= #f "lset=")
|
||||
(lset-adjoin #f "lset-adjoin")
|
||||
(lset-union #f "lset-union")
|
||||
(lset-intersection #f "lset-intersection")
|
||||
(lset-intersection! #f "lset-intersection!")
|
||||
(lset-union! #f "lset-union!")
|
||||
(lset-difference! #f "lset-difference!")
|
||||
(lset-xor! #f "lset-xor!")
|
||||
(lset-diff+intersection! #f "lset-diff+intersection!")
|
||||
(lset-difference #f "lset-difference")
|
||||
(lset-xor #f "lset-xor")
|
||||
(lset-diff+intersection #f "lset-diff+intersection")
|
||||
(set-car! #f "set-car!")
|
||||
(set-cdr! #f "set-cdr!")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[2]{AND-LET*: an AND with local bindings...}
|
||||
|
||||
@redirect[2 '(
|
||||
(and-let* #t "and-let")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[4]{Homogeneous numeric vector datatypes}
|
||||
|
||||
@redirect[4 '(
|
||||
(s8vector #f "s8vector")
|
||||
(u8vector #f "s8vector")
|
||||
(s16vector #f "s8vector")
|
||||
(u16vector #f "u8vector")
|
||||
(s32vector #f "s16vector")
|
||||
(u32vector #f "u16vector")
|
||||
(s64vector #f "s64vector")
|
||||
(u64vector #f "u64vector")
|
||||
(f32vector #f "f32vector")
|
||||
(f64vector #f "f64vector")
|
||||
)]
|
||||
|
||||
This SRFI's reader and printer syntax is not supported. The bindings
|
||||
are also available from @schememodname[scheme/foreign].
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[5]{A compatible let form with signatures and rest arguments}
|
||||
|
||||
@redirect[5 '(
|
||||
(let #t "unnamed")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[6]{Basic String Ports}
|
||||
|
||||
@redirect[6 '(
|
||||
(open-input-string #f "open-input-string")
|
||||
(open-output-string #f "open-output-string")
|
||||
(get-output-string #f "get-output-string")
|
||||
)]
|
||||
|
||||
@in-core[]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[7]{Feature-based program configuration language}
|
||||
|
||||
@redirect[7 '(
|
||||
(program #t "program")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[8]{RECEIVE: Binding to multiple values}
|
||||
|
||||
@redirect[8 '(
|
||||
(receive #t "receive")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[9]{Defining Record Types}
|
||||
|
||||
@redirect[9 '(
|
||||
(define-record-type #t "define-record-type")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[11]{Syntax for receiving multiple values}
|
||||
|
||||
@redirect[11 '(
|
||||
(let-values #t "let-values")
|
||||
(let*-values #t "let*-values")
|
||||
)]
|
||||
|
||||
@in-core{, but without support for dotted ``rest'' bindings.}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[13]{String Libraries}
|
||||
|
||||
@redirect[13 '(
|
||||
(string? #f "string-p")
|
||||
(string-null? #f "string-null-p")
|
||||
(string-every #f "string-every")
|
||||
(string-any #f "string-any")
|
||||
(make-string #f "make-string")
|
||||
(string #f "string")
|
||||
(string-tabulate #f "string-tabulate")
|
||||
(string->list #f "string2list")
|
||||
(list->string #f "list2string")
|
||||
(reverse-list->string #f "reverse-list2string")
|
||||
(string-join #f "string-join")
|
||||
(string-length #f "string-length")
|
||||
(string-ref #f "string-ref")
|
||||
(string-copy #f "string-copy")
|
||||
(substring/shared #f "substring/shared")
|
||||
(string-copy! #f "string-copy!")
|
||||
(string-take #f "string-take")
|
||||
(string-drop #f "string-drop")
|
||||
(string-take-right #f "string-take-right")
|
||||
(string-drop-right #f "string-drop-right")
|
||||
(string-pad #f "string-pad")
|
||||
(string-pad-right #f "string-pad-right")
|
||||
(string-trim #f "string-trim")
|
||||
(string-trim-right #f "string-trim-right")
|
||||
(string-trim-both #f "string-trim-both")
|
||||
(string-set! #f "string-set!")
|
||||
(string-fill! #f "string-fill!")
|
||||
(string-compare #f "string-compare")
|
||||
(string-compare-ci #f "string-compare-ci")
|
||||
(string= #f "string=")
|
||||
(string<> #f "string<>")
|
||||
(string< #f "string<")
|
||||
(string> #f "string>")
|
||||
(string<= #f "string<=")
|
||||
(string>= #f "string>=")
|
||||
(string-ci= #f "string-ci=")
|
||||
(string-ci<> #f "string-ci<>")
|
||||
(string-ci< #f "string-ci<")
|
||||
(string-ci> #f "string-ci>")
|
||||
(string-ci<= #f "string-ci<=")
|
||||
(string-ci>= #f "string-ci>=")
|
||||
(string-hash #f "string-hash")
|
||||
(string-hash-ci #f "string-hash-ci")
|
||||
(string-prefix-length #f "string-prefix-length")
|
||||
(string-suffix-length #f "string-suffix-length")
|
||||
(string-prefix-length-ci #f "string-prefix-length-ci")
|
||||
(string-suffix-length-ci #f "string-suffix-length-ci")
|
||||
(string-prefix? #f "string-prefix-p")
|
||||
(string-suffix? #f "string-suffix-p")
|
||||
(string-prefix-ci? #f "string-prefix-ci-p")
|
||||
(string-suffix-ci? #f "string-suffix-ci-p")
|
||||
(string-index #f "string-index")
|
||||
(string-index-right #f "string-index-right")
|
||||
(string-skip #f "string-skip")
|
||||
(string-skip-right #f "string-skip-right")
|
||||
(string-count #f "string-count")
|
||||
(string-contains #f "string-contains")
|
||||
(string-contains-ci #f "string-contains-ci")
|
||||
(string-titlecase #f "string-titlecase")
|
||||
(string-titlecase! #f "string-titlecase!")
|
||||
(string-upcase #f "string-upcase")
|
||||
(string-upcase! #f "string-upcase!")
|
||||
(string-downcase #f "string-downcase")
|
||||
(string-downcase! #f "string-downcase!")
|
||||
(string-reverse #f "string-reverse")
|
||||
(string-reverse! #f "string-reverse!")
|
||||
(string-append #f "string-append")
|
||||
(string-concatenate #f "string-concatenate")
|
||||
(string-concatenate/shared #f "string-concatenate/shared")
|
||||
(string-append/shared #f "string-append/shared")
|
||||
(string-concatenate-reverse #f "string-concatenate-reverse")
|
||||
(string-concatenate-reverse/shared #f "string-concatenate-reverse/shared")
|
||||
(string-map #f "string-map")
|
||||
(string-map! #f "string-map!")
|
||||
(string-fold #f "string-fold")
|
||||
(string-fold-right #f "string-fold-right")
|
||||
(string-unfold #f "string-unfold")
|
||||
(string-unfold-right #f "string-unfold-right")
|
||||
(string-for-each #f "string-for-each")
|
||||
(string-for-each-index #f "string-for-each-index")
|
||||
(xsubstring #f "xsubstring")
|
||||
(string-xcopy! #f "string-xcopy!")
|
||||
(string-replace #f "string-replace")
|
||||
(string-tokenize #f "string-tokenize")
|
||||
(string-filter #f "string-filter")
|
||||
(string-delete #f "string-delete")
|
||||
(string-parse-start+end #f "string-parse-start+end")
|
||||
(string-parse-final-start+end #f "string-parse-final-start+end")
|
||||
(let-string-start+end #f "let-string-start+end")
|
||||
(check-substring-spec #f "check-substring-spec")
|
||||
(substring-spec-ok? #f "substring-spec-ok-p")
|
||||
(make-kmp-restart-vector #f "make-kmp-restart-vector")
|
||||
(kmp-step #f "kmp-step")
|
||||
(string-kmp-partial-search #f "string-kmp-partial-search")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[14]{Character-set Library}
|
||||
|
||||
@redirect[14 '(
|
||||
(char-set? #f "char-set-p")
|
||||
(char-set= #f "char-set=")
|
||||
(char-set<= #f "char-set<=")
|
||||
(char-set-hash #f "char-set-hash")
|
||||
(char-set-cursor #f "char-set-cursor")
|
||||
(char-set-ref #f "char-set-ref")
|
||||
(char-set-cursor-next #f "char-set-cursor-next")
|
||||
(end-of-char-set? #f "end-of-char-set-p")
|
||||
(char-set-fold #f "char-set-fold")
|
||||
(char-set-unfold #f "char-set-unfold")
|
||||
(char-set-unfold! #f "char-set-unfold!")
|
||||
(char-set-for-each #f "char-set-for-each")
|
||||
(char-set-map #f "char-set-map")
|
||||
(char-set-copy #f "char-set-copy")
|
||||
(char-set #f "char-set")
|
||||
(list->char-set #f "list->char-set")
|
||||
(list->char-set! #f "list->char-set!")
|
||||
(string->char-set #f "string->char-set")
|
||||
(string->char-set! #f "string->char-set!")
|
||||
(char-set-filter #f "char-set-filter")
|
||||
(char-set-filter! #f "char-set-filter!")
|
||||
(ucs-range->char-set #f "ucs-range->char-set")
|
||||
(ucs-range->char-set! #f "ucs-range->char-set!")
|
||||
(->char-set #f "->char-set")
|
||||
(char-set->list #f "char-set->list")
|
||||
(char-set->string #f "char-set->string")
|
||||
(char-set-size #f "char-set-size")
|
||||
(char-set-count #f "char-set-count")
|
||||
(char-set-every #f "char-set-every")
|
||||
(char-set-any #f "char-set-any")
|
||||
(char-set-contains? #f "char-set-contains-p")
|
||||
(char-set-adjoin #f "char-set-adjoin")
|
||||
(char-set-delete #f "char-set-delete")
|
||||
(char-set-adjoin! #f "char-set-adjoin!")
|
||||
(char-set-delete! #f "char-set-delete!")
|
||||
(char-set-complement #f "char-set-complement")
|
||||
(char-set-union #f "char-set-union")
|
||||
(char-set-intersection #f "char-set-intersection")
|
||||
(char-set-difference #f "char-set-difference")
|
||||
(char-set-xor #f "char-set-xor")
|
||||
(char-set-diff+intersection #f "char-set-diff+intersection")
|
||||
(char-set-complement! #f "char-set-complement!")
|
||||
(char-set-union! #f "char-set-union!")
|
||||
(char-set-intersection! #f "char-set-intersection!")
|
||||
(char-set-difference! #f "char-set-difference!")
|
||||
(char-set-xor! #f "char-set-xor!")
|
||||
(char-set-diff+intersection! #f "char-set-diff+intersection!")
|
||||
(char-set:lower-case #f "char-set:lower-case")
|
||||
(char-set:upper-case #f "char-set:upper-case")
|
||||
(char-set:title-case #f "char-set:title-case")
|
||||
(char-set:letter #f "char-set:letter")
|
||||
(char-set:digit #f "char-set:digit")
|
||||
(char-set:letter+digit #f "char-set:letter+digit")
|
||||
(char-set:graphic #f "char-set:graphic")
|
||||
(char-set:printing #f "char-set:printing")
|
||||
(char-set:whitespace #f "char-set:whitespace")
|
||||
(char-set:iso-control #f "char-set:iso-control")
|
||||
(char-set:punctuation #f "char-set:punctuation")
|
||||
(char-set:symbol #f "char-set:symbol")
|
||||
(char-set:hex-digit #f "char-set:hex-digit")
|
||||
(char-set:blank #f "char-set:blank")
|
||||
(char-set:ascii #f "char-set:ascii")
|
||||
(char-set:empty #f "char-set:empty")
|
||||
(char-set:full #f "char-set:full")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[16]{Syntax for procedures of variable arity}
|
||||
|
||||
@redirect[16 '(
|
||||
(case-lambda #t "case-lambda")
|
||||
)]
|
||||
|
||||
@in-core[]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[17]{Generalized set!}
|
||||
|
||||
@redirect[17 '(
|
||||
(set! #t "set!")
|
||||
(getter-with-setter #f "getter-with-setter")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[19]{Time Data Types and Procedures}
|
||||
|
||||
@redirect[19 '(
|
||||
(time-duration #f "")
|
||||
(time-monotonic #f "time-monotonic")
|
||||
(time-process #f "time-process")
|
||||
(time-tai #f "time-tai")
|
||||
(time-thread #f "time-thread")
|
||||
(time-utc #f "time-utc")
|
||||
(current-date #f "")
|
||||
(current-julian-day #f "current-julian-day")
|
||||
(current-modified-julian-day #f "current-modified-julian-day")
|
||||
(current-time #f "current-time")
|
||||
(time-resolution #f "time-resolution")
|
||||
(make-time #f "make-time")
|
||||
(time? #f "time-p")
|
||||
(time-type #f "time-type")
|
||||
(time-nanosecond #f "time-nanosecond")
|
||||
(time-second #f "time-second")
|
||||
(set-time-type! #f "set-time-type!")
|
||||
(set-time-nanosecond! #f "set-time-nanosecond!")
|
||||
(set-time-second! #f "set-time-second!")
|
||||
(copy-time #f "copy-time")
|
||||
(time<=? #f "time<=-p")
|
||||
(time<? #f "time<-p")
|
||||
(time=? #f "time=-p")
|
||||
(time>=? #f "time>=-p")
|
||||
(time>? #f "time>-p")
|
||||
(time-difference #f "time-difference")
|
||||
(time-difference! #f "time-difference!")
|
||||
(add-duration #f "add-duration")
|
||||
(add-duration! #f "add-duration!")
|
||||
(subtract-duration #f "subtract-duration")
|
||||
(subtract-duration! #f "subtract-duration!")
|
||||
(make-date #f "make-date")
|
||||
(date? #f "date-p")
|
||||
(date-nanosecond #f "date-nanosecond")
|
||||
(date-second #f "date-second")
|
||||
(date-minute #f "date-minute")
|
||||
(date-hour #f "date-hour")
|
||||
(date-day #f "date-day")
|
||||
(date-month #f "date-month")
|
||||
(date-year #f "date-year")
|
||||
(date-zone-offset #f "date-zone-offset")
|
||||
(date-year-day #f "date-year-day")
|
||||
(date-week-day #f "date-week-day")
|
||||
(date-week-number #f "date-week-number")
|
||||
(date->julian-day #f "date->julian-day")
|
||||
(date->modified-julian-day #f "date->modified-julian-day")
|
||||
(date->time-monotonic #f "date->time-monotonic")
|
||||
(date->time-tai #f "date->time-tai")
|
||||
(date->time-utc #f "date->time-utc")
|
||||
(julian-day->date #f "julian-day->date")
|
||||
(julian-day->time-monotonic #f "julian-day->time-monotonic")
|
||||
(julian-day->time-tai #f "julian-day->time-tai")
|
||||
(julian-day->time-utc #f "julian-day->time-utc")
|
||||
(modified-julian-day->date #f "modified-julian-day->date")
|
||||
(modified-julian-day->time-monotonic #f "modified-julian-day->time-monotonic")
|
||||
(modified-julian-day->time-tai #f "modified-julian-day->time-tai")
|
||||
(modified-julian-day->time-utc #f "modified-julian-day->time-utc")
|
||||
(time-monotonic->date #f "time-monotonic->date")
|
||||
(time-monotonic->julian-day #f "time-monotonic->julian-day")
|
||||
(time-monotonic->modified-julian-day #f "time-monotonic->modified-julian-day")
|
||||
(time-monotonic->time-tai #f "time-monotonic->time-tai")
|
||||
(time-monotonic->time-tai! #f "time-monotonic->time-tai!")
|
||||
(time-monotonic->time-utc #f "time-monotonic->time-utc")
|
||||
(time-monotonic->time-utc! #f "time-monotonic->time-utc!")
|
||||
(time-tai->date #f "time-tai->date")
|
||||
(time-tai->julian-day #f "time-tai->julian-day")
|
||||
(time-tai->modified-julian-day #f "time-tai->modified-julian-day")
|
||||
(time-tai->time-monotonic #f "time-tai->time-monotonic")
|
||||
(time-tai->time-monotonic! #f "time-tai->time-monotonic!")
|
||||
(time-tai->time-utc #f "time-tai->time-utc")
|
||||
(time-tai->time-utc! #f "time-tai->time-utc!")
|
||||
(time-utc->date #f "time-utc->date")
|
||||
(time-utc->julian-day #f "time-utc->julian-day")
|
||||
(time-utc->modified-julian-day #f "time-utc->modified-julian-day")
|
||||
(time-utc->time-monotonic #f "time-utc->time-monotonic")
|
||||
(time-utc->time-monotonic! #f "time-utc->time-monotonic!")
|
||||
(time-utc->time-tai #f "time-utc->time-tai")
|
||||
(time-utc->time-tai! #f "time-utc->time-tai!")
|
||||
(date->string #f "date->string")
|
||||
(string->date #f "string->date")
|
||||
)]
|
||||
|
||||
Care most be taken NOT to confuse the internal date structure with the
|
||||
PLT Scheme @scheme[date]; they are not the same, and all procedures
|
||||
from the SRFI library expect the former.
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[23]{Error reporting mechanism}
|
||||
|
||||
@redirect[23 '(
|
||||
(error #f "error")
|
||||
)]
|
||||
|
||||
@in-core[]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[25]{Multi-dimensional Array Primitives}
|
||||
|
||||
@redirect[25 '(
|
||||
(array? #f "array-p")
|
||||
(make-array #f "make-array")
|
||||
(shape #f "shape")
|
||||
(array #f "array")
|
||||
(array-rank #f "array-rank")
|
||||
(array-start #f "array-start")
|
||||
(array-end #f "array-end")
|
||||
(array-ref #f "array-ref")
|
||||
(array-set! #f "array-set!")
|
||||
(share-array #f "share-array")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[26]{Notation for Specializing Parameters without Currying}
|
||||
|
||||
@redirect[26 '(
|
||||
(cut #t "cut")
|
||||
(cute #t "cute")
|
||||
)]
|
||||
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[27]{Sources of Random Bits}
|
||||
|
||||
@redirect[27 '(
|
||||
(random-integer #f "random-integer")
|
||||
(random-real #f "random-real")
|
||||
(default-random-source #f "default-random-source")
|
||||
(make-random-source #f "make-random-source")
|
||||
(random-source? #f "random-source-p")
|
||||
(random-source-state-ref #f "random-source-state-ref")
|
||||
(random-source-state-ref! #f "random-source-state-ref")
|
||||
(random-source-randomize! #f "random-source-randomize!")
|
||||
(random-source-pseudo-randomize! #f "random-source-pseudo-randomize!")
|
||||
(random-source-make-integers #f "random-source-make-integers")
|
||||
(random-source-make-reals #f "random-source-make-reals")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[28]{Basic Format Strings}
|
||||
|
||||
@redirect[28 '(
|
||||
(format #f "format")
|
||||
)]
|
||||
|
||||
@in-core[]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[29]{Localization}
|
||||
|
||||
@redirect[29 '(
|
||||
(current-language #f "current-language")
|
||||
(current-country #f "current-country")
|
||||
(current-locale-details #f "current-locale-details")
|
||||
(declare-bundle! #f "declare-bundle!")
|
||||
(store-bundle #f "store-bundle")
|
||||
(load-bundle! #f "load-bundle!")
|
||||
(localized-template #f "localized-template")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[30]{Nested Multi-line Comments}
|
||||
|
||||
This SRFI's syntax is part of PLT Scheme's default reader.
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[31]{A special form rec for recursive evaluation}
|
||||
|
||||
@redirect[31 '(
|
||||
(rec #t "rec")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[34]{Exception Handling for Programs}
|
||||
|
||||
@redirect[34 '(
|
||||
(with-exception-handler #f "with-exception-handler")
|
||||
(guard #t "guard")
|
||||
(raise #f "raise")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[35]{Conditions}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[38]{External Representation for Data With Shared Structure}
|
||||
|
||||
@redirect[38 '(
|
||||
(write-with-shared-structure #f "write-with-shared-structure")
|
||||
(read-with-shared-structure #f "read-with-shared-structure")
|
||||
)]
|
||||
|
||||
This SRFI's syntax is part of PLT Scheme's default reader and printer.
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[39]{Parameter objects}
|
||||
|
||||
@redirect[39 '(
|
||||
(make-parameter #f "make-parameter")
|
||||
(parameterize #t "parameterize")
|
||||
)]
|
||||
|
||||
@in-core[]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[40]{A Library of Streams}
|
||||
|
||||
@redirect[40 '(
|
||||
(stream-cons #t "stream-cons")
|
||||
(stream? #f "stream?")
|
||||
(stream-null? #f "stream-null?")
|
||||
(stream-car #f "stream-car")
|
||||
(stream-cdr #f "stream-cdr")
|
||||
(stream-delay #t "stream-delay")
|
||||
(stream-null #f "stream-null")
|
||||
(stream #f "stream")
|
||||
(stream-unfoldn #f "stream-unfoldn")
|
||||
(stream-map #f "stream-map")
|
||||
(stream-for-each #f "stream-for-each")
|
||||
(stream-filter #f "stream-filter")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[42]{Eager Comprehensions}
|
||||
|
||||
@redirect[42 '(
|
||||
(do-ec #t "do-ec")
|
||||
(list-ec #t "list-ec")
|
||||
(append-ec #t "append-ec")
|
||||
(string-ec #t "string-ec")
|
||||
(string-append-ec #t "string-append-ec")
|
||||
(vector-ec #t "vector-ec")
|
||||
(vector-of-length-ec #t "vector-of-length-ec")
|
||||
(sum-ec #t "sum-ec")
|
||||
(product-ec #t "product-ec")
|
||||
(min-ec #t "min-ec")
|
||||
(max-ec #t "max-ec")
|
||||
(any?-ec #t "any?-ec")
|
||||
(every?-ec #t "every?-ec")
|
||||
(first-ec #t "first-ec")
|
||||
(last-ec #t "last-ec")
|
||||
(fold-ec #t "fold-ec")
|
||||
(fold3-ec #t "fold3-ec")
|
||||
(generator #t "generator")
|
||||
(if #t "if")
|
||||
(not #t "not")
|
||||
(and #t "and")
|
||||
(or #t "or")
|
||||
(begin #t "begin")
|
||||
(nested #t "nested")
|
||||
(: #t ":")
|
||||
(:list #t ":list")
|
||||
(:string #t ":string")
|
||||
(:vector #t ":vector")
|
||||
(:integers #t ":integers")
|
||||
(:range #t ":range")
|
||||
(:real-range #t ":real-range")
|
||||
(:char-range #t ":char-range")
|
||||
(:port #t ":port")
|
||||
(:dispatched #t "")
|
||||
(:generator-proc #t ":generator-proc")
|
||||
(:do #t ":do")
|
||||
(:let #t ":let")
|
||||
(:parallel #t ":parallel")
|
||||
(:while #t ":while")
|
||||
(:until #t ":until")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[43]{Vector Library}
|
||||
|
||||
@redirect[43 '(
|
||||
(make-vector #f "make-vector")
|
||||
(vector #f "vector")
|
||||
(vector-unfold #f "vector-unfold")
|
||||
(vector-unfold-right #f "vector-unfold-right")
|
||||
(vector-copy #f "vector-copy")
|
||||
(vector-reverse-copy #f "vector-reverse-copy")
|
||||
(vector-append #f "vector-append")
|
||||
(vector-concatenate #f "vector-concatenate")
|
||||
(vector? #f "vector-p")
|
||||
(vector-empty? #f "vector-empty?")
|
||||
(vector= #f "vector-eq")
|
||||
(vector-ref #f "vector-ref")
|
||||
(vector-length #f "vector-length")
|
||||
(vector-fold #f "vector-fold")
|
||||
(vector-fold-right #f "vector-fold-right")
|
||||
(vector-map #f "vector-map")
|
||||
(vector-map! #f "vector-map-bang")
|
||||
(vector-for-each #f "vector-for-each")
|
||||
(vector-count #f "vector-count")
|
||||
(vector-index #f "vector-index")
|
||||
(vector-index-right #f "vector-index-right")
|
||||
(vector-skip #f "vector-skip")
|
||||
(vector-skip-right #f "vector-skip-right")
|
||||
(vector-binary-search #f "vector-binary-search")
|
||||
(vector-any #f "vector-any")
|
||||
(vector-every #f "vector-every")
|
||||
(vector-set! #f "vector-set-bang")
|
||||
(vector-swap! #f "vector-swap-bang")
|
||||
(vector-fill! #f "vector-fill-bang")
|
||||
(vector-reverse! #f "vector-reverse-bang")
|
||||
(vector-copy! #f "vector-copy-bang")
|
||||
(vector-reverse-copy! #f "vector-reverse-copy-bang")
|
||||
(vector->list #f "vector->list")
|
||||
(reverse-vector->list #f "reverse-vector->list")
|
||||
(list->vector #f "list->vector")
|
||||
(reverse-list->vector #f "reverse-list->vector")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[45]{Primitives for Expressing Iterative Lazy Algorithms}
|
||||
|
||||
@redirect[45 '(
|
||||
(delay #t "delay")
|
||||
(lazy #t "lazy")
|
||||
(force #f "force")
|
||||
(eager #f "eager")
|
||||
)]
|
||||
|
||||
Additional binding:
|
||||
|
||||
@defproc[(promise? [v any/c]) boolean?]{
|
||||
Returns @scheme[#t] if @scheme[v] is a promise, @scheme[#f] otherwise.}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[48]{Intermediate Format Strings}
|
||||
|
||||
@redirect[48 '(
|
||||
(format #f "format")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[54]{Formatting}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[57]{Records}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[59]{Vicinity}
|
||||
|
||||
@redirect[59 '(
|
||||
(program-vicinity #f "program-vicinity")
|
||||
(library-vicinity #f "library-vicinity")
|
||||
(implementation-vicinity #f "implementation-vicinity")
|
||||
(user-vicinity #f "user-vicinity")
|
||||
(home-vicinity #f "home-vicinity")
|
||||
(in-vicinity #f "in-vicinity")
|
||||
(sub-vicinity #f "sub-vicinity")
|
||||
(make-vicinity #f "make-vicinity")
|
||||
(pathname->vicinity #f "pathname-to-vicinity")
|
||||
(vicinity:suffix? #f "vicinity:suffix-p")
|
||||
)]
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[60]{Integers as Bits}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[61]{A more general cond clause}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[62]{S-expression comments}
|
||||
|
||||
This SRFI's syntax is part of PLT Scheme's default reader.
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[63]{Homogeneous and Heterogeneous Arrays}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[64]{A Scheme API for test suites}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[66]{Octet Vectors}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[67 #:subdir "srfi-67/"]{Compare Procedures}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[69]{Basic hash tables}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[71]{Extended LET-syntax for multiple values}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[74]{Octet-Addressed Binary Blocks}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[78]{Lightweight testing}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[86]{MU & NU simulating VALUES & CALL-WITH-VALUES...}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@srfi[87]{=> in case clauses}
|
||||
|
||||
@; ----------------------------------------
|
||||
|
||||
@index-section[]
|
343
doc/r5rs-std/index.html
Normal file
|
@ -0,0 +1,343 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="index,follow">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=center>
|
||||
<h1><br><br>Revised<sup>5</sup> Report on the Algorithmic Language Scheme</h1>
|
||||
<p>
|
||||
20 February 1998<br>
|
||||
<br>
|
||||
Richard Kelsey, William Clinger, and Jonathan Rees (<i>Editors</i>)<br>
|
||||
<br>
|
||||
<table width=100%>
|
||||
<tr><td>H. Abelson </td><td> R. K. Dybvig </td><td> C. T. Haynes </td><td> G. J. Rozas</td></tr>
|
||||
<tr><td>N. I. Adams IV </td><td> D. P. Friedman </td><td> E. Kohlbecker </td><td> G. L. Steele Jr.</td></tr>
|
||||
<tr><td>D. H. Bartley </td><td> R. Halstead </td><td> D. Oxley </td><td> G. J. Sussman</td></tr>
|
||||
<tr><td>G. Brooks </td><td> C. Hanson </td><td> K. M. Pitman </td><td> M. Wand</td></tr>
|
||||
</table><br>
|
||||
<em>Dedicated to the Memory of Robert Hieb</em>
|
||||
</p>
|
||||
<p></div>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span class=disable>first, previous</span><span><span class=disable>, </span><a href="r5rs-Z-H-1.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
102
doc/r5rs-std/r5rs-Z-C.css
Normal file
|
@ -0,0 +1,102 @@
|
|||
|
||||
|
||||
body {
|
||||
color: black;
|
||||
/*background-color: #e5e5e5; */
|
||||
/*background-color: beige;*/
|
||||
margin-top: 2em;
|
||||
margin-left: 8%;
|
||||
margin-right: 8%;
|
||||
}
|
||||
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
margin-top: .5em;
|
||||
}
|
||||
|
||||
.partheading {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.chapterheading {
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
pre {
|
||||
margin-left: 2em;
|
||||
}
|
||||
|
||||
ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
|
||||
ol ol {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
|
||||
ol ol ol {
|
||||
list-style-type: lower-roman;
|
||||
}
|
||||
|
||||
ol ol ol ol {
|
||||
list-style-type: upper-alpha;
|
||||
}
|
||||
|
||||
.scheme {
|
||||
color: brown;
|
||||
}
|
||||
|
||||
.scheme .keyword {
|
||||
color: #990000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.scheme .builtin {
|
||||
color: #990000;
|
||||
}
|
||||
|
||||
.scheme .variable {
|
||||
color: navy;
|
||||
}
|
||||
|
||||
.scheme .global {
|
||||
color: purple;
|
||||
}
|
||||
|
||||
.scheme .selfeval {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.scheme .comment {
|
||||
color: teal;
|
||||
}
|
||||
|
||||
.schemeresponse {
|
||||
color: green;
|
||||
}
|
||||
|
||||
.navigation {
|
||||
color: red;
|
||||
text-align: right;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.disable {
|
||||
/* color: #e5e5e5; */
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.smallcaps {
|
||||
font-size: 75%;
|
||||
}
|
||||
|
||||
.smallprint {
|
||||
color: gray;
|
||||
font-size: 75%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.smallprint hr {
|
||||
text-align: left;
|
||||
width: 40%;
|
||||
}
|
||||
|
BIN
doc/r5rs-std/r5rs-Z-G-1.gif
Normal file
After Width: | Height: | Size: 47 B |
BIN
doc/r5rs-std/r5rs-Z-G-10.gif
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-11.gif
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-12.gif
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-13.gif
Normal file
After Width: | Height: | Size: 423 B |
BIN
doc/r5rs-std/r5rs-Z-G-14.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-15.gif
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-16.gif
Normal file
After Width: | Height: | Size: 4.0 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-17.gif
Normal file
After Width: | Height: | Size: 704 B |
BIN
doc/r5rs-std/r5rs-Z-G-18.gif
Normal file
After Width: | Height: | Size: 324 B |
BIN
doc/r5rs-std/r5rs-Z-G-19.gif
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-2.gif
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-20.gif
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-21.gif
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-22.gif
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-23.gif
Normal file
After Width: | Height: | Size: 519 B |
BIN
doc/r5rs-std/r5rs-Z-G-24.gif
Normal file
After Width: | Height: | Size: 927 B |
BIN
doc/r5rs-std/r5rs-Z-G-25.gif
Normal file
After Width: | Height: | Size: 936 B |
BIN
doc/r5rs-std/r5rs-Z-G-26.gif
Normal file
After Width: | Height: | Size: 1006 B |
BIN
doc/r5rs-std/r5rs-Z-G-27.gif
Normal file
After Width: | Height: | Size: 214 B |
BIN
doc/r5rs-std/r5rs-Z-G-28.gif
Normal file
After Width: | Height: | Size: 853 B |
BIN
doc/r5rs-std/r5rs-Z-G-29.gif
Normal file
After Width: | Height: | Size: 186 B |
BIN
doc/r5rs-std/r5rs-Z-G-3.gif
Normal file
After Width: | Height: | Size: 7.9 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-30.gif
Normal file
After Width: | Height: | Size: 461 B |
BIN
doc/r5rs-std/r5rs-Z-G-31.gif
Normal file
After Width: | Height: | Size: 383 B |
BIN
doc/r5rs-std/r5rs-Z-G-32.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-33.gif
Normal file
After Width: | Height: | Size: 427 B |
BIN
doc/r5rs-std/r5rs-Z-G-34.gif
Normal file
After Width: | Height: | Size: 331 B |
BIN
doc/r5rs-std/r5rs-Z-G-35.gif
Normal file
After Width: | Height: | Size: 986 B |
BIN
doc/r5rs-std/r5rs-Z-G-36.gif
Normal file
After Width: | Height: | Size: 511 B |
BIN
doc/r5rs-std/r5rs-Z-G-37.gif
Normal file
After Width: | Height: | Size: 471 B |
BIN
doc/r5rs-std/r5rs-Z-G-38.gif
Normal file
After Width: | Height: | Size: 513 B |
BIN
doc/r5rs-std/r5rs-Z-G-39.gif
Normal file
After Width: | Height: | Size: 516 B |
BIN
doc/r5rs-std/r5rs-Z-G-4.gif
Normal file
After Width: | Height: | Size: 574 B |
BIN
doc/r5rs-std/r5rs-Z-G-40.gif
Normal file
After Width: | Height: | Size: 1.7 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-41.gif
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-42.gif
Normal file
After Width: | Height: | Size: 480 B |
BIN
doc/r5rs-std/r5rs-Z-G-43.gif
Normal file
After Width: | Height: | Size: 596 B |
BIN
doc/r5rs-std/r5rs-Z-G-44.gif
Normal file
After Width: | Height: | Size: 471 B |
BIN
doc/r5rs-std/r5rs-Z-G-45.gif
Normal file
After Width: | Height: | Size: 513 B |
BIN
doc/r5rs-std/r5rs-Z-G-46.gif
Normal file
After Width: | Height: | Size: 407 B |
BIN
doc/r5rs-std/r5rs-Z-G-47.gif
Normal file
After Width: | Height: | Size: 903 B |
BIN
doc/r5rs-std/r5rs-Z-G-48.gif
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-49.gif
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-5.gif
Normal file
After Width: | Height: | Size: 4.8 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-50.gif
Normal file
After Width: | Height: | Size: 988 B |
BIN
doc/r5rs-std/r5rs-Z-G-51.gif
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-52.gif
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-53.gif
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-54.gif
Normal file
After Width: | Height: | Size: 971 B |
BIN
doc/r5rs-std/r5rs-Z-G-55.gif
Normal file
After Width: | Height: | Size: 332 B |
BIN
doc/r5rs-std/r5rs-Z-G-56.gif
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-57.gif
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-58.gif
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-59.gif
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-6.gif
Normal file
After Width: | Height: | Size: 3.4 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-60.gif
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-61.gif
Normal file
After Width: | Height: | Size: 355 B |
BIN
doc/r5rs-std/r5rs-Z-G-62.gif
Normal file
After Width: | Height: | Size: 960 B |
BIN
doc/r5rs-std/r5rs-Z-G-63.gif
Normal file
After Width: | Height: | Size: 336 B |
BIN
doc/r5rs-std/r5rs-Z-G-64.gif
Normal file
After Width: | Height: | Size: 261 B |
BIN
doc/r5rs-std/r5rs-Z-G-65.gif
Normal file
After Width: | Height: | Size: 191 B |
BIN
doc/r5rs-std/r5rs-Z-G-7.gif
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-8.gif
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-9.gif
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
doc/r5rs-std/r5rs-Z-G-D-1.gif
Normal file
After Width: | Height: | Size: 47 B |
BIN
doc/r5rs-std/r5rs-Z-G-D-2.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
doc/r5rs-std/r5rs-Z-G-D-3.gif
Normal file
After Width: | Height: | Size: 53 B |
BIN
doc/r5rs-std/r5rs-Z-G-D-4.gif
Normal file
After Width: | Height: | Size: 56 B |
BIN
doc/r5rs-std/r5rs-Z-G-D-5.gif
Normal file
After Width: | Height: | Size: 67 B |
BIN
doc/r5rs-std/r5rs-Z-G-D-6.gif
Normal file
After Width: | Height: | Size: 59 B |
BIN
doc/r5rs-std/r5rs-Z-G-D-7.gif
Normal file
After Width: | Height: | Size: 59 B |
BIN
doc/r5rs-std/r5rs-Z-G-D-8.gif
Normal file
After Width: | Height: | Size: 66 B |
59
doc/r5rs-std/r5rs-Z-H-1.html
Normal file
|
@ -0,0 +1,59 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs.html">previous</a></span><span>, <a href="r5rs-Z-H-2.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_1"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_Temp_1">Summary</a></h1>
|
||||
<p>The report gives a defining description of the programming language
|
||||
Scheme. Scheme is a statically scoped and properly tail-recursive
|
||||
dialect of the Lisp programming language invented by Guy Lewis
|
||||
Steele Jr. and Gerald Jay Sussman. It was designed to have an
|
||||
exceptionally clear and simple semantics and few different ways to
|
||||
form expressions. A wide variety of programming paradigms, including
|
||||
imperative, functional, and message passing styles, find convenient
|
||||
expression in Scheme.</p>
|
||||
<p>
|
||||
The introduction offers a brief history of the language and of
|
||||
the report.</p>
|
||||
<p>
|
||||
The first three chapters present the fundamental ideas of the
|
||||
language and describe the notational conventions used for describing the
|
||||
language and for writing programs in the language.</p>
|
||||
<p>
|
||||
Chapters <a href="r5rs-Z-H-7.html#%_chap_4">4</a> and <a href="r5rs-Z-H-8.html#%_chap_5">5</a> describe
|
||||
the syntax and semantics of expressions, programs, and definitions.</p>
|
||||
<p>
|
||||
Chapter <a href="r5rs-Z-H-9.html#%_chap_6">6</a> describes Scheme's built-in
|
||||
procedures, which include all of the language's data manipulation and
|
||||
input/output primitives.</p>
|
||||
<p>
|
||||
Chapter <a href="r5rs-Z-H-10.html#%_chap_7">7</a> provides a formal syntax for Scheme
|
||||
written in extended BNF, along with a formal denotational semantics.
|
||||
An example of the use of the language follows the formal syntax and
|
||||
semantics.</p>
|
||||
<p>
|
||||
The report concludes with a list of references and an
|
||||
alphabetic index.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs.html">previous</a></span><span>, <a href="r5rs-Z-H-2.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
681
doc/r5rs-std/r5rs-Z-H-10.html
Normal file
|
@ -0,0 +1,681 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-9.html">previous</a></span><span>, <a href="r5rs-Z-H-11.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_7"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading><a href="r5rs-Z-H-2.html#%_toc_%_chap_7">Chapter 7</a></div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_7">Formal syntax and semantics</a></h1>
|
||||
<p></p>
|
||||
<p>
|
||||
This chapter provides formal descriptions of what has already been
|
||||
described informally in previous chapters of this report.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.1"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.1">7.1 Formal syntax</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
This section provides a formal syntax for Scheme written in an extended
|
||||
BNF.</p>
|
||||
<p>
|
||||
All spaces in the grammar are for legibility. Case is insignificant;
|
||||
for example, <tt>#x1A</tt> and <tt>#X1a</tt> are equivalent. <empty>
|
||||
stands for the empty string.</p>
|
||||
<p>
|
||||
The following extensions to BNF are used to make the description more
|
||||
concise: <thing>* means zero or more occurrences of
|
||||
<thing>; and <thing><sup>+</sup> means at least one
|
||||
<thing>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.1.1"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.1.1">7.1.1 Lexical structure</a></h3>
|
||||
<p>This section describes how individual tokens<a name="%_idx_674"></a> (identifiers,
|
||||
numbers, etc.) are formed from sequences of characters. The following
|
||||
sections describe how expressions and programs are formed from sequences
|
||||
of tokens.</p>
|
||||
<p>
|
||||
<Intertoken space> may occur on either side of any token, but not
|
||||
within a token.</p>
|
||||
<p>
|
||||
Tokens which require implicit termination (identifiers, numbers,
|
||||
characters, and dot) may be terminated by any <delimiter>, but not
|
||||
necessarily by anything else.</p>
|
||||
<p>
|
||||
The following five characters are reserved for future extensions to the
|
||||
language: <tt><code class=verbatim>[</code> <code class=verbatim>]</code> <code class=verbatim>{</code> <code class=verbatim>}</code> <code class=verbatim>|</code></tt></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-2.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-3.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-4.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
The following rules for <num <em>R</em>>, <complex <em>R</em>>, <real
|
||||
<em>R</em>>, <ureal <em>R</em>>, <uinteger <em>R</em>>, and <prefix <em>R</em>>
|
||||
should be replicated for <em>R</em> = 2, 8, 10,
|
||||
and 16. There are no rules for <decimal 2>, <decimal
|
||||
8>, and <decimal 16>, which means that numbers containing
|
||||
decimal points or exponents must be in decimal radix.
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-5.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-6.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.1.2"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.1.2">7.1.2 External representations</a></h3>
|
||||
<p></p>
|
||||
<p>
|
||||
<Datum> is what the <tt>read</tt> procedure (section <a href="r5rs-Z-H-9.html#%_sec_6.6.2">6.6.2</a>)
|
||||
successfully parses. Note that any string that parses as an
|
||||
<expression> will also parse as a <datum>. </p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-7.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.1.3"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.1.3">7.1.3 Expressions</a></h3>
|
||||
<p></p>
|
||||
<div align=left><img src="r5rs-Z-G-8.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.1.4"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.1.4">7.1.4 Quasiquotations</a></h3>
|
||||
<p>The following grammar for quasiquote expressions is not context-free.
|
||||
It is presented as a recipe for generating an infinite number of
|
||||
production rules. Imagine a copy of the following rules for <em>D</em> = 1, 2,
|
||||
3, <tt>...</tt>. <em>D</em> keeps track of the nesting depth.</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-9.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
In <quasiquotation>s, a <list qq template <em>D</em>> can sometimes
|
||||
be confused with either an <unquotation <em>D</em>> or a <splicing
|
||||
unquotation <em>D</em>>. The interpretation as an
|
||||
<unquotation> or <splicing
|
||||
unquotation <em>D</em>> takes precedence.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.1.5"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.1.5">7.1.5 Transformers</a></h3>
|
||||
<p></p>
|
||||
<div align=left><img src="r5rs-Z-G-10.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.1.6"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.1.6">7.1.6 Programs and definitions</a></h3>
|
||||
<p></p>
|
||||
<div align=left><img src="r5rs-Z-G-11.gif" border="0"></div>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<a name="%_sec_7.2"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.2">7.2 Formal semantics</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
This section provides a formal denotational semantics for the primitive
|
||||
expressions of Scheme and selected built-in procedures. The concepts
|
||||
and notation used here are described in [<a href="r5rs-Z-H-14.html#cite{Stoy77}">29</a>]; the notation is
|
||||
summarized below:</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-12.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
The reason that expression continuations take sequences of values instead
|
||||
of single values is to simplify the formal treatment of procedure calls
|
||||
and multiple return values.</p>
|
||||
<p>
|
||||
The boolean flag associated with pairs, vectors, and strings will be true
|
||||
for mutable objects and false for immutable objects.</p>
|
||||
<p>
|
||||
The order of evaluation within a call is unspecified. We mimic that
|
||||
here by applying arbitrary permutations <i>permute</i> and <i>unpermute</i>, which must be inverses, to the arguments in a call before
|
||||
and after they are evaluated. This is not quite right since it suggests,
|
||||
incorrectly, that the order of evaluation is constant throughout a program (for
|
||||
any given number of arguments), but it is a closer approximation to the intended
|
||||
semantics than a left-to-right evaluation would be.</p>
|
||||
<p>
|
||||
The storage allocator <i>new</i> is implementation-dependent, but it must
|
||||
obey the following axiom: if <i>new</i> <img src="r5rs-Z-G-D-2.gif" border="0"> <img src="r5rs-Z-G-D-4.gif" border="0"> <tt><em>L</em></tt>, then
|
||||
<img src="r5rs-Z-G-D-2.gif" border="0"> (<i>new</i> <img src="r5rs-Z-G-D-2.gif" border="0"> | <tt><em>L</em></tt>)<img src="r5rs-Z-G-D-7.gif" border="0"> 2 = <i><em>f</em><em>a</em><em>l</em><em>s</em><em>e</em></i>.</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
The definition of <img src="r5rs-Z-G-D-5.gif" border="0"> is omitted because an accurate definition of
|
||||
<img src="r5rs-Z-G-D-5.gif" border="0"> would complicate the semantics without being very interesting.</p>
|
||||
<p>
|
||||
If P is a program in which all variables are defined before being
|
||||
referenced or assigned, then the meaning of P is
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-13.gif" border="0"></div>
|
||||
<p>
|
||||
where I* is the sequence of variables defined in P, P'
|
||||
is the sequence of expressions obtained by replacing every definition
|
||||
in P by an assignment, <undefined> is an expression that evaluates
|
||||
to <i>undefined</i>, and
|
||||
<img src="r5rs-Z-G-D-6.gif" border="0"> is the semantic function that assigns meaning to expressions.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.2.1"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.2.1">7.2.1 Abstract syntax</a></h3>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-14.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-15.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.2.2"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.2.2">7.2.2 Domain equations</a></h3>
|
||||
<p></p>
|
||||
<div align=left><img src="r5rs-Z-G-16.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_7.2.3"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.2.3">7.2.3 Semantic functions</a></h3>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-17.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>
|
||||
Definition of <img src="r5rs-Z-G-D-5.gif" border="0"> deliberately omitted.</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-18.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-19.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-20.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-21.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-22.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-23.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-24.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-25.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
Here and elsewhere, any expressed value other than <i>undefined</i> may
|
||||
be used in place of <i>unspecified</i>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-26.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-27.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-28.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-29.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-30.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<a name="%_sec_7.2.4"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.2.4">7.2.4 Auxiliary functions</a></h3>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-31.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-32.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-33.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-34.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-35.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-36.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-37.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-38.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-39.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-40.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-41.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-42.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-43.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-44.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-45.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-46.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-47.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-48.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-49.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-50.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-51.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
<a name="%_idx_676"></a>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-52.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
<a name="%_idx_678"></a>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-53.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
<a name="%_idx_680"></a>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-54.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-55.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
<a name="%_idx_682"></a>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-56.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
<a name="%_idx_684"></a>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-57.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
<a name="%_idx_686"></a>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-58.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-59.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-60.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-61.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-62.gif" border="0"></div>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p></p>
|
||||
<a name="%_sec_7.3"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_7.3">7.3 Derived expression types</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
This section gives macro definitions for the derived expression types in
|
||||
terms of the primitive expression types (literal, variable, call, <tt>lambda</tt>,
|
||||
<tt>if</tt>, <tt>set!</tt>). See section <a href="r5rs-Z-H-9.html#%_sec_6.4">6.4</a> for a possible
|
||||
definition of <tt>delay</tt>.</p>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>cond</tt><br>
|
||||
(syntax-rules (else =>)<br>
|
||||
((cond (else result1 result2 ...))<br>
|
||||
(begin result1 result2 ...))<br>
|
||||
((cond (test => result))<br>
|
||||
(let ((temp test))<br>
|
||||
(if temp (result temp))))<br>
|
||||
((cond (test => result) clause1 clause2 ...)<br>
|
||||
(let ((temp test))<br>
|
||||
(if temp<br>
|
||||
(result temp)<br>
|
||||
(cond clause1 clause2 ...))))<br>
|
||||
((cond (test)) test)<br>
|
||||
((cond (test) clause1 clause2 ...)<br>
|
||||
(let ((temp test))<br>
|
||||
(if temp<br>
|
||||
temp<br>
|
||||
(cond clause1 clause2 ...))))<br>
|
||||
((cond (test result1 result2 ...))<br>
|
||||
(if test (begin result1 result2 ...)))<br>
|
||||
((cond (test result1 result2 ...)<br>
|
||||
clause1 clause2 ...)<br>
|
||||
(if test<br>
|
||||
(begin result1 result2 ...)<br>
|
||||
(cond clause1 clause2 ...)))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>case</tt><br>
|
||||
(syntax-rules (else)<br>
|
||||
((case (key ...)<br>
|
||||
clauses ...)<br>
|
||||
(let ((atom-key (key ...)))<br>
|
||||
(case atom-key clauses ...)))<br>
|
||||
((case key<br>
|
||||
(else result1 result2 ...))<br>
|
||||
(begin result1 result2 ...))<br>
|
||||
((case key<br>
|
||||
((atoms ...) result1 result2 ...))<br>
|
||||
(if (memv key '(atoms ...))<br>
|
||||
(begin result1 result2 ...)))<br>
|
||||
((case key<br>
|
||||
((atoms ...) result1 result2 ...)<br>
|
||||
clause clauses ...)<br>
|
||||
(if (memv key '(atoms ...))<br>
|
||||
(begin result1 result2 ...)<br>
|
||||
(case key clause clauses ...)))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>and</tt><br>
|
||||
(syntax-rules ()<br>
|
||||
((and) <tt>#t</tt>)<br>
|
||||
((and test) test)<br>
|
||||
((and test1 test2 ...)<br>
|
||||
(if test1 (and test2 ...) <tt>#f</tt>))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>or</tt><br>
|
||||
(syntax-rules ()<br>
|
||||
((or) <tt>#f</tt>)<br>
|
||||
((or test) test)<br>
|
||||
((or test1 test2 ...)<br>
|
||||
(let ((x test1))<br>
|
||||
(if x x (or test2 ...))))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>let</tt><br>
|
||||
(syntax-rules ()<br>
|
||||
((let ((name val) ...) body1 body2 ...)<br>
|
||||
((lambda (name ...) body1 body2 ...)<br>
|
||||
val ...))<br>
|
||||
((let tag ((name val) ...) body1 body2 ...)<br>
|
||||
((letrec ((tag (lambda (name ...)<br>
|
||||
body1 body2 ...)))<br>
|
||||
tag)<br>
|
||||
val ...))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>let*</tt><br>
|
||||
(syntax-rules ()<br>
|
||||
((let* () body1 body2 ...)<br>
|
||||
(let () body1 body2 ...))<br>
|
||||
((let* ((name1 val1) (name2 val2) ...)<br>
|
||||
body1 body2 ...)<br>
|
||||
(let ((name1 val1))<br>
|
||||
(let* ((name2 val2) ...)<br>
|
||||
body1 body2 ...)))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
The following <tt>letrec</tt> macro uses the symbol <tt><undefined></tt>
|
||||
in place of an expression which returns something that when stored in
|
||||
a location makes it an error to try to obtain the value stored in the
|
||||
location (no such expression is defined in Scheme).
|
||||
A trick is used to generate the temporary names needed to avoid
|
||||
specifying the order in which the values are evaluated.
|
||||
This could also be accomplished by using an auxiliary macro.</p>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>letrec</tt><br>
|
||||
(syntax-rules ()<br>
|
||||
((letrec ((var1 init1) ...) body ...)<br>
|
||||
(letrec "generate_temp_names"<br>
|
||||
(var1 ...)<br>
|
||||
()<br>
|
||||
((var1 init1) ...)<br>
|
||||
body ...))<br>
|
||||
((letrec "generate_temp_names"<br>
|
||||
()<br>
|
||||
(temp1 ...)<br>
|
||||
((var1 init1) ...)<br>
|
||||
body ...)<br>
|
||||
(let ((var1 <undefined>) ...)<br>
|
||||
(let ((temp1 init1) ...)<br>
|
||||
(set! var1 temp1)<br>
|
||||
...<br>
|
||||
body ...)))<br>
|
||||
((letrec "generate_temp_names"<br>
|
||||
(x y ...)<br>
|
||||
(temp ...)<br>
|
||||
((var1 init1) ...)<br>
|
||||
body ...)<br>
|
||||
(letrec "generate_temp_names"<br>
|
||||
(y ...)<br>
|
||||
(newtemp temp ...)<br>
|
||||
((var1 init1) ...)<br>
|
||||
body ...))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>begin</tt><br>
|
||||
(syntax-rules ()<br>
|
||||
((begin exp ...)<br>
|
||||
((lambda () exp ...)))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
The following alternative expansion for <tt>begin</tt> does not make use of
|
||||
the ability to write more than one expression in the body of a lambda
|
||||
expression. In any case, note that these rules apply only if the body
|
||||
of the <tt>begin</tt> contains no definitions.</p>
|
||||
<p>
|
||||
<tt>(define-syntax begin<br>
|
||||
(syntax-rules ()<br>
|
||||
((begin exp)<br>
|
||||
exp)<br>
|
||||
((begin exp1 exp2 ...)<br>
|
||||
(let ((x exp1))<br>
|
||||
(begin exp2 ...)))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
The following definition
|
||||
of <tt>do</tt> uses a trick to expand the variable clauses.
|
||||
As with <tt>letrec</tt> above, an auxiliary macro would also work.
|
||||
The expression <tt>(if #f #f)</tt> is used to obtain an unspecific
|
||||
value.</p>
|
||||
<p>
|
||||
<tt>(define-syntax <tt>do</tt><br>
|
||||
(syntax-rules ()<br>
|
||||
((do ((var init step ...) ...)<br>
|
||||
(test expr ...)<br>
|
||||
command ...)<br>
|
||||
(letrec<br>
|
||||
((loop<br>
|
||||
(lambda (var ...)<br>
|
||||
(if test<br>
|
||||
(begin<br>
|
||||
(if #f #f)<br>
|
||||
expr ...)<br>
|
||||
(begin<br>
|
||||
command<br>
|
||||
...<br>
|
||||
(loop (do "step" var step ...)<br>
|
||||
...))))))<br>
|
||||
(loop init ...)))<br>
|
||||
((do "step" x)<br>
|
||||
x)<br>
|
||||
((do "step" x y)<br>
|
||||
y)))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-9.html">previous</a></span><span>, <a href="r5rs-Z-H-11.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
112
doc/r5rs-std/r5rs-Z-H-11.html
Normal file
|
@ -0,0 +1,112 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-10.html">previous</a></span><span>, <a href="r5rs-Z-H-12.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_6"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_Temp_6">Notes</a></h1>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_Temp_7"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_Temp_7">Language changes</a></h3>
|
||||
<p></p>
|
||||
<p>
|
||||
This section enumerates the changes that have been made to Scheme since
|
||||
the ``Revised<sup>4</sup> report'' [<a href="r5rs-Z-H-14.html#cite{R4RS}">6</a>] was published.</p>
|
||||
<p>
|
||||
</p>
|
||||
<ul>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>The report is now a superset of the IEEE standard for Scheme
|
||||
[<a href="r5rs-Z-H-14.html#cite{IEEEScheme}">13</a>]: implementations that conform to the report will
|
||||
also conform to the standard. This required the following changes:
|
||||
</p>
|
||||
<ul>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>The empty list is now required to count as true.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>The classification of features as essential or inessential has been
|
||||
removed. There are now three classes of built-in procedures: primitive,
|
||||
library, and optional. The optional procedures are <tt>load</tt>,
|
||||
<tt>with-input-from-file</tt>, <tt>with-output-to-file</tt>,
|
||||
<tt>transcript-on</tt>, <tt>transcript-off</tt>, and
|
||||
<tt>interaction-environment</tt>,
|
||||
and <tt>-</tt> and <tt>/</tt> with more than two arguments.
|
||||
None of these are in the IEEE standard.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>Programs are allowed to redefine built-in procedures. Doing so
|
||||
will not change the behavior of other built-in procedures.
|
||||
</p>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><em>Port</em> has been added to the list of disjoint types.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>The macro appendix has been removed. High-level macros are now part
|
||||
of the main body of the report. The rewrite rules for derived expressions
|
||||
have been replaced with macro definitions. There are no reserved identifiers.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><tt>Syntax-rules</tt> now allows vector patterns.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>Multiple-value returns, <tt>eval</tt>, and <tt>dynamic-wind</tt> have
|
||||
been added.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>The calls that are required to be implemented in a properly tail-recursive
|
||||
fashion are defined explicitly.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>`<tt>@</tt>' can be used within identifiers. `<tt><code class=verbatim>|</code></tt>' is reserved
|
||||
for possible future extensions.</p>
|
||||
<p>
|
||||
</p>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-10.html">previous</a></span><span>, <a href="r5rs-Z-H-12.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
40
doc/r5rs-std/r5rs-Z-H-12.html
Normal file
|
@ -0,0 +1,40 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-11.html">previous</a></span><span>, <a href="r5rs-Z-H-13.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_8"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_Temp_8">Additional material</a></h1>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>
|
||||
The Internet Scheme Repository at
|
||||
</p>
|
||||
<div align=center><table><tr><td>
|
||||
|
||||
<tt>http://www.cs.indiana.edu/scheme-repository/</tt>
|
||||
</td></tr></table></div>
|
||||
|
||||
contains an extensive Scheme bibliography, as well as papers,
|
||||
programs, implementations, and other material related to Scheme.
|
||||
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-11.html">previous</a></span><span>, <a href="r5rs-Z-H-13.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
160
doc/r5rs-std/r5rs-Z-H-13.html
Normal file
|
@ -0,0 +1,160 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-12.html">previous</a></span><span>, <a href="r5rs-Z-H-14.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_9"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_Temp_9">Example</a></h1>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<tt>Integrate-system</tt> integrates the system
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-63.gif" border="0"></div>
|
||||
<p>
|
||||
of differential equations with the method of Runge-Kutta.</p>
|
||||
<p>
|
||||
The parameter <tt>system-derivative</tt> is a function that takes a system
|
||||
state (a vector of values for the state variables <em>y</em><sub>1</sub>, <tt>...</tt>, <em>y</em><sub><em>n</em></sub>)
|
||||
and produces a system derivative (the values <em>y</em><sub>1</sub><sup>/</sup>, <tt>...</tt>,
|
||||
<em>y</em><sub><em>n</em></sub><sup>/</sup>). The parameter <tt>initial-state</tt> provides an initial
|
||||
system state, and <tt>h</tt> is an initial guess for the length of the
|
||||
integration step.</p>
|
||||
<p>
|
||||
The value returned by <tt>integrate-system</tt> is an infinite stream of
|
||||
system states.</p>
|
||||
<p>
|
||||
<tt>(define integrate-system<br>
|
||||
(lambda (system-derivative initial-state h)<br>
|
||||
(let ((next (runge-kutta-4 system-derivative h)))<br>
|
||||
(letrec ((states<br>
|
||||
(cons initial-state<br>
|
||||
(delay (map-streams next<br>
|
||||
states)))))<br>
|
||||
states))))</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>Runge-Kutta-4</tt> takes a function, <tt>f</tt>, that produces a
|
||||
system derivative from a system state. <tt>Runge-Kutta-4</tt>
|
||||
produces a function that takes a system state and
|
||||
produces a new system state.</p>
|
||||
<p>
|
||||
<tt>(define runge-kutta-4<br>
|
||||
(lambda (f h)<br>
|
||||
(let ((*h (scale-vector h))<br>
|
||||
(*2 (scale-vector 2))<br>
|
||||
(*1/2 (scale-vector (/ 1 2)))<br>
|
||||
(*1/6 (scale-vector (/ 1 6))))<br>
|
||||
(lambda (y)<br>
|
||||
;; y is a system state<br>
|
||||
(let* ((k0 (*h (f y)))<br>
|
||||
(k1 (*h (f (add-vectors y (*1/2 k0)))))<br>
|
||||
(k2 (*h (f (add-vectors y (*1/2 k1)))))<br>
|
||||
(k3 (*h (f (add-vectors y k2)))))<br>
|
||||
(add-vectors y<br>
|
||||
(*1/6 (add-vectors k0<br>
|
||||
(*2 k1)<br>
|
||||
(*2 k2)<br>
|
||||
k3))))))))<br>
|
||||
<br>
|
||||
(define elementwise<br>
|
||||
(lambda (f)<br>
|
||||
(lambda vectors<br>
|
||||
(generate-vector<br>
|
||||
(vector-length (car vectors))<br>
|
||||
(lambda (i)<br>
|
||||
(apply f<br>
|
||||
(map (lambda (v) (vector-ref v i))<br>
|
||||
vectors)))))))<br>
|
||||
<br>
|
||||
(define generate-vector<br>
|
||||
(lambda (size proc)<br>
|
||||
(let ((ans (make-vector size)))<br>
|
||||
(letrec ((loop<br>
|
||||
(lambda (i)<br>
|
||||
(cond ((= i size) ans)<br>
|
||||
(else<br>
|
||||
(vector-set! ans i (proc i))<br>
|
||||
(loop (+ i 1)))))))<br>
|
||||
(loop 0)))))<br>
|
||||
<br>
|
||||
(define add-vectors (elementwise +))<br>
|
||||
<br>
|
||||
(define scale-vector<br>
|
||||
(lambda (s)<br>
|
||||
(elementwise (lambda (x) (* x s)))))</p>
|
||||
</tt>
|
||||
<p>
|
||||
<tt>Map-streams</tt> is analogous to <tt>map</tt>: it applies its first
|
||||
argument (a procedure) to all the elements of its second argument (a
|
||||
stream).</p>
|
||||
<p>
|
||||
<tt>(define map-streams<br>
|
||||
(lambda (f s)<br>
|
||||
(cons (f (head s))<br>
|
||||
(delay (map-streams f (tail s))))))</p>
|
||||
</tt>
|
||||
<p>
|
||||
Infinite streams are implemented as pairs whose car holds the first
|
||||
element of the stream and whose cdr holds a promise to deliver the rest
|
||||
of the stream.</p>
|
||||
<p>
|
||||
<tt>(define head car)<br>
|
||||
(define tail<br>
|
||||
(lambda (stream) (force (cdr stream))))</p>
|
||||
</tt>
|
||||
<p>
|
||||
</p>
|
||||
<p><br></p>
|
||||
<p><br></p>
|
||||
<p>The following illustrates the use of <tt>integrate-system</tt> in
|
||||
integrating the system
|
||||
</p>
|
||||
<div align=left><img src="r5rs-Z-G-64.gif" border="0"></div>
|
||||
<p></p>
|
||||
<div align=left><img src="r5rs-Z-G-65.gif" border="0"></div>
|
||||
<p>
|
||||
which models a damped oscillator.</p>
|
||||
<p>
|
||||
<tt>(define damped-oscillator<br>
|
||||
(lambda (R L C)<br>
|
||||
(lambda (state)<br>
|
||||
(let ((Vc (vector-ref state 0))<br>
|
||||
(Il (vector-ref state 1)))<br>
|
||||
(vector (- 0 (+ (/ Vc (* R C)) (/ Il C)))<br>
|
||||
(/ Vc L))))))<br>
|
||||
<br>
|
||||
(define the-states<br>
|
||||
(integrate-system<br>
|
||||
(damped-oscillator 10000 1000 .001)<br>
|
||||
'#(1 0)<br>
|
||||
.01))</p>
|
||||
</tt>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-12.html">previous</a></span><span>, <a href="r5rs-Z-H-14.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
277
doc/r5rs-std/r5rs-Z-H-14.html
Normal file
|
@ -0,0 +1,277 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-13.html">previous</a></span><span>, <a href="r5rs-Z-H-15.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_10"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_Temp_10">Bibliography</a></h1>
|
||||
<p></p>
|
||||
<table>
|
||||
|
||||
<p>
|
||||
</p>
|
||||
<tr><td align=right valign=top><a name="cite{SICP}"></a>[1] </td><td>
|
||||
<p>
|
||||
Harold Abelson and Gerald Jay Sussman with Julie Sussman.
|
||||
<i>Structure and Interpretation of Computer Programs, second edition.</i>
|
||||
MIT Press, Cambridge, 1996.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Bawden88}"></a>[2] </td><td>
|
||||
<p> Alan Bawden and Jonathan Rees.
|
||||
Syntactic closures.
|
||||
In <i>Proceedings of the 1988 ACM Symposium on Lisp and
|
||||
Functional Programming</i>, pages 86-95.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{howtoprint}"></a>[3] </td><td>
|
||||
<p>
|
||||
Robert G. Burger and R. Kent Dybvig.
|
||||
Printing floating-point numbers quickly and accurately.
|
||||
In <i>Proceedings of the ACM SIGPLAN '96 Conference
|
||||
on Programming Language Design and Implementation</i>, pages 108-116.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{RRRS}"></a>[4] </td><td>
|
||||
<p>
|
||||
William Clinger, editor.
|
||||
The revised revised report on Scheme, or an uncommon Lisp.
|
||||
MIT Artificial Intelligence Memo 848, August 1985.
|
||||
Also published as Computer Science Department Technical Report 174,
|
||||
Indiana University, June 1985.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{howtoread}"></a>[5] </td><td>
|
||||
<p> William Clinger.
|
||||
How to read floating point numbers accurately.
|
||||
In <i>Proceedings of the ACM SIGPLAN '90 Conference
|
||||
on Programming Language Design and Implementation</i>, pages 92-101.
|
||||
Proceedings published as <i>SIGPLAN Notices</i> 25(6), June 1990.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{R4RS}"></a>[6] </td><td>
|
||||
<p>
|
||||
William Clinger and Jonathan Rees, editors.
|
||||
The revised<sup>4</sup> report on the algorithmic language Scheme.
|
||||
In <i>ACM Lisp Pointers</i> 4(3), pages 1-55, 1991.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{macrosthatwork}"></a>[7] </td><td>
|
||||
<p> William Clinger and Jonathan Rees.
|
||||
Macros that work.
|
||||
In <i>Proceedings of the 1991 ACM Conference on Principles of
|
||||
Programming Languages</i>, pages 155-162.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{propertailrecursion}"></a>[8] </td><td>
|
||||
<p> William Clinger.
|
||||
Proper Tail Recursion and Space Efficiency.
|
||||
To appear in <i>Proceedings of the 1998 ACM Conference on Programming
|
||||
Language Design and Implementation</i>, June 1998.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{syntacticabstraction}"></a>[9] </td><td>
|
||||
<p>
|
||||
R. Kent Dybvig, Robert Hieb, and Carl Bruggeman.
|
||||
Syntactic abstraction in Scheme.
|
||||
<i>Lisp and Symbolic Computation</i> 5(4):295-326, 1993.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Scheme311}"></a>[10] </td><td>
|
||||
<p>
|
||||
Carol Fessenden, William Clinger, Daniel P. Friedman, and Christopher Haynes.
|
||||
Scheme 311 version 4 reference manual.
|
||||
Indiana University Computer Science Technical Report 137, February 1983.
|
||||
Superseded by [<a href="#cite{Scheme84}">11</a>].</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Scheme84}"></a>[11] </td><td>
|
||||
<p>
|
||||
D. Friedman, C. Haynes, E. Kohlbecker, and M. Wand.
|
||||
Scheme 84 interim reference manual.
|
||||
Indiana University Computer Science Technical Report 153, January 1985.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{IEEE}"></a>[12] </td><td>
|
||||
<p>
|
||||
<i>IEEE Standard 754-1985. IEEE Standard for Binary Floating-Point
|
||||
Arithmetic.</i> IEEE, New York, 1985.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{IEEEScheme}"></a>[13] </td><td>
|
||||
<p>
|
||||
<i>IEEE Standard 1178-1990. IEEE Standard for the Scheme
|
||||
Programming Language.</i> IEEE, New York, 1991.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Kohlbecker86}"></a>[14] </td><td>
|
||||
<p>
|
||||
Eugene E. Kohlbecker Jr.
|
||||
<i>Syntactic Extensions in the Programming Language Lisp.</i>
|
||||
PhD thesis, Indiana University, August 1986.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{hygienic}"></a>[15] </td><td>
|
||||
<p>
|
||||
Eugene E. Kohlbecker Jr., Daniel P. Friedman, Matthias Felleisen, and Bruce Duba.
|
||||
Hygienic macro expansion.
|
||||
In <i>Proceedings of the 1986 ACM Conference on Lisp
|
||||
and Functional Programming</i>, pages 151-161.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Landin65}"></a>[16] </td><td>
|
||||
<p>
|
||||
Peter Landin.
|
||||
A correspondence between Algol 60 and Church's lambda notation: Part I.
|
||||
<i>Communications of the ACM</i> 8(2):89-101, February 1965.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{MITScheme}"></a>[17] </td><td>
|
||||
<p>
|
||||
MIT Department of Electrical Engineering and Computer Science.
|
||||
Scheme manual, seventh edition.
|
||||
September 1984.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Naur63}"></a>[18] </td><td>
|
||||
<p>
|
||||
Peter Naur et al.
|
||||
Revised report on the algorithmic language Algol 60.
|
||||
<i>Communications of the ACM</i> 6(1):1-17, January 1963.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Penfield81}"></a>[19] </td><td>
|
||||
<p>
|
||||
Paul Penfield, Jr.
|
||||
Principal values and branch cuts in complex APL.
|
||||
In <i>APL '81 Conference Proceedings,</i> pages 248-256.
|
||||
ACM SIGAPL, San Francisco, September 1981.
|
||||
Proceedings published as <i>APL Quote Quad</i> 12(1), ACM, September 1981.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Pitman83}"></a>[20] </td><td>
|
||||
<p>
|
||||
Kent M. Pitman.
|
||||
The revised MacLisp manual (Saturday evening edition).
|
||||
MIT Laboratory for Computer Science Technical Report 295, May 1983.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Rees82}"></a>[21] </td><td>
|
||||
<p>
|
||||
Jonathan A. Rees and Norman I. Adams IV.
|
||||
T: A dialect of Lisp or, lambda: The ultimate software tool.
|
||||
In <i>Conference Record of the 1982 ACM Symposium on Lisp and
|
||||
Functional Programming</i>, pages 114-122.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Rees84}"></a>[22] </td><td>
|
||||
<p>
|
||||
Jonathan A. Rees, Norman I. Adams IV, and James R. Meehan.
|
||||
The T manual, fourth edition.
|
||||
Yale University Computer Science Department, January 1984.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{R3RS}"></a>[23] </td><td>
|
||||
<p>
|
||||
Jonathan Rees and William Clinger, editors.
|
||||
The revised<sup>3</sup> report on the algorithmic language Scheme.
|
||||
In <i>ACM SIGPLAN Notices</i> 21(12), pages 37-79, December 1986.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Reynolds72}"></a>[24] </td><td>
|
||||
<p>
|
||||
John Reynolds.
|
||||
Definitional interpreters for higher order programming languages.
|
||||
In <i>ACM Conference Proceedings</i>, pages 717-740.
|
||||
ACM, 1972.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Scheme78}"></a>[25] </td><td>
|
||||
<p>
|
||||
Guy Lewis Steele Jr. and Gerald Jay Sussman.
|
||||
The revised report on Scheme, a dialect of Lisp.
|
||||
MIT Artificial Intelligence Memo 452, January 1978.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Rabbit}"></a>[26] </td><td>
|
||||
<p>
|
||||
Guy Lewis Steele Jr.
|
||||
Rabbit: a compiler for Scheme.
|
||||
MIT Artificial Intelligence Laboratory Technical Report 474, May 1978.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{CLtL}"></a>[27] </td><td>
|
||||
<p>
|
||||
Guy Lewis Steele Jr.
|
||||
<i>Common Lisp: The Language, second edition.</i>
|
||||
Digital Press, Burlington MA, 1990.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Scheme75}"></a>[28] </td><td>
|
||||
<p>
|
||||
Gerald Jay Sussman and Guy Lewis Steele Jr.
|
||||
Scheme: an interpreter for extended lambda calculus.
|
||||
MIT Artificial Intelligence Memo 349, December 1975.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{Stoy77}"></a>[29] </td><td>
|
||||
<p>
|
||||
Joseph E. Stoy.
|
||||
<i>Denotational Semantics: The Scott-Strachey Approach to
|
||||
Programming Language Theory.</i>
|
||||
MIT Press, Cambridge, 1977.</p>
|
||||
<p>
|
||||
</p>
|
||||
</td></tr>
|
||||
<tr><td align=right valign=top><a name="cite{TImanual85}"></a>[30] </td><td>
|
||||
<p>
|
||||
Texas Instruments, Inc.
|
||||
TI Scheme Language Reference Manual.
|
||||
Preliminary version 1.0, November 1985. </p>
|
||||
<p>
|
||||
</p>
|
||||
</table>
|
||||
<p></p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-13.html">previous</a></span><span>, <a href="r5rs-Z-H-15.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
458
doc/r5rs-std/r5rs-Z-H-15.html
Normal file
|
@ -0,0 +1,458 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-14.html">previous</a></span><span class=disable>, next</span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span class=disable><span>; </span>index</span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_11"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_Temp_11">Alphabetic Index of Definitions of Concepts,
|
||||
Keywords, and Procedures</a></h1>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<a name="%_index_start"></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_88"><tt>'</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_402">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_284"><tt>*</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_282"><tt>+</tt></a>, <a href="r5rs-Z-H-10.html#%_idx_678">[2]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_160"><tt>,</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_404">[2]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_162"><tt>,@</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_286"><tt>-</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_288">[2]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_290">[3]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_190"><tt>...</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_292"><tt>/</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_294">[2]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_296">[3]</a><br>
|
||||
<a href="r5rs-Z-H-5.html#%_idx_24"><tt>;</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_260"><tt><</tt></a>, <a href="r5rs-Z-H-10.html#%_idx_676">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_264"><tt><=</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_258"><tt>=</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_112"><tt>=></tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_262"><tt>></tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_266"><tt>>=</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_164"><tt>`</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_298"><tt>abs</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_338"><tt>acos</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_120"><tt>and</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_358"><tt>angle</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_438"><tt>append</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_578"><tt>apply</tt></a>, <a href="r5rs-Z-H-10.html#%_idx_686">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_336"><tt>asin</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_456"><tt>assoc</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_452"><tt>assq</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_454"><tt>assv</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_340"><tt>atan</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_342">[2]</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_232"><tt>#b</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_156">backquote</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_138"><tt>begin</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_32">binding</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_34">binding construct</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_46"><tt>boolean?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_388">[2]</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_40">bound</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_420"><tt>caar</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_422"><tt>cadr</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_90">call</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_150">call by need</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_588"><tt>call-with-current-continuation</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_610"><tt>call-with-input-file</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_612"><tt>call-with-output-file</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_596"><tt>call-with-values</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_410"><tt>car</tt></a>, <a href="r5rs-Z-H-10.html#%_idx_680">[2]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_116"><tt>case</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_424"><tt>cdddar</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_426"><tt>cddddr</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_414"><tt>cdr</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_316"><tt>ceiling</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_498"><tt>char->integer</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_488"><tt>char-alphabetic?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_484"><tt>char-ci<=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_480"><tt>char-ci<?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_478"><tt>char-ci=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_486"><tt>char-ci>=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_482"><tt>char-ci>?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_504"><tt>char-downcase</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_496"><tt>char-lower-case?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_490"><tt>char-numeric?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_648"><tt>char-ready?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_650">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_502"><tt>char-upcase</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_494"><tt>char-upper-case?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_492"><tt>char-whitespace?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_474"><tt>char<=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_470"><tt>char<?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_468"><tt>char=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_476"><tt>char>=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_472"><tt>char>?</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_54"><tt>char?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_466">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_630"><tt>close-input-port</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_632"><tt>close-output-port</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_94">combination</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_158">comma</a><br>
|
||||
<a href="r5rs-Z-H-5.html#%_idx_22">comment</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_246"><tt>complex?</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_108"><tt>cond</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_408"><tt>cons</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_72">constant</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_592">continuation</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_332"><tt>cos</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_618"><tt>current-input-port</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_620"><tt>current-output-port</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_236"><tt>#d</tt></a><br>
|
||||
<a href="r5rs-Z-H-8.html#%_idx_194"><tt>define</tt></a><br>
|
||||
<a href="r5rs-Z-H-8.html#%_idx_202"><tt>define-syntax</tt></a><br>
|
||||
<a href="r5rs-Z-H-8.html#%_idx_192">definition</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_146"><tt>delay</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_312"><tt>denominator</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_656"><tt>display</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_658">[2]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_140"><tt>do</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_392">dotted pair</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_598"><tt>dynamic-wind</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_240"><tt>#e</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_110"><tt>else</tt></a>, <a href="r5rs-Z-H-7.html#%_idx_118">[2]</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_64">empty list</a>, <a href="r5rs-Z-H-9.html#%_idx_384">[2]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_394">[3]</a>, <a href="r5rs-Z-H-9.html#%_idx_396">[4]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_398">[5]</a>, <a href="r5rs-Z-H-9.html#%_idx_412">[6]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_430">[7]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_646"><tt>eof-object?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_220"><tt>eq?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_222"><tt>equal?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_212">equivalence predicate</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_214"><tt>eqv?</tt></a>, <a href="r5rs-Z-H-10.html#%_idx_684">[2]</a><br>
|
||||
<a href="r5rs-Z-H-4.html#%_idx_8">error</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_590">escape procedure</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_600"><tt>eval</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_276"><tt>even?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_216">exact</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_360"><tt>exact->inexact</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_254"><tt>exact?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_228">exactness</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_326"><tt>exp</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_346"><tt>expt</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_374"><tt>#f</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_68">false</a>, <a href="r5rs-Z-H-9.html#%_idx_378">[2]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_382">[3]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_314"><tt>floor</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_582"><tt>for-each</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_584"><tt>force</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_306"><tt>gcd</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_180">hygienic</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_242"><tt>#i</tt></a><br>
|
||||
<a href="r5rs-Z-H-5.html#%_idx_14">identifier</a>, <a href="r5rs-Z-H-6.html#%_idx_26">[2]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_458">[3]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_98"><tt>if</tt></a>, <a href="r5rs-Z-H-7.html#%_idx_100">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_354"><tt>imag-part</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_76">immutable</a><br>
|
||||
<a href="r5rs-Z-H-4.html#%_idx_10">implementation restriction</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_230">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_400">improper list</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_218">inexact</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_362"><tt>inexact->exact</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_256"><tt>inexact?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_204">initial environment</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_614"><tt>input-port?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_500"><tt>integer->char</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_252"><tt>integer?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_606"><tt>interaction-environment</tt></a><br>
|
||||
<a href="r5rs-Z-H-8.html#%_idx_198">internal definition</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_170">keyword</a>, <a href="r5rs-Z-H-7.html#%_idx_178">[2]</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_96"><tt>lambda</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_148">lazy evaluation</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_308"><tt>lcm</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_436"><tt>length</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_126"><tt>let</tt></a>, <a href="r5rs-Z-H-7.html#%_idx_144">[2]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_130"><tt>let*</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_184"><tt>let-syntax</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_134"><tt>letrec</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_186"><tt>letrec-syntax</tt></a><br>
|
||||
<a href="r5rs-Z-H-4.html#%_idx_6">library</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_208">library procedure</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_434"><tt>list</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_548"><tt>list->string</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_572"><tt>list->vector</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_444"><tt>list-ref</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_442"><tt>list-tail</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_432"><tt>list?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_668"><tt>load</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_70">location</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_328"><tt>log</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_166">macro</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_172">macro keyword</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_176">macro transformer</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_174">macro use</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_356"><tt>magnitude</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_350"><tt>make-polar</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_348"><tt>make-rectangular</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_510"><tt>make-string</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_512">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_558"><tt>make-vector</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_560">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_580"><tt>map</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_278"><tt>max</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_450"><tt>member</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_446"><tt>memq</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_448"><tt>memv</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_280"><tt>min</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_304"><tt>modulo</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_74">mutable</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_272"><tt>negative?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_660"><tt>newline</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_662">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_386"><tt>not</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_604"><tt>null-environment</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_428"><tt>null?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_224">number</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_364"><tt>number->string</tt></a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_366">[2]</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_52"><tt>number?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_244">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_310"><tt>numerator</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_226">numerical types</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_234"><tt>#o</tt></a><br>
|
||||
<a href="r5rs-Z-H-4.html#%_idx_2">object</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_274"><tt>odd?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_626"><tt>open-input-file</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_628"><tt>open-output-file</tt></a><br>
|
||||
<a href="r5rs-Z-H-4.html#%_idx_4">optional</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_122"><tt>or</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_616"><tt>output-port?</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_390">pair</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_48"><tt>pair?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_406">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_642"><tt>peek-char</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_644">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_608">port</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_60"><tt>port?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_270"><tt>positive?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_210">predicate</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_92">procedure call</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_62"><tt>procedure?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_576">[2]</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_152">promise</a>, <a href="r5rs-Z-H-9.html#%_idx_586">[2]</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_78">proper tail recursion</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_154"><tt>quasiquote</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_86"><tt>quote</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_300"><tt>quotient</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_250"><tt>rational?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_322"><tt>rationalize</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_634"><tt>read</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_636">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_638"><tt>read-char</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_640">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_352"><tt>real-part</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_248"><tt>real?</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_182">referentially transparent</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_36">region</a>, <a href="r5rs-Z-H-7.html#%_idx_106">[2]</a>,
|
||||
<a href="r5rs-Z-H-7.html#%_idx_124">[3]</a>, <a href="r5rs-Z-H-7.html#%_idx_128">[4]</a>,
|
||||
<a href="r5rs-Z-H-7.html#%_idx_132">[5]</a>, <a href="r5rs-Z-H-7.html#%_idx_136">[6]</a>,
|
||||
<a href="r5rs-Z-H-7.html#%_idx_142">[7]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_302"><tt>remainder</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_440"><tt>reverse</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_320"><tt>round</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_602"><tt>scheme-report-environment</tt></a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_104"><tt>set!</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_416"><tt>set-car!</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_418"><tt>set-cdr!</tt></a><br>
|
||||
<a href="r5rs-Z-H-10.html#%_idx_682"><tt>setcar</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_324">simplest rational</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_330"><tt>sin</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_344"><tt>sqrt</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_514"><tt>string</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_546"><tt>string->list</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_368"><tt>string->number</tt></a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_370">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_464"><tt>string->symbol</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_544"><tt>string-append</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_538"><tt>string-ci<=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_534"><tt>string-ci<?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_524"><tt>string-ci=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_540"><tt>string-ci>=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_536"><tt>string-ci>?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_550"><tt>string-copy</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_552"><tt>string-fill!</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_516"><tt>string-length</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_518"><tt>string-ref</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_520"><tt>string-set!</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_530"><tt>string<=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_526"><tt>string<?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_522"><tt>string=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_532"><tt>string>=?</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_528"><tt>string>?</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_56"><tt>string?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_508">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_542"><tt>substring</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_462"><tt>symbol->string</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_50"><tt>symbol?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_460">[2]</a><br>
|
||||
<a href="r5rs-Z-H-5.html#%_idx_18">syntactic keyword</a>,
|
||||
<a href="r5rs-Z-H-6.html#%_idx_28">[2]</a>, <a href="r5rs-Z-H-7.html#%_idx_168">[3]</a><br>
|
||||
<a href="r5rs-Z-H-8.html#%_idx_200">syntax definition</a><br>
|
||||
<a href="r5rs-Z-H-7.html#%_idx_188"><tt>syntax-rules</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_372"><tt>#t</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_80">tail call</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_334"><tt>tan</tt></a><br>
|
||||
<a href="r5rs-Z-H-10.html#%_idx_674">token</a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_42">top level environment</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_206">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_672"><tt>transcript-off</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_670"><tt>transcript-on</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_66">true</a>, <a href="r5rs-Z-H-7.html#%_idx_102">[2]</a>,
|
||||
<a href="r5rs-Z-H-7.html#%_idx_114">[3]</a>, <a href="r5rs-Z-H-9.html#%_idx_376">[4]</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_380">[5]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_318"><tt>truncate</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_44">type</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_38">unbound</a>, <a href="r5rs-Z-H-7.html#%_idx_84">[2]</a>,
|
||||
<a href="r5rs-Z-H-8.html#%_idx_196">[3]</a><br>
|
||||
<a href="r5rs-Z-H-4.html#%_idx_12">unspecified</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_506">valid indexes</a>,
|
||||
<a href="r5rs-Z-H-9.html#%_idx_554">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_594"><tt>values</tt></a><br>
|
||||
<a href="r5rs-Z-H-5.html#%_idx_16">variable</a>, <a href="r5rs-Z-H-6.html#%_idx_30">[2]</a>,
|
||||
<a href="r5rs-Z-H-7.html#%_idx_82">[3]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_562"><tt>vector</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_570"><tt>vector->list</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_574"><tt>vector-fill!</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_564"><tt>vector-length</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_566"><tt>vector-ref</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_568"><tt>vector-set!</tt></a><br>
|
||||
<a href="r5rs-Z-H-6.html#%_idx_58"><tt>vector?</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_556">[2]</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-5.html#%_idx_20">Whitespace</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_622"><tt>with-input-from-file</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_624"><tt>with-output-to-file</tt></a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_652"><tt>write</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_654">[2]</a><br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_664"><tt>write-char</tt></a>, <a href="r5rs-Z-H-9.html#%_idx_666">[2]</a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_238"><tt>#x</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
<br>
|
||||
<a href="r5rs-Z-H-9.html#%_idx_268"><tt>zero?</tt></a></p>
|
||||
<p>
|
||||
</p>
|
||||
|
||||
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-14.html">previous</a></span><span class=disable>, next</span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span class=disable><span>; </span>index</span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
146
doc/r5rs-std/r5rs-Z-H-2.html
Normal file
|
@ -0,0 +1,146 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-1.html">previous</a></span><span>, <a href="r5rs-Z-H-3.html">next</a></span> page<span>; </span><span class=disable>contents</span><span><span class=disable>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_2"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
Contents</h1>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p> <a name="%_toc_start"></p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_Temp_3" href="r5rs-Z-H-3.html#%_chap_Temp_3">Introduction</a></b><br>
|
||||
<a name="%_toc_%_sec_Temp_4" href="r5rs-Z-H-3.html#%_sec_Temp_4">Background</a><br>
|
||||
<a name="%_toc_%_sec_Temp_5" href="r5rs-Z-H-3.html#%_sec_Temp_5">Acknowledgements</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_1" href="r5rs-Z-H-4.html#%_chap_1">1 Overview of Scheme</a></b><br>
|
||||
<a name="%_toc_%_sec_1.1" href="r5rs-Z-H-4.html#%_sec_1.1">1.1 Semantics</a><br>
|
||||
<a name="%_toc_%_sec_1.2" href="r5rs-Z-H-4.html#%_sec_1.2">1.2 Syntax</a><br>
|
||||
<a name="%_toc_%_sec_1.3" href="r5rs-Z-H-4.html#%_sec_1.3">1.3 Notation and terminology</a><br>
|
||||
<a name="%_toc_%_sec_1.3.1" href="r5rs-Z-H-4.html#%_sec_1.3.1">1.3.1 Primitive, library, and optional features</a><br>
|
||||
<a name="%_toc_%_sec_1.3.2" href="r5rs-Z-H-4.html#%_sec_1.3.2">1.3.2 Error situations and unspecified behavior</a><br>
|
||||
<a name="%_toc_%_sec_1.3.3" href="r5rs-Z-H-4.html#%_sec_1.3.3">1.3.3 Entry format</a><br>
|
||||
<a name="%_toc_%_sec_1.3.4" href="r5rs-Z-H-4.html#%_sec_1.3.4">1.3.4 Evaluation examples</a><br>
|
||||
<a name="%_toc_%_sec_1.3.5" href="r5rs-Z-H-4.html#%_sec_1.3.5">1.3.5 Naming conventions</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_2" href="r5rs-Z-H-5.html#%_chap_2">2 Lexical conventions</a></b><br>
|
||||
<a name="%_toc_%_sec_2.1" href="r5rs-Z-H-5.html#%_sec_2.1">2.1 Identifiers</a><br>
|
||||
<a name="%_toc_%_sec_2.2" href="r5rs-Z-H-5.html#%_sec_2.2">2.2 Whitespace and comments</a><br>
|
||||
<a name="%_toc_%_sec_2.3" href="r5rs-Z-H-5.html#%_sec_2.3">2.3 Other notations</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_3" href="r5rs-Z-H-6.html#%_chap_3">3 Basic concepts</a></b><br>
|
||||
<a name="%_toc_%_sec_3.1" href="r5rs-Z-H-6.html#%_sec_3.1">3.1 Variables, syntactic keywords, and regions</a><br>
|
||||
<a name="%_toc_%_sec_3.2" href="r5rs-Z-H-6.html#%_sec_3.2">3.2 Disjointness of types</a><br>
|
||||
<a name="%_toc_%_sec_3.3" href="r5rs-Z-H-6.html#%_sec_3.3">3.3 External representations</a><br>
|
||||
<a name="%_toc_%_sec_3.4" href="r5rs-Z-H-6.html#%_sec_3.4">3.4 Storage model</a><br>
|
||||
<a name="%_toc_%_sec_3.5" href="r5rs-Z-H-6.html#%_sec_3.5">3.5 Proper tail recursion</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_4" href="r5rs-Z-H-7.html#%_chap_4">4 Expressions</a></b><br>
|
||||
<a name="%_toc_%_sec_4.1" href="r5rs-Z-H-7.html#%_sec_4.1">4.1 Primitive expression types</a><br>
|
||||
<a name="%_toc_%_sec_4.1.1" href="r5rs-Z-H-7.html#%_sec_4.1.1">4.1.1 Variable references</a><br>
|
||||
<a name="%_toc_%_sec_4.1.2" href="r5rs-Z-H-7.html#%_sec_4.1.2">4.1.2 Literal expressions</a><br>
|
||||
<a name="%_toc_%_sec_4.1.3" href="r5rs-Z-H-7.html#%_sec_4.1.3">4.1.3 Procedure calls</a><br>
|
||||
<a name="%_toc_%_sec_4.1.4" href="r5rs-Z-H-7.html#%_sec_4.1.4">4.1.4 Procedures</a><br>
|
||||
<a name="%_toc_%_sec_4.1.5" href="r5rs-Z-H-7.html#%_sec_4.1.5">4.1.5 Conditionals</a><br>
|
||||
<a name="%_toc_%_sec_4.1.6" href="r5rs-Z-H-7.html#%_sec_4.1.6">4.1.6 Assignments</a><br>
|
||||
<a name="%_toc_%_sec_4.2" href="r5rs-Z-H-7.html#%_sec_4.2">4.2 Derived expression types</a><br>
|
||||
<a name="%_toc_%_sec_4.2.1" href="r5rs-Z-H-7.html#%_sec_4.2.1">4.2.1 Conditionals</a><br>
|
||||
<a name="%_toc_%_sec_4.2.2" href="r5rs-Z-H-7.html#%_sec_4.2.2">4.2.2 Binding constructs</a><br>
|
||||
<a name="%_toc_%_sec_4.2.3" href="r5rs-Z-H-7.html#%_sec_4.2.3">4.2.3 Sequencing</a><br>
|
||||
<a name="%_toc_%_sec_4.2.4" href="r5rs-Z-H-7.html#%_sec_4.2.4">4.2.4 Iteration</a><br>
|
||||
<a name="%_toc_%_sec_4.2.5" href="r5rs-Z-H-7.html#%_sec_4.2.5">4.2.5 Delayed evaluation</a><br>
|
||||
<a name="%_toc_%_sec_4.2.6" href="r5rs-Z-H-7.html#%_sec_4.2.6">4.2.6 Quasiquotation</a><br>
|
||||
<a name="%_toc_%_sec_4.3" href="r5rs-Z-H-7.html#%_sec_4.3">4.3 Macros</a><br>
|
||||
<a name="%_toc_%_sec_4.3.1" href="r5rs-Z-H-7.html#%_sec_4.3.1">4.3.1 Binding constructs for syntactic keywords</a><br>
|
||||
<a name="%_toc_%_sec_4.3.2" href="r5rs-Z-H-7.html#%_sec_4.3.2">4.3.2 Pattern language</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_5" href="r5rs-Z-H-8.html#%_chap_5">5 Program structure</a></b><br>
|
||||
<a name="%_toc_%_sec_5.1" href="r5rs-Z-H-8.html#%_sec_5.1">5.1 Programs</a><br>
|
||||
<a name="%_toc_%_sec_5.2" href="r5rs-Z-H-8.html#%_sec_5.2">5.2 Definitions</a><br>
|
||||
<a name="%_toc_%_sec_5.2.1" href="r5rs-Z-H-8.html#%_sec_5.2.1">5.2.1 Top level definitions</a><br>
|
||||
<a name="%_toc_%_sec_5.2.2" href="r5rs-Z-H-8.html#%_sec_5.2.2">5.2.2 Internal definitions</a><br>
|
||||
<a name="%_toc_%_sec_5.3" href="r5rs-Z-H-8.html#%_sec_5.3">5.3 Syntax definitions</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_6" href="r5rs-Z-H-9.html#%_chap_6">6 Standard procedures</a></b><br>
|
||||
<a name="%_toc_%_sec_6.1" href="r5rs-Z-H-9.html#%_sec_6.1">6.1 Equivalence predicates</a><br>
|
||||
<a name="%_toc_%_sec_6.2" href="r5rs-Z-H-9.html#%_sec_6.2">6.2 Numbers</a><br>
|
||||
<a name="%_toc_%_sec_6.2.1" href="r5rs-Z-H-9.html#%_sec_6.2.1">6.2.1 Numerical types</a><br>
|
||||
<a name="%_toc_%_sec_6.2.2" href="r5rs-Z-H-9.html#%_sec_6.2.2">6.2.2 Exactness</a><br>
|
||||
<a name="%_toc_%_sec_6.2.3" href="r5rs-Z-H-9.html#%_sec_6.2.3">6.2.3 Implementation restrictions</a><br>
|
||||
<a name="%_toc_%_sec_6.2.4" href="r5rs-Z-H-9.html#%_sec_6.2.4">6.2.4 Syntax of numerical constants</a><br>
|
||||
<a name="%_toc_%_sec_6.2.5" href="r5rs-Z-H-9.html#%_sec_6.2.5">6.2.5 Numerical operations</a><br>
|
||||
<a name="%_toc_%_sec_6.2.6" href="r5rs-Z-H-9.html#%_sec_6.2.6">6.2.6 Numerical input and output</a><br>
|
||||
<a name="%_toc_%_sec_6.3" href="r5rs-Z-H-9.html#%_sec_6.3">6.3 Other data types</a><br>
|
||||
<a name="%_toc_%_sec_6.3.1" href="r5rs-Z-H-9.html#%_sec_6.3.1">6.3.1 Booleans</a><br>
|
||||
<a name="%_toc_%_sec_6.3.2" href="r5rs-Z-H-9.html#%_sec_6.3.2">6.3.2 Pairs and lists</a><br>
|
||||
<a name="%_toc_%_sec_6.3.3" href="r5rs-Z-H-9.html#%_sec_6.3.3">6.3.3 Symbols</a><br>
|
||||
<a name="%_toc_%_sec_6.3.4" href="r5rs-Z-H-9.html#%_sec_6.3.4">6.3.4 Characters</a><br>
|
||||
<a name="%_toc_%_sec_6.3.5" href="r5rs-Z-H-9.html#%_sec_6.3.5">6.3.5 Strings</a><br>
|
||||
<a name="%_toc_%_sec_6.3.6" href="r5rs-Z-H-9.html#%_sec_6.3.6">6.3.6 Vectors</a><br>
|
||||
<a name="%_toc_%_sec_6.4" href="r5rs-Z-H-9.html#%_sec_6.4">6.4 Control features</a><br>
|
||||
<a name="%_toc_%_sec_6.5" href="r5rs-Z-H-9.html#%_sec_6.5">6.5 <tt>Eval</tt></a><br>
|
||||
<a name="%_toc_%_sec_6.6" href="r5rs-Z-H-9.html#%_sec_6.6">6.6 Input and output</a><br>
|
||||
<a name="%_toc_%_sec_6.6.1" href="r5rs-Z-H-9.html#%_sec_6.6.1">6.6.1 Ports</a><br>
|
||||
<a name="%_toc_%_sec_6.6.2" href="r5rs-Z-H-9.html#%_sec_6.6.2">6.6.2 Input</a><br>
|
||||
<a name="%_toc_%_sec_6.6.3" href="r5rs-Z-H-9.html#%_sec_6.6.3">6.6.3 Output</a><br>
|
||||
<a name="%_toc_%_sec_6.6.4" href="r5rs-Z-H-9.html#%_sec_6.6.4">6.6.4 System interface</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_7" href="r5rs-Z-H-10.html#%_chap_7">7 Formal syntax and semantics</a></b><br>
|
||||
<a name="%_toc_%_sec_7.1" href="r5rs-Z-H-10.html#%_sec_7.1">7.1 Formal syntax</a><br>
|
||||
<a name="%_toc_%_sec_7.1.1" href="r5rs-Z-H-10.html#%_sec_7.1.1">7.1.1 Lexical structure</a><br>
|
||||
<a name="%_toc_%_sec_7.1.2" href="r5rs-Z-H-10.html#%_sec_7.1.2">7.1.2 External representations</a><br>
|
||||
<a name="%_toc_%_sec_7.1.3" href="r5rs-Z-H-10.html#%_sec_7.1.3">7.1.3 Expressions</a><br>
|
||||
<a name="%_toc_%_sec_7.1.4" href="r5rs-Z-H-10.html#%_sec_7.1.4">7.1.4 Quasiquotations</a><br>
|
||||
<a name="%_toc_%_sec_7.1.5" href="r5rs-Z-H-10.html#%_sec_7.1.5">7.1.5 Transformers</a><br>
|
||||
<a name="%_toc_%_sec_7.1.6" href="r5rs-Z-H-10.html#%_sec_7.1.6">7.1.6 Programs and definitions</a><br>
|
||||
<a name="%_toc_%_sec_7.2" href="r5rs-Z-H-10.html#%_sec_7.2">7.2 Formal semantics</a><br>
|
||||
<a name="%_toc_%_sec_7.2.1" href="r5rs-Z-H-10.html#%_sec_7.2.1">7.2.1 Abstract syntax</a><br>
|
||||
<a name="%_toc_%_sec_7.2.2" href="r5rs-Z-H-10.html#%_sec_7.2.2">7.2.2 Domain equations</a><br>
|
||||
<a name="%_toc_%_sec_7.2.3" href="r5rs-Z-H-10.html#%_sec_7.2.3">7.2.3 Semantic functions</a><br>
|
||||
<a name="%_toc_%_sec_7.2.4" href="r5rs-Z-H-10.html#%_sec_7.2.4">7.2.4 Auxiliary functions</a><br>
|
||||
<a name="%_toc_%_sec_7.3" href="r5rs-Z-H-10.html#%_sec_7.3">7.3 Derived expression types</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_Temp_6" href="r5rs-Z-H-11.html#%_chap_Temp_6">Notes</a></b><br>
|
||||
<a name="%_toc_%_sec_Temp_7" href="r5rs-Z-H-11.html#%_sec_Temp_7">Language changes</a><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_Temp_8" href="r5rs-Z-H-12.html#%_chap_Temp_8">Additional material</a></b><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_Temp_9" href="r5rs-Z-H-13.html#%_chap_Temp_9">Example</a></b><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_Temp_10" href="r5rs-Z-H-14.html#%_chap_Temp_10">Bibliography</a></b><br>
|
||||
</p>
|
||||
<p><b>
|
||||
<a name="%_toc_%_chap_Temp_11" href="r5rs-Z-H-15.html#%_chap_Temp_11">Alphabetic Index of Definitions of Concepts,
|
||||
Keywords, and Procedures</a></b><br>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-1.html">previous</a></span><span>, <a href="r5rs-Z-H-3.html">next</a></span> page<span>; </span><span class=disable>contents</span><span><span class=disable>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
135
doc/r5rs-std/r5rs-Z-H-3.html
Normal file
|
@ -0,0 +1,135 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-2.html">previous</a></span><span>, <a href="r5rs-Z-H-4.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_Temp_3"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading> </div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_Temp_3">Introduction</a></h1>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
Programming languages should be designed not by piling feature on top of
|
||||
feature, but by removing the weaknesses and restrictions that make additional
|
||||
features appear necessary. Scheme demonstrates that a very small number
|
||||
of rules for forming expressions, with no restrictions on how they are
|
||||
composed, suffice to form a practical and efficient programming language
|
||||
that is flexible enough to support most of the major programming
|
||||
paradigms in use today.</p>
|
||||
<p>
|
||||
Scheme
|
||||
was one of the first programming languages to incorporate first class
|
||||
procedures as in the lambda calculus, thereby proving the usefulness of
|
||||
static scope rules and block structure in a dynamically typed language.
|
||||
Scheme was the first major dialect of Lisp to distinguish procedures
|
||||
from lambda expressions and symbols, to use a single lexical
|
||||
environment for all variables, and to evaluate the operator position
|
||||
of a procedure call in the same way as an operand position. By relying
|
||||
entirely on procedure calls to express iteration, Scheme emphasized the
|
||||
fact that tail-recursive procedure calls are essentially goto's that
|
||||
pass arguments. Scheme was the first widely used programming language to
|
||||
embrace first class escape procedures, from which all previously known
|
||||
sequential control structures can be synthesized. A subsequent
|
||||
version of Scheme introduced the concept of exact and inexact numbers,
|
||||
an extension of Common Lisp's generic arithmetic.
|
||||
More recently, Scheme became the first programming language to support
|
||||
hygienic macros, which permit the syntax of a block-structured language
|
||||
to be extended in a consistent and reliable manner.
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_Temp_4"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_Temp_4">Background</a></h3>
|
||||
<p>The first description of Scheme was written in
|
||||
1975 [<a href="r5rs-Z-H-14.html#cite{Scheme75}">28</a>]. A revised report [<a href="r5rs-Z-H-14.html#cite{Scheme78}">25</a>]
|
||||
appeared in 1978, which described the evolution
|
||||
of the language as its MIT implementation was upgraded to support an
|
||||
innovative compiler [<a href="r5rs-Z-H-14.html#cite{Rabbit}">26</a>]. Three distinct projects began in
|
||||
1981 and 1982 to use variants of Scheme for courses at MIT, Yale, and
|
||||
Indiana University [<a href="r5rs-Z-H-14.html#cite{Rees82}">21</a>, <a href="r5rs-Z-H-14.html#cite{MITScheme}">17</a>, <a href="r5rs-Z-H-14.html#cite{Scheme311}">10</a>]. An introductory
|
||||
computer science textbook using Scheme was published in
|
||||
1984 [<a href="r5rs-Z-H-14.html#cite{SICP}">1</a>].</p>
|
||||
<p>
|
||||
As Scheme became more widespread,
|
||||
local dialects began to diverge until students and researchers
|
||||
occasionally found it difficult to understand code written at other
|
||||
sites.
|
||||
Fifteen representatives of the major implementations of Scheme therefore
|
||||
met in October 1984 to work toward a better and more widely accepted
|
||||
standard for Scheme.
|
||||
Their report [<a href="r5rs-Z-H-14.html#cite{RRRS}">4</a>]
|
||||
was published at MIT and Indiana University in the summer of 1985.
|
||||
Further revision took place in the spring of 1986 [<a href="r5rs-Z-H-14.html#cite{R3RS}">23</a>],
|
||||
and in the spring of 1988 [<a href="r5rs-Z-H-14.html#cite{R4RS}">6</a>].
|
||||
The present report reflects further revisions agreed upon in a meeting
|
||||
at Xerox PARC in June 1992.</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>
|
||||
We intend this report to belong to the entire Scheme community, and so
|
||||
we grant permission to copy it in whole or in part without fee. In
|
||||
particular, we encourage implementors of Scheme to use this report as
|
||||
a starting point for manuals and other documentation, modifying it as
|
||||
necessary.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_Temp_5"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_Temp_5">Acknowledgements</a></h3>
|
||||
<p>We would like to thank the following people for their help: Alan Bawden, Michael
|
||||
Blair, George Carrette, Andy Cromarty, Pavel Curtis, Jeff Dalton, Olivier Danvy,
|
||||
Ken Dickey, Bruce Duba, Marc Feeley,
|
||||
Andy Freeman, Richard Gabriel, Yekta Gürsel, Ken Haase, Robert
|
||||
Hieb, Paul Hudak, Morry Katz, Chris Lindblad, Mark Meyer, Jim Miller, Jim Philbin,
|
||||
John Ramsdell, Mike Shaff, Jonathan Shapiro, Julie Sussman,
|
||||
Perry Wagle, Daniel Weise, Henry Wu, and Ozan Yigit.
|
||||
We thank Carol Fessenden, Daniel
|
||||
Friedman, and Christopher Haynes for permission to use text from the Scheme 311
|
||||
version 4 reference manual. We thank Texas Instruments, Inc. for permission to
|
||||
use text from the <em>TI Scheme Language Reference Manual</em>[<a href="r5rs-Z-H-14.html#cite{TImanual85}">30</a>].
|
||||
We gladly acknowledge the influence of manuals for MIT Scheme[<a href="r5rs-Z-H-14.html#cite{MITScheme}">17</a>],
|
||||
T[<a href="r5rs-Z-H-14.html#cite{Rees84}">22</a>], Scheme 84[<a href="r5rs-Z-H-14.html#cite{Scheme84}">11</a>],Common Lisp[<a href="r5rs-Z-H-14.html#cite{CLtL}">27</a>],
|
||||
and Algol 60[<a href="r5rs-Z-H-14.html#cite{Naur63}">18</a>].</p>
|
||||
<p>
|
||||
We also thank Betty Dexter for the extreme effort she put into
|
||||
setting this report in T<small>E</small>X, and Donald Knuth for designing the program
|
||||
that caused her troubles.</p>
|
||||
<p>
|
||||
The Artificial Intelligence Laboratory of the
|
||||
Massachusetts Institute of Technology, the Computer Science
|
||||
Department of Indiana University, the Computer and Information
|
||||
Sciences Department of the University of Oregon, and the NEC Research
|
||||
Institute supported the preparation of this report. Support for the MIT
|
||||
work was provided in part by
|
||||
the Advanced Research Projects Agency of the Department of Defense under Office
|
||||
of Naval Research contract N00014-80-C-0505. Support for the Indiana
|
||||
University work was provided by NSF grants NCS 83-04567 and NCS
|
||||
83-03325.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-2.html">previous</a></span><span>, <a href="r5rs-Z-H-4.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
300
doc/r5rs-std/r5rs-Z-H-4.html
Normal file
|
@ -0,0 +1,300 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-3.html">previous</a></span><span>, <a href="r5rs-Z-H-5.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_1"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading><a href="r5rs-Z-H-2.html#%_toc_%_chap_1">Chapter 1</a></div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_1">Overview of Scheme</a></h1>
|
||||
<p></p>
|
||||
<a name="%_sec_1.1"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.1">1.1 Semantics</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
This section gives an overview of Scheme's semantics. A
|
||||
detailed informal semantics is the subject of
|
||||
chapters <a href="r5rs-Z-H-6.html#%_chap_3">3</a> through <a href="r5rs-Z-H-9.html#%_chap_6">6</a>. For reference
|
||||
purposes, section <a href="r5rs-Z-H-10.html#%_sec_7.2">7.2</a> provides a formal
|
||||
semantics of Scheme.</p>
|
||||
<p>
|
||||
Following Algol, Scheme is a statically scoped programming
|
||||
language. Each use of a variable is associated with a lexically
|
||||
apparent binding of that variable.</p>
|
||||
<p>
|
||||
Scheme has latent as opposed to manifest types. Types
|
||||
are associated with values (also called objects<a name="%_idx_2"></a>) rather than
|
||||
with variables. (Some authors refer to languages with latent types as
|
||||
weakly typed or dynamically typed languages.) Other languages with
|
||||
latent types are APL, Snobol, and other dialects of Lisp. Languages
|
||||
with manifest types (sometimes referred to as strongly typed or
|
||||
statically typed languages) include Algol 60, Pascal, and C.</p>
|
||||
<p>
|
||||
All objects created in the course of a Scheme computation, including
|
||||
procedures and continuations, have unlimited extent.
|
||||
No Scheme object is ever destroyed. The reason that
|
||||
implementations of Scheme do not (usually!) run out of storage is that
|
||||
they are permitted to reclaim the storage occupied by an object if
|
||||
they can prove that the object cannot possibly matter to any future
|
||||
computation. Other languages in which most objects have unlimited
|
||||
extent include APL and other Lisp dialects.</p>
|
||||
<p>
|
||||
Implementations of Scheme are required to be properly tail-recursive.
|
||||
This allows the execution of an iterative computation in constant space,
|
||||
even if the iterative computation is described by a syntactically
|
||||
recursive procedure. Thus with a properly tail-recursive implementation,
|
||||
iteration can be expressed using the ordinary procedure-call
|
||||
mechanics, so that special iteration constructs are useful only as
|
||||
syntactic sugar. See section <a href="r5rs-Z-H-6.html#%_sec_3.5">3.5</a>.</p>
|
||||
<p>
|
||||
Scheme procedures are objects in their own right. Procedures can be
|
||||
created dynamically, stored in data structures, returned as results of
|
||||
procedures, and so on. Other languages with these properties include
|
||||
Common Lisp and ML. </p>
|
||||
<p>
|
||||
One distinguishing feature of Scheme is that continuations, which
|
||||
in most other languages only operate behind the scenes, also have
|
||||
``first-class'' status. Continuations are useful for implementing a
|
||||
wide variety of advanced control constructs, including non-local exits,
|
||||
backtracking, and coroutines. See section <a href="r5rs-Z-H-9.html#%_sec_6.4">6.4</a>.</p>
|
||||
<p>
|
||||
Arguments to Scheme procedures are always passed by value, which
|
||||
means that the actual argument expressions are evaluated before the
|
||||
procedure gains control, whether the procedure needs the result of the
|
||||
evaluation or not. ML, C, and APL are three other languages that always
|
||||
pass arguments by value.
|
||||
This is distinct from the lazy-evaluation semantics of Haskell,
|
||||
or the call-by-name semantics of Algol 60, where an argument
|
||||
expression is not evaluated unless its value is needed by the
|
||||
procedure.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
Scheme's model of arithmetic is designed to remain as independent as
|
||||
possible of the particular ways in which numbers are represented within a
|
||||
computer. In Scheme, every integer is a rational number, every rational is a
|
||||
real, and every real is a complex number. Thus the distinction between integer
|
||||
and real arithmetic, so important to many programming languages, does not
|
||||
appear in Scheme. In its place is a distinction between exact arithmetic,
|
||||
which corresponds to the mathematical ideal, and inexact arithmetic on
|
||||
approximations. As in Common Lisp, exact arithmetic is not limited to
|
||||
integers.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_1.2"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.2">1.2 Syntax</a></h2>
|
||||
<p>Scheme, like most dialects of Lisp, employs a fully parenthesized prefix
|
||||
notation for programs and (other) data; the grammar of Scheme generates a
|
||||
sublanguage of the language used for data. An important
|
||||
consequence of this simple, uniform representation is the susceptibility of
|
||||
Scheme programs and data to uniform treatment by other Scheme programs.
|
||||
For example, the <tt>eval</tt> procedure evaluates a Scheme program expressed
|
||||
as data.</p>
|
||||
<p>
|
||||
The <tt>read</tt> procedure performs syntactic as well as lexical decomposition of
|
||||
the data it reads. The <tt>read</tt> procedure parses its input as data
|
||||
(section <a href="r5rs-Z-H-10.html#%_sec_7.1.2">7.1.2</a>), not as program.</p>
|
||||
<p>
|
||||
The formal syntax of Scheme is described in section <a href="r5rs-Z-H-10.html#%_sec_7.1">7.1</a>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_1.3"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.3">1.3 Notation and terminology</a></h2>
|
||||
<p></p>
|
||||
<a name="%_sec_1.3.1"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.3.1">1.3.1 Primitive, library, and optional features</a></h3>
|
||||
<p></p>
|
||||
<p>
|
||||
It is required that every implementation of Scheme support all
|
||||
features that are not marked as being <a name="%_idx_4"></a><em>optional</em>. Implementations are
|
||||
free to omit optional features of Scheme or to add extensions,
|
||||
provided the extensions are not in conflict with the language reported
|
||||
here. In particular, implementations must support portable code by
|
||||
providing a syntactic mode that preempts no lexical conventions of this
|
||||
report.</p>
|
||||
<p>
|
||||
To aid in understanding and implementing Scheme, some features are marked
|
||||
as <a name="%_idx_6"></a><em>library</em>. These can be easily implemented in terms of the other,
|
||||
primitive, features. They are redundant in the strict sense of
|
||||
the word, but they capture common patterns of usage, and are therefore
|
||||
provided as convenient abbreviations.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_1.3.2"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.3.2">1.3.2 Error situations and unspecified behavior</a></h3>
|
||||
<p><a name="%_idx_8"></a>
|
||||
When speaking of an error situation, this report uses the phrase ``an
|
||||
error is signalled'' to indicate that implementations must detect and
|
||||
report the error. If such wording does not appear in the discussion of
|
||||
an error, then implementations are not required to detect or report the
|
||||
error, though they are encouraged to do so. An error situation that
|
||||
implementations are not required to detect is usually referred to simply
|
||||
as ``an error.''</p>
|
||||
<p>
|
||||
For example, it is an error for a procedure to be passed an argument that
|
||||
the procedure is not explicitly specified to handle, even though such
|
||||
domain errors are seldom mentioned in this report. Implementations may
|
||||
extend a procedure's domain of definition to include such arguments.</p>
|
||||
<p>
|
||||
This report uses the phrase ``may report a violation of an
|
||||
implementation restriction'' to indicate circumstances under which an
|
||||
implementation is permitted to report that it is unable to continue
|
||||
execution of a correct program because of some restriction imposed by the
|
||||
implementation. Implementation restrictions are of course discouraged,
|
||||
but implementations are encouraged to report violations of implementation
|
||||
restrictions.<a name="%_idx_10"></a></p>
|
||||
<p>
|
||||
For example, an implementation may report a violation of an
|
||||
implementation restriction if it does not have enough storage to run a
|
||||
program.</p>
|
||||
<p>
|
||||
If the value of an expression is said to be ``unspecified,'' then
|
||||
the expression must evaluate to some object without signalling an error,
|
||||
but the value depends on the implementation; this report explicitly does
|
||||
not say what value should be returned. <a name="%_idx_12"></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_1.3.3"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.3.3">1.3.3 Entry format</a></h3>
|
||||
<p>Chapters <a href="r5rs-Z-H-7.html#%_chap_4">4</a> and <a href="r5rs-Z-H-9.html#%_chap_6">6</a> are organized
|
||||
into entries. Each entry describes one language feature or a group of
|
||||
related features, where a feature is either a syntactic construct or a
|
||||
built-in procedure. An entry begins with one or more header lines of the form</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><u><i>category</i>:</u> <tt><i>template</i></tt> </div>
|
||||
|
||||
<p>
|
||||
for required, primitive features, or</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><u><i>qualifier</i> <i>category</i>:</u> <tt><i>template</i></tt> </div>
|
||||
|
||||
<p>
|
||||
where <i>qualifier</i> is either ``library'' or ``optional'' as defined
|
||||
in section <a href="#%_sec_1.3.1">1.3.1</a>.</p>
|
||||
<p>
|
||||
If <i>category</i> is ``syntax'', the entry describes an expression
|
||||
type, and the template gives the syntax of the expression type.
|
||||
Components of expressions are designated by syntactic variables, which
|
||||
are written using angle brackets, for example, <expression>,
|
||||
<variable>. Syntactic variables should be understood to denote segments of
|
||||
program text; for example, <expression> stands for any string of
|
||||
characters which is a syntactically valid expression. The notation
|
||||
</p>
|
||||
<p>
|
||||
<thing<sub>1</sub>> <tt>...</tt>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
indicates zero or more occurrences of a <thing>, and
|
||||
</p>
|
||||
<p>
|
||||
<thing<sub>1</sub>> <thing<sub>2</sub>> <tt>...</tt>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
indicates one or more occurrences of a <thing>.</p>
|
||||
<p>
|
||||
If <i>category</i> is ``procedure'', then the entry describes a procedure, and
|
||||
the header line gives a template for a call to the procedure. Argument
|
||||
names in the template are <i>italicized</i>. Thus the header line</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><u>procedure:</u> <tt>(vector-ref <i>vector</i> <i>k</i>)</tt> </div>
|
||||
|
||||
<p>
|
||||
indicates that the built-in procedure <tt>vector-ref</tt> takes
|
||||
two arguments, a vector <i>vector</i> and an exact non-negative integer
|
||||
<i>k</i> (see below). The header lines</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=left><u>procedure:</u> <tt>(make-vector <i>k</i>)</tt> </div>
|
||||
|
||||
<div align=left><u>procedure:</u> <tt>(make-vector <i>k</i> <i>fill</i>)</tt> </div>
|
||||
|
||||
<p>
|
||||
indicate that the <tt>make-vector</tt> procedure must be defined to take
|
||||
either one or two arguments.</p>
|
||||
<p>
|
||||
|
||||
It is an error for an operation to be presented with an argument that it
|
||||
is not specified to handle. For succinctness, we follow the convention
|
||||
that if an argument name is also the name of a type listed in
|
||||
section <a href="r5rs-Z-H-6.html#%_sec_3.2">3.2</a>, then that argument must be of the named type.
|
||||
For example, the header line for <tt>vector-ref</tt> given above dictates that the
|
||||
first argument to <tt>vector-ref</tt> must be a vector. The following naming
|
||||
conventions also imply type restrictions:
|
||||
|
||||
</p>
|
||||
<div align=left><table><tr><td>
|
||||
|
||||
|
||||
<table border=0><tr><td valign=top ><i>obj</i></td><td valign=top >any object</td></tr>
|
||||
<tr><td valign=top ><em>l</em><em>i</em><em>s</em><em>t</em>, <em>l</em><em>i</em><em>s</em><em>t</em><sub>1</sub>, <tt>...</tt> <em>l</em><em>i</em><em>s</em><em>t</em><sub><em>j</em></sub>, <tt>...</tt></td><td valign=top >list (see section <a href="r5rs-Z-H-9.html#%_sec_6.3.2">6.3.2</a>)</td></tr>
|
||||
<tr><td valign=top ><em>z</em>, <em>z</em><sub>1</sub>, <tt>...</tt> <em>z</em><sub><em>j</em></sub>, <tt>...</tt></td><td valign=top >complex number</td></tr>
|
||||
<tr><td valign=top ><em>x</em>, <em>x</em><sub>1</sub>, <tt>...</tt> <em>x</em><sub><em>j</em></sub>, <tt>...</tt></td><td valign=top >real number</td></tr>
|
||||
<tr><td valign=top ><em>y</em>, <em>y</em><sub>1</sub>, <tt>...</tt> <em>y</em><sub><em>j</em></sub>, <tt>...</tt></td><td valign=top >real number</td></tr>
|
||||
<tr><td valign=top ><em>q</em>, <em>q</em><sub>1</sub>, <tt>...</tt> <em>q</em><sub><em>j</em></sub>, <tt>...</tt></td><td valign=top >rational number</td></tr>
|
||||
<tr><td valign=top ><em>n</em>, <em>n</em><sub>1</sub>, <tt>...</tt> <em>n</em><sub><em>j</em></sub>, <tt>...</tt></td><td valign=top >integer</td></tr>
|
||||
<tr><td valign=top ><em>k</em>, <em>k</em><sub>1</sub>, <tt>...</tt> <em>k</em><sub><em>j</em></sub>, <tt>...</tt></td><td valign=top >exact non-negative integer</td></tr>
|
||||
<tr><td valign=top ></td></tr></table>
|
||||
</td></tr></table></div>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_1.3.4"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.3.4">1.3.4 Evaluation examples</a></h3>
|
||||
<p>The symbol ``===>'' used in program examples should be read
|
||||
``evaluates to.'' For example,</p>
|
||||
<p>
|
||||
<tt>(* 5 8) ===> 40</p>
|
||||
</tt>
|
||||
<p>
|
||||
means that the expression <tt>(* 5 8)</tt> evaluates to the object <tt>40</tt>.
|
||||
Or, more precisely: the expression given by the sequence of characters
|
||||
``<tt>(* 5 8)</tt>'' evaluates, in the initial environment, to an object
|
||||
that may be represented externally by the sequence of characters ``<tt>40</tt>''. See section <a href="r5rs-Z-H-6.html#%_sec_3.3">3.3</a> for a discussion of external
|
||||
representations of objects.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_1.3.5"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_1.3.5">1.3.5 Naming conventions</a></h3>
|
||||
<p>By convention, the names of procedures that always return a boolean
|
||||
value usually end
|
||||
in ``<tt>?</tt>''. Such procedures are called predicates.</p>
|
||||
<p>
|
||||
By convention, the names of procedures that store values into previously
|
||||
allocated locations (see section <a href="r5rs-Z-H-6.html#%_sec_3.4">3.4</a>) usually end in
|
||||
``<tt>!</tt>''.
|
||||
Such procedures are called mutation procedures.
|
||||
By convention, the value returned by a mutation procedure is unspecified.</p>
|
||||
<p>
|
||||
By convention, ``<tt>-></tt>'' appears within the names of procedures that
|
||||
take an object of one type and return an analogous object of another type.
|
||||
For example, <tt>list->vector</tt> takes a list and returns a vector whose
|
||||
elements are the same as those of the list.</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-3.html">previous</a></span><span>, <a href="r5rs-Z-H-5.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
201
doc/r5rs-std/r5rs-Z-H-5.html
Normal file
|
@ -0,0 +1,201 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-4.html">previous</a></span><span>, <a href="r5rs-Z-H-6.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_2"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading><a href="r5rs-Z-H-2.html#%_toc_%_chap_2">Chapter 2</a></div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_2">Lexical conventions</a></h1>
|
||||
<p>This section gives an informal account of some of the lexical
|
||||
conventions used in writing Scheme programs. For a formal syntax of
|
||||
Scheme, see section <a href="r5rs-Z-H-10.html#%_sec_7.1">7.1</a>.</p>
|
||||
<p>
|
||||
Upper and lower case forms of a letter are never distinguished
|
||||
except within character and string constants. For example, <tt>Foo</tt> is
|
||||
the same identifier as <tt>FOO</tt>, and <tt>#x1AB</tt> is the same number as
|
||||
<tt>#X1ab</tt>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_2.1"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_2.1">2.1 Identifiers</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Most identifiers<a name="%_idx_14"></a> allowed by other programming
|
||||
languages are also acceptable to Scheme. The precise rules for forming
|
||||
identifiers vary among implementations of Scheme, but in all
|
||||
implementations a sequence of letters, digits, and ``extended alphabetic
|
||||
characters'' that begins with a character that cannot begin a number is
|
||||
an identifier. In addition, <tt>+</tt>, <tt>-</tt>, and <tt>...</tt> are identifiers.
|
||||
Here are some examples of identifiers:</p>
|
||||
<p>
|
||||
<tt>lambda q<br>
|
||||
list->vector soup<br>
|
||||
+ V17a<br>
|
||||
<=? a34kTMNs<br>
|
||||
the-word-recursion-has-many-meanings</p>
|
||||
</tt>
|
||||
<p>
|
||||
Extended alphabetic characters may be used within identifiers as if
|
||||
they were letters. The following are extended alphabetic characters:</p>
|
||||
<p>
|
||||
<tt>! $ % <code class=verbatim>&</code> * + - . / : < = > ? @ <code class=verbatim>^</code> <code class=verbatim>_</code> <code class=verbatim>~</code> </p>
|
||||
</tt>
|
||||
<p>
|
||||
See section <a href="r5rs-Z-H-10.html#%_sec_7.1.1">7.1.1</a> for a formal syntax of identifiers.</p>
|
||||
<p>
|
||||
Identifiers have two uses within Scheme programs:
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>Any identifier may be used as a variable<a name="%_idx_16"></a>
|
||||
or as a syntactic keyword<a name="%_idx_18"></a>
|
||||
(see sections <a href="r5rs-Z-H-6.html#%_sec_3.1">3.1</a> and <a href="r5rs-Z-H-7.html#%_sec_4.3">4.3</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p>When an identifier appears as a literal or within a literal
|
||||
(see section <a href="r5rs-Z-H-7.html#%_sec_4.1.2">4.1.2</a>), it is being used to denote a <em>symbol</em>
|
||||
(see section <a href="r5rs-Z-H-9.html#%_sec_6.3.3">6.3.3</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_2.2"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_2.2">2.2 Whitespace and comments</a></h2>
|
||||
<p><a name="%_idx_20"></a><em>Whitespace</em> characters are spaces and newlines.
|
||||
(Implementations typically provide additional whitespace characters such
|
||||
as tab or page break.) Whitespace is used for improved readability and
|
||||
as necessary to separate tokens from each other, a token being an
|
||||
indivisible lexical unit such as an identifier or number, but is
|
||||
otherwise insignificant. Whitespace may occur between any two tokens,
|
||||
but not within a token. Whitespace may also occur inside a string,
|
||||
where it is significant.</p>
|
||||
<p>
|
||||
A semicolon (<tt>;</tt>) indicates the start of a
|
||||
comment.<a name="%_idx_22"></a><a name="%_idx_24"></a> The comment continues to the
|
||||
end of the line on which the semicolon appears. Comments are invisible
|
||||
to Scheme, but the end of the line is visible as whitespace. This
|
||||
prevents a comment from appearing in the middle of an identifier or
|
||||
number.</p>
|
||||
<p>
|
||||
<tt>;;; The FACT procedure computes the factorial<br>
|
||||
;;; of a non-negative integer.<br>
|
||||
(define fact<br>
|
||||
(lambda (n)<br>
|
||||
(if (= n 0)<br>
|
||||
1 ;Base case: return 1<br>
|
||||
(* n (fact (- n 1))))))</p>
|
||||
</tt>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_2.3"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_2.3">2.3 Other notations</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
For a description of the notations used for numbers, see
|
||||
section <a href="r5rs-Z-H-9.html#%_sec_6.2">6.2</a>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<ul>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>. + -</tt></b>
|
||||
These are used in numbers, and may also occur anywhere in an identifier
|
||||
except as the first character. A delimited plus or minus sign by itself
|
||||
is also an identifier.
|
||||
A delimited period (not occurring within a number or identifier) is used
|
||||
in the notation for pairs (section <a href="r5rs-Z-H-9.html#%_sec_6.3.2">6.3.2</a>), and to indicate a
|
||||
rest-parameter in a formal parameter list (section <a href="r5rs-Z-H-7.html#%_sec_4.1.4">4.1.4</a>).
|
||||
A delimited sequence of three successive periods is also an identifier.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>( )</tt></b>
|
||||
Parentheses are used for grouping and to notate lists
|
||||
(section <a href="r5rs-Z-H-9.html#%_sec_6.3.2">6.3.2</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>'</tt></b>
|
||||
The single quote character is used to indicate literal data (section <a href="r5rs-Z-H-7.html#%_sec_4.1.2">4.1.2</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>`</tt></b>
|
||||
The backquote character is used to indicate almost-constant
|
||||
data (section <a href="r5rs-Z-H-7.html#%_sec_4.2.6">4.2.6</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>, ,@</tt></b>
|
||||
The character comma and the sequence comma at-sign are used in conjunction
|
||||
with backquote (section <a href="r5rs-Z-H-7.html#%_sec_4.2.6">4.2.6</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>"</tt></b>
|
||||
The double quote character is used to delimit strings (section <a href="r5rs-Z-H-9.html#%_sec_6.3.5">6.3.5</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>\</tt></b>
|
||||
Backslash is used in the syntax for character constants
|
||||
(section <a href="r5rs-Z-H-9.html#%_sec_6.3.4">6.3.4</a>) and as an escape character within string
|
||||
constants (section <a href="r5rs-Z-H-9.html#%_sec_6.3.5">6.3.5</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><code class=verbatim>[ ] { } |</code></b>
|
||||
Left and right square brackets and curly braces and vertical bar
|
||||
are reserved for possible future extensions to the language.</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>#</tt></b> Sharp sign is used for a variety of purposes depending on
|
||||
the character that immediately follows it:</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>#t</tt> <tt>#f</tt></b>
|
||||
These are the boolean constants (section <a href="r5rs-Z-H-9.html#%_sec_6.3.1">6.3.1</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>#</tt><tt>\</tt></b>
|
||||
This introduces a character constant (section <a href="r5rs-Z-H-9.html#%_sec_6.3.4">6.3.4</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>#</tt><tt>(</tt></b>
|
||||
This introduces a vector constant (section <a href="r5rs-Z-H-9.html#%_sec_6.3.6">6.3.6</a>). Vector constants
|
||||
are terminated by <tt>)</tt> .</p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><b><tt>#e #i #b #o #d #x</tt></b>
|
||||
These are used in the notation for numbers (section <a href="r5rs-Z-H-9.html#%_sec_6.2.4">6.2.4</a>).</p>
|
||||
<p>
|
||||
</p>
|
||||
</ul>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-4.html">previous</a></span><span>, <a href="r5rs-Z-H-6.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
338
doc/r5rs-std/r5rs-Z-H-6.html
Normal file
|
@ -0,0 +1,338 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-5.html">previous</a></span><span>, <a href="r5rs-Z-H-7.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_3"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading><a href="r5rs-Z-H-2.html#%_toc_%_chap_3">Chapter 3</a></div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_3">Basic concepts</a></h1>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_3.1"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_3.1">3.1 Variables, syntactic keywords, and regions</a></h2>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
An identifier<a name="%_idx_26"></a> may name a type of syntax, or it may name
|
||||
a location where a value can be stored. An identifier that names a type
|
||||
of syntax is called a <em>syntactic keyword</em><a name="%_idx_28"></a>
|
||||
and is said to be <em>bound</em> to that syntax. An identifier that names a
|
||||
location is called a <em>variable</em><a name="%_idx_30"></a> and is said to be
|
||||
<em>bound</em> to that location. The set of all visible
|
||||
bindings<a name="%_idx_32"></a> in effect at some point in a program is
|
||||
known as the <em>environment</em> in effect at that point. The value
|
||||
stored in the location to which a variable is bound is called the
|
||||
variable's value. By abuse of terminology, the variable is sometimes
|
||||
said to name the value or to be bound to the value. This is not quite
|
||||
accurate, but confusion rarely results from this practice.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
Certain expression types are used to create new kinds of syntax
|
||||
and bind syntactic keywords to those new syntaxes, while other
|
||||
expression types create new locations and bind variables to those
|
||||
locations. These expression types are called <em>binding constructs</em>.
|
||||
<a name="%_idx_34"></a>
|
||||
Those that bind syntactic keywords are listed in section <a href="r5rs-Z-H-7.html#%_sec_4.3">4.3</a>.
|
||||
The most fundamental of the variable binding constructs is the
|
||||
<tt>lambda</tt> expression, because all other variable binding constructs
|
||||
can be explained in terms of <tt>lambda</tt> expressions. The other
|
||||
variable binding constructs are <tt>let</tt>, <tt>let*</tt>, <tt>letrec</tt>,
|
||||
and <tt>do</tt> expressions (see sections <a href="r5rs-Z-H-7.html#%_sec_4.1.4">4.1.4</a>, <a href="r5rs-Z-H-7.html#%_sec_4.2.2">4.2.2</a>, and
|
||||
<a href="r5rs-Z-H-7.html#%_sec_4.2.4">4.2.4</a>).</p>
|
||||
<p>
|
||||
|
||||
Like Algol and Pascal, and unlike most other dialects of Lisp
|
||||
except for Common Lisp, Scheme is a statically scoped language with
|
||||
block structure. To each place where an identifier is bound in a program
|
||||
there corresponds a <a name="%_idx_36"></a><em>region</em> of the program text within which
|
||||
the binding is visible. The region is determined by the particular
|
||||
binding construct that establishes the binding; if the binding is
|
||||
established by a <tt>lambda</tt> expression, for example, then its region
|
||||
is the entire <tt>lambda</tt> expression. Every mention of an identifier
|
||||
refers to the binding of the identifier that established the
|
||||
innermost of the regions containing the use. If there is no binding of
|
||||
the identifier whose region contains the use, then the use refers to the
|
||||
binding for the variable in the top level environment, if any
|
||||
(chapters <a href="r5rs-Z-H-7.html#%_chap_4">4</a> and <a href="r5rs-Z-H-9.html#%_chap_6">6</a>); if there is no
|
||||
binding for the identifier,
|
||||
it is said to be <a name="%_idx_38"></a><em>unbound</em>.<a name="%_idx_40"></a><a name="%_idx_42"></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_3.2"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_3.2">3.2 Disjointness of types</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
No object satisfies more than one of the following predicates:</p>
|
||||
<p>
|
||||
<tt>boolean? pair?<br>
|
||||
symbol? number?<br>
|
||||
char? string?<br>
|
||||
vector? port?<br>
|
||||
procedure?</p>
|
||||
</tt>
|
||||
<p>
|
||||
These predicates define the types <em>boolean</em>, <em>pair</em>, <em>symbol</em>, <em>number</em>, <em>char</em> (or <em>character</em>), <em>string</em>, <em>vector</em>, <em>port</em>, and <em>procedure</em>. The empty list is a special
|
||||
object of its own type; it satisfies none of the above predicates.
|
||||
<a name="%_idx_44"></a><a name="%_idx_46"></a><a name="%_idx_48"></a><a name="%_idx_50"></a>
|
||||
<a name="%_idx_52"></a><a name="%_idx_54"></a><a name="%_idx_56"></a><a name="%_idx_58"></a>
|
||||
<a name="%_idx_60"></a><a name="%_idx_62"></a><a name="%_idx_64"></a></p>
|
||||
<p>
|
||||
Although there is a separate boolean type,
|
||||
any Scheme value can be used as a boolean value for the purpose of a
|
||||
conditional test. As explained in section <a href="r5rs-Z-H-9.html#%_sec_6.3.1">6.3.1</a>, all
|
||||
values count as true in such a test except for <tt>#f</tt>.
|
||||
This report uses the word ``true'' to refer to any
|
||||
Scheme value except <tt>#f</tt>, and the word ``false'' to refer to
|
||||
<tt>#f</tt>. <a name="%_idx_66"></a> <a name="%_idx_68"></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_3.3"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_3.3">3.3 External representations</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
An important concept in Scheme (and Lisp) is that of the <em>external
|
||||
representation</em> of an object as a sequence of characters. For example,
|
||||
an external representation of the integer 28 is the sequence of
|
||||
characters ``<tt>28</tt>'', and an external representation of a list consisting
|
||||
of the integers 8 and 13 is the sequence of characters ``<tt>(8 13)</tt>''.</p>
|
||||
<p>
|
||||
The external representation of an object is not necessarily unique. The
|
||||
integer 28 also has representations ``<tt>#e28.000</tt>'' and ``<tt>#x1c</tt>'', and the
|
||||
list in the previous paragraph also has the representations ``<tt>( 08 13
|
||||
)</tt>'' and ``<tt>(8 . (13 . ()))</tt>'' (see section <a href="r5rs-Z-H-9.html#%_sec_6.3.2">6.3.2</a>).</p>
|
||||
<p>
|
||||
Many objects have standard external representations, but some, such as
|
||||
procedures, do not have standard representations (although particular
|
||||
implementations may define representations for them).</p>
|
||||
<p>
|
||||
An external representation may be written in a program to obtain the
|
||||
corresponding object (see <tt>quote</tt>, section <a href="r5rs-Z-H-7.html#%_sec_4.1.2">4.1.2</a>).</p>
|
||||
<p>
|
||||
External representations can also be used for input and output. The
|
||||
procedure <tt>read</tt> (section <a href="r5rs-Z-H-9.html#%_sec_6.6.2">6.6.2</a>) parses external
|
||||
representations, and the procedure <tt>write</tt> (section <a href="r5rs-Z-H-9.html#%_sec_6.6.3">6.6.3</a>)
|
||||
generates them. Together, they provide an elegant and powerful
|
||||
input/output facility.</p>
|
||||
<p>
|
||||
Note that the sequence of characters ``<tt>(+ 2 6)</tt>'' is <em>not</em> an
|
||||
external representation of the integer 8, even though it <em>is</em> an
|
||||
expression evaluating to the integer 8; rather, it is an external
|
||||
representation of a three-element list, the elements of which are the symbol
|
||||
<tt>+</tt> and the integers 2 and 6. Scheme's syntax has the property that
|
||||
any sequence of characters that is an expression is also the external
|
||||
representation of some object. This can lead to confusion, since it may
|
||||
not be obvious out of context whether a given sequence of characters is
|
||||
intended to denote data or program, but it is also a source of power,
|
||||
since it facilitates writing programs such as interpreters and
|
||||
compilers that treat programs as data (or vice versa).</p>
|
||||
<p>
|
||||
The syntax of external representations of various kinds of objects
|
||||
accompanies the description of the primitives for manipulating the
|
||||
objects in the appropriate sections of chapter <a href="r5rs-Z-H-9.html#%_chap_6">6</a>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_3.4"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_3.4">3.4 Storage model</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Variables and objects such as pairs, vectors, and strings implicitly
|
||||
denote locations<a name="%_idx_70"></a> or sequences of locations. A string, for
|
||||
example, denotes as many locations as there are characters in the string.
|
||||
(These locations need not correspond to a full machine word.) A new value may be
|
||||
stored into one of these locations using the <tt>string-set!</tt> procedure, but
|
||||
the string continues to denote the same locations as before.</p>
|
||||
<p>
|
||||
An object fetched from a location, by a variable reference or by
|
||||
a procedure such as <tt>car</tt>, <tt>vector-ref</tt>, or <tt>string-ref</tt>, is
|
||||
equivalent in the sense of <tt>eqv?</tt> (section <a href="r5rs-Z-H-9.html#%_sec_6.1">6.1</a>)
|
||||
to the object last stored in the location before the fetch.</p>
|
||||
<p>
|
||||
Every location is marked to show whether it is in use.
|
||||
No variable or object ever refers to a location that is not in use.
|
||||
Whenever this report speaks of storage being allocated for a variable
|
||||
or object, what is meant is that an appropriate number of locations are
|
||||
chosen from the set of locations that are not in use, and the chosen
|
||||
locations are marked to indicate that they are now in use before the variable
|
||||
or object is made to denote them.</p>
|
||||
<p>
|
||||
In many systems it is desirable for constants<a name="%_idx_72"></a> (i.e. the values of
|
||||
literal expressions) to reside in read-only-memory. To express this, it is
|
||||
convenient to imagine that every object that denotes locations is associated
|
||||
with a flag telling whether that object is mutable<a name="%_idx_74"></a> or
|
||||
immutable<a name="%_idx_76"></a>. In such systems literal constants and the strings
|
||||
returned by <tt>symbol->string</tt> are immutable objects, while all objects
|
||||
created by the other procedures listed in this report are mutable. It is an
|
||||
error to attempt to store a new value into a location that is denoted by an
|
||||
immutable object.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_3.5"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_3.5">3.5 Proper tail recursion</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Implementations of Scheme are required to be
|
||||
<em>properly tail-recursive</em><a name="%_idx_78"></a>.
|
||||
Procedure calls that occur in certain syntactic
|
||||
contexts defined below are `tail calls'. A Scheme implementation is
|
||||
properly tail-recursive if it supports an unbounded number of active
|
||||
tail calls. A call is <em>active</em> if the called procedure may still
|
||||
return. Note that this includes calls that may be returned from either
|
||||
by the current continuation or by continuations captured earlier by
|
||||
<tt>call-with-current-continuation</tt> that are later invoked.
|
||||
In the absence of captured continuations, calls could
|
||||
return at most once and the active calls would be those that had not
|
||||
yet returned.
|
||||
A formal definition of proper tail recursion can be found
|
||||
in [<a href="r5rs-Z-H-14.html#cite{propertailrecursion}">8</a>].</p>
|
||||
<p>
|
||||
</p>
|
||||
<blockquote><em>Rationale: </em>
|
||||
<p>
|
||||
Intuitively, no space is needed for an active tail call because the
|
||||
continuation that is used in the tail call has the same semantics as the
|
||||
continuation passed to the procedure containing the call. Although an improper
|
||||
implementation might use a new continuation in the call, a return
|
||||
to this new continuation would be followed immediately by a return
|
||||
to the continuation passed to the procedure. A properly tail-recursive
|
||||
implementation returns to that continuation directly.</p>
|
||||
<p>
|
||||
Proper tail recursion was one of the central ideas in Steele and
|
||||
Sussman's original version of Scheme. Their first Scheme interpreter
|
||||
implemented both functions and actors. Control flow was expressed using
|
||||
actors, which differed from functions in that they passed their results
|
||||
on to another actor instead of returning to a caller. In the terminology
|
||||
of this section, each actor finished with a tail call to another actor.</p>
|
||||
<p>
|
||||
Steele and Sussman later observed that in their interpreter the code
|
||||
for dealing with actors was identical to that for functions and thus
|
||||
there was no need to include both in the language.</p>
|
||||
<p>
|
||||
</p>
|
||||
</blockquote>
|
||||
<p>
|
||||
A <em>tail call</em><a name="%_idx_80"></a> is a procedure call that occurs
|
||||
in a <em>tail context</em>. Tail contexts are defined inductively. Note
|
||||
that a tail context is always determined with respect to a particular lambda
|
||||
expression.</p>
|
||||
<p>
|
||||
</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>The last expression within the body of a lambda expression,
|
||||
shown as <tail expression> below, occurs in a tail context.
|
||||
<tt>(lambda <formals><br>
|
||||
<definition>* <expression>* <tail expression>)<br>
|
||||
</p>
|
||||
</tt>
|
||||
<li>
|
||||
<p>If one of the following expressions is in a tail context,
|
||||
then the subexpressions shown as <tail expression> are in a tail context.
|
||||
These were derived from rules in the grammar given in
|
||||
chapter <a href="r5rs-Z-H-10.html#%_chap_7">7</a> by replacing some occurrences of <expression>
|
||||
with <tail expression>. Only those rules that contain tail contexts
|
||||
are shown here.</p>
|
||||
<p>
|
||||
<tt>(if <expression> <tail expression> <tail expression>)<br>
|
||||
(if <expression> <tail expression>)<br>
|
||||
<br>
|
||||
(cond <cond clause><sup>+</sup>)<br>
|
||||
(cond <cond clause>* (else <tail sequence>))<br>
|
||||
<br>
|
||||
(case <expression><br>
|
||||
<case clause><sup>+</sup>)<br>
|
||||
(case <expression><br>
|
||||
<case clause>*<br>
|
||||
(else <tail sequence>))<br>
|
||||
<br>
|
||||
(and <expression>* <tail expression>)<br>
|
||||
(or <expression>* <tail expression>)<br>
|
||||
<br>
|
||||
(let (<binding spec>*) <tail body>)<br>
|
||||
(let <variable> (<binding spec>*) <tail body>)<br>
|
||||
(let* (<binding spec>*) <tail body>)<br>
|
||||
(letrec (<binding spec>*) <tail body>)<br>
|
||||
<br>
|
||||
(let-syntax (<syntax spec>*) <tail body>)<br>
|
||||
(letrec-syntax (<syntax spec>*) <tail body>)<br>
|
||||
<br>
|
||||
(begin <tail sequence>)<br>
|
||||
<br>
|
||||
(do (<iteration spec>*)<br>
|
||||
(<test> <tail sequence>)<br>
|
||||
<expression>*)<br>
|
||||
<br>
|
||||
where<br>
|
||||
<br>
|
||||
<cond clause> ---> (<test> <tail sequence>)<br>
|
||||
<case clause> ---> ((<datum>*) <tail sequence>)<br>
|
||||
<br>
|
||||
<tail body> ---> <definition>* <tail sequence><br>
|
||||
<tail sequence> ---> <expression>* <tail expression><br>
|
||||
</p>
|
||||
</tt>
|
||||
<li>
|
||||
<p>If a <tt>cond</tt> expression is in a tail context, and has a clause of
|
||||
the form <tt>(<expression<sub>1</sub>> => <expression<sub>2</sub>>)</tt>
|
||||
then the (implied) call to
|
||||
the procedure that results from the evaluation of <expression<sub>2</sub>> is in a
|
||||
tail context. <expression<sub>2</sub>> itself is not in a tail context.</p>
|
||||
<p>
|
||||
</p>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>
|
||||
Certain built-in procedures are also required to perform tail calls.
|
||||
The first argument passed to <tt>apply</tt> and to
|
||||
<tt>call-with-current-continuation</tt>, and the second argument passed to
|
||||
<tt>call-with-values</tt>, must be called via a tail call.
|
||||
Similarly, <tt>eval</tt> must evaluate its argument as if it
|
||||
were in tail position within the <tt>eval</tt> procedure.</p>
|
||||
<p>
|
||||
In the following example the only tail call is the call to <tt>f</tt>.
|
||||
None of the calls to <tt>g</tt> or <tt>h</tt> are tail calls. The reference to
|
||||
<tt>x</tt> is in a tail context, but it is not a call and thus is not a
|
||||
tail call.
|
||||
<tt>(lambda ()<br>
|
||||
(if (g)<br>
|
||||
(let ((x (h)))<br>
|
||||
x)<br>
|
||||
(and (g) (f))))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<blockquote><em>Note: </em>
|
||||
Implementations are allowed, but not required, to
|
||||
recognize that some non-tail calls, such as the call to <tt>h</tt>
|
||||
above, can be evaluated as though they were tail calls.
|
||||
In the example above, the <tt>let</tt> expression could be compiled
|
||||
as a tail call to <tt>h</tt>. (The possibility of <tt>h</tt> returning
|
||||
an unexpected number of values can be ignored, because in that
|
||||
case the effect of the <tt>let</tt> is explicitly unspecified and
|
||||
implementation-dependent.)
|
||||
</blockquote>
|
||||
<p>
|
||||
</p>
|
||||
<p></p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-5.html">previous</a></span><span>, <a href="r5rs-Z-H-7.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
1201
doc/r5rs-std/r5rs-Z-H-7.html
Normal file
213
doc/r5rs-std/r5rs-Z-H-8.html
Normal file
|
@ -0,0 +1,213 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="noindex,follow">
|
||||
</head>
|
||||
<body>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-7.html">previous</a></span><span>, <a href="r5rs-Z-H-9.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
<a name="%_chap_5"></a>
|
||||
<h1 class=chapter>
|
||||
<div class=chapterheading><a href="r5rs-Z-H-2.html#%_toc_%_chap_5">Chapter 5</a></div><br>
|
||||
<a href="r5rs-Z-H-2.html#%_toc_%_chap_5">Program structure</a></h1>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_5.1"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_5.1">5.1 Programs</a></h2>
|
||||
<p>A Scheme program consists of a sequence of expressions, definitions,
|
||||
and syntax definitions.
|
||||
Expressions are described in chapter <a href="r5rs-Z-H-7.html#%_chap_4">4</a>;
|
||||
definitions and syntax definitions are the subject of the rest of the
|
||||
present chapter.</p>
|
||||
<p>
|
||||
Programs are typically stored in files or entered interactively to a
|
||||
running Scheme system, although other paradigms are possible;
|
||||
questions of user interface lie outside the scope of this report.
|
||||
(Indeed, Scheme would still be useful as a notation for expressing
|
||||
computational methods even in the absence of a mechanical
|
||||
implementation.)</p>
|
||||
<p>
|
||||
Definitions and syntax definitions occurring at the top level of a program
|
||||
can be interpreted
|
||||
declaratively.
|
||||
They cause bindings to be created in the top level
|
||||
environment or modify the value of existing top-level bindings.
|
||||
Expressions occurring at the top level of a program are
|
||||
interpreted imperatively; they are executed in order when the program is
|
||||
invoked or loaded, and typically perform some kind of initialization.</p>
|
||||
<p>
|
||||
At the top level of a program <tt>(begin <form<sub>1</sub>> <tt>...</tt>)</tt> is
|
||||
equivalent to the sequence of expressions, definitions, and syntax definitions
|
||||
that form the body of the <tt>begin</tt>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_5.2"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_5.2">5.2 Definitions</a></h2>
|
||||
<p></p>
|
||||
<p>
|
||||
Definitions are valid in some, but not all, contexts where expressions
|
||||
are allowed. They are valid only at the top level of a <program>
|
||||
and at the beginning of a <body>.
|
||||
<a name="%_idx_192"></a></p>
|
||||
<p>
|
||||
A definition should have one of the following forms:<a name="%_idx_194"></a></p>
|
||||
<p>
|
||||
</p>
|
||||
<ul>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><tt>(define <variable> <expression>)</tt></p>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><tt>(define (<variable> <formals>) <body>)</tt></p>
|
||||
<p>
|
||||
<Formals> should be either a
|
||||
sequence of zero or more variables, or a sequence of one or more
|
||||
variables followed by a space-delimited period and another variable (as
|
||||
in a lambda expression). This form is equivalent to
|
||||
<tt>(define <variable><br>
|
||||
(lambda (<formals>) <body>)).</p>
|
||||
</tt>
|
||||
<p>
|
||||
</p>
|
||||
<li>
|
||||
<p><tt>(define (<variable> . <formal>) <body>)</tt></p>
|
||||
<p>
|
||||
<Formal> should be a single
|
||||
variable. This form is equivalent to
|
||||
<tt>(define <variable><br>
|
||||
(lambda <formal> <body>)).</p>
|
||||
</tt>
|
||||
<p>
|
||||
</p>
|
||||
</ul>
|
||||
<p></p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_5.2.1"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_5.2.1">5.2.1 Top level definitions</a></h3>
|
||||
<p>At the top level of a program, a definition
|
||||
<tt>(define <variable> <expression>)</p>
|
||||
</tt>
|
||||
has essentially the same effect as the assignment expression
|
||||
<tt>(<tt>set!</tt> <variable> <expression>)</tt>
|
||||
if <variable> is bound. If <variable> is not bound,
|
||||
however, then the definition will bind <variable> to a new
|
||||
location before performing the assignment, whereas it would be an error
|
||||
to perform a <tt>set!</tt> on an unbound<a name="%_idx_196"></a> variable.
|
||||
<p>
|
||||
<tt>(define add3<br>
|
||||
(lambda (x) (+ x 3)))<br>
|
||||
(add3 3) ===> 6<br>
|
||||
(define first car)<br>
|
||||
(first '(1 2)) ===> 1</p>
|
||||
</tt>
|
||||
<p>
|
||||
Some implementations of Scheme use an initial environment in
|
||||
which all possible variables are bound to locations, most of
|
||||
which contain undefined values. Top level definitions in
|
||||
such an implementation are truly equivalent to assignments.</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_5.2.2"></a>
|
||||
<h3><a href="r5rs-Z-H-2.html#%_toc_%_sec_5.2.2">5.2.2 Internal definitions</a></h3>
|
||||
<p></p>
|
||||
<p>
|
||||
Definitions may occur at the
|
||||
beginning of a <body> (that is, the body of a <tt>lambda</tt>,
|
||||
<tt>let</tt>, <tt>let*</tt>, <tt>letrec</tt>, <tt>let-syntax</tt>, or <tt>letrec-syntax</tt>
|
||||
expression or that of a definition of an appropriate form).
|
||||
Such definitions are known as <em>internal definitions</em> <a name="%_idx_198"></a> as opposed to the top level definitions described above.
|
||||
The variable defined by an internal definition is local to the
|
||||
<body>. That is, <variable> is bound rather than assigned,
|
||||
and the region of the binding is the entire <body>. For example,</p>
|
||||
<p>
|
||||
<tt>(let ((x 5))<br>
|
||||
(define foo (lambda (y) (bar x y)))<br>
|
||||
(define bar (lambda (a b) (+ (* a b) a)))<br>
|
||||
(foo (+ x 3))) ===> 45</p>
|
||||
</tt>
|
||||
<p>
|
||||
A <body> containing internal definitions can always be converted
|
||||
into a completely equivalent <tt>letrec</tt> expression. For example, the
|
||||
<tt>let</tt> expression in the above example is equivalent to</p>
|
||||
<p>
|
||||
<tt>(let ((x 5))<br>
|
||||
(letrec ((foo (lambda (y) (bar x y)))<br>
|
||||
(bar (lambda (a b) (+ (* a b) a))))<br>
|
||||
(foo (+ x 3))))</p>
|
||||
</tt>
|
||||
<p>
|
||||
Just as for the equivalent <tt>letrec</tt> expression, it must be
|
||||
possible to evaluate each <expression> of every internal
|
||||
definition in a <body> without assigning or referring to
|
||||
the value of any <variable> being defined.</p>
|
||||
<p>
|
||||
Wherever an internal definition may occur
|
||||
<tt>(begin <definition<sub>1</sub>> <tt>...</tt>)</tt>
|
||||
is equivalent to the sequence of definitions
|
||||
that form the body of the <tt>begin</tt>.</p>
|
||||
<p>
|
||||
</p>
|
||||
<a name="%_sec_5.3"></a>
|
||||
<h2><a href="r5rs-Z-H-2.html#%_toc_%_sec_5.3">5.3 Syntax definitions</a></h2>
|
||||
<p>Syntax definitions are valid only at the top level of a <program>.
|
||||
<a name="%_idx_200"></a>
|
||||
They have the following form:<a name="%_idx_202"></a></p>
|
||||
<p>
|
||||
<tt>(define-syntax <keyword> <transformer spec>)</tt></p>
|
||||
<p>
|
||||
<Keyword> is an identifier, and
|
||||
the <transformer spec> should be an instance of <tt>syntax-rules</tt>.
|
||||
The top-level syntactic environment is extended by binding the
|
||||
<keyword> to the specified transformer.</p>
|
||||
<p>
|
||||
There is no <tt>define-syntax</tt> analogue of internal definitions.</p>
|
||||
<p>
|
||||
|
||||
|
||||
Although macros may expand into definitions and syntax definitions in
|
||||
any context that permits them, it is an error for a definition or syntax
|
||||
definition to shadow a syntactic keyword whose meaning is needed to
|
||||
determine whether some form in the group of forms that contains the
|
||||
shadowing definition is in fact a definition, or, for internal definitions,
|
||||
is needed to determine the boundary between the group and the expressions
|
||||
that follow the group. For example, the following are errors:</p>
|
||||
<p>
|
||||
<tt>(define define 3)<br>
|
||||
<br>
|
||||
(begin (define begin list))<br>
|
||||
<br>
|
||||
(let-syntax<br>
|
||||
((foo (syntax-rules ()<br>
|
||||
((foo (proc args ...) body ...)<br>
|
||||
(define proc<br>
|
||||
(lambda (args ...)<br>
|
||||
body ...))))))<br>
|
||||
(let ((x 3))<br>
|
||||
(foo (plus x y) (+ x y))<br>
|
||||
(define foo x)<br>
|
||||
(plus foo x)))<br>
|
||||
</p>
|
||||
</tt>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span><a href="r5rs.html">first</a>, <a href="r5rs-Z-H-7.html">previous</a></span><span>, <a href="r5rs-Z-H-9.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|
3484
doc/r5rs-std/r5rs-Z-H-9.html
Normal file
343
doc/r5rs-std/r5rs.html
Normal file
|
@ -0,0 +1,343 @@
|
|||
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html>
|
||||
<!-- Generated from TeX source by tex2page, v 4p4,
|
||||
(c) Dorai Sitaram, http://www.cs.rice.edu/~dorai/tex2page -->
|
||||
<head>
|
||||
<title>
|
||||
Revised^5 Report on the Algorithmic Language Scheme
|
||||
</title>
|
||||
<link rel="stylesheet" type="text/css" href="r5rs-Z-C.css" title=default>
|
||||
<meta name=robots content="index,follow">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div align=center>
|
||||
<h1><br><br>Revised<sup>5</sup> Report on the Algorithmic Language Scheme</h1>
|
||||
<p>
|
||||
20 February 1998<br>
|
||||
<br>
|
||||
Richard Kelsey, William Clinger, and Jonathan Rees (<i>Editors</i>)<br>
|
||||
<br>
|
||||
<table width=100%>
|
||||
<tr><td>H. Abelson </td><td> R. K. Dybvig </td><td> C. T. Haynes </td><td> G. J. Rozas</td></tr>
|
||||
<tr><td>N. I. Adams IV </td><td> D. P. Friedman </td><td> E. Kohlbecker </td><td> G. L. Steele Jr.</td></tr>
|
||||
<tr><td>D. H. Bartley </td><td> R. Halstead </td><td> D. Oxley </td><td> G. J. Sussman</td></tr>
|
||||
<tr><td>G. Brooks </td><td> C. Hanson </td><td> K. M. Pitman </td><td> M. Wand</td></tr>
|
||||
</table><br>
|
||||
<em>Dedicated to the Memory of Robert Hieb</em>
|
||||
</p>
|
||||
<p></div>
|
||||
</p>
|
||||
<p></p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<p>
|
||||
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
<p>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
</p>
|
||||
<div class=navigation>[Go to <span class=disable>first, previous</span><span><span class=disable>, </span><a href="r5rs-Z-H-1.html">next</a></span> page<span>; </span><span><a href="r5rs-Z-H-2.html#%_toc_start">contents</a></span><span><span>; </span><a href="r5rs-Z-H-15.html#%_index_start">index</a></span>]</div>
|
||||
<p></p>
|
||||
</body>
|
||||
</html>
|