doc corrections/clarifications for 'when' and 'lambda'

svn: r10674
This commit is contained in:
Matthew Flatt 2008-07-08 14:55:06 +00:00
parent d3e15c3ba9
commit bdbcd1a56c
2 changed files with 44 additions and 6 deletions

View File

@ -988,9 +988,12 @@ as follows:
list that is associated to @scheme[rest-id].}
The @scheme[kw-formals] identifiers are bound in the
@scheme[body]s. When the procedure is applied, a new location is
created for each identifier, and the location is filled with the
associated argument value.
@scheme[body]s. When the procedure is applied, a new @tech{location}
is created for each identifier, and the location is filled with the
associated argument value. The @tech{locations} are created and filled
in order, with @scheme[_default-expr]s evaluated as needed to fill
locations. @margin-note{In other words, argument bindings with
default-value expressions are evaluated analogous to @scheme[let*].}
If any identifier appears in the @scheme[body]s that is not one of the
identifiers in @scheme[kw-formals], then it refers to the same
@ -1638,9 +1641,10 @@ classifications:
@defform[(when test-expr expr ...)]{
Evaluates the @scheme[text-expr]. If the result is any value other
than @scheme[#f], the @scheme[expr]s are evaluated, and the results
are ignored. No @scheme[expr] is in tail position with respect to the
Evaluates the @scheme[text-expr]. If the result is @scheme[#f], then
the result of the @scheme[when] expression is
@|void-const|. Otherwise, the @scheme[expr]s are evaluated, and the
last @scheme[expr] is in tail position with respect to the
@scheme[when] form.
@examples[

View File

@ -1096,5 +1096,39 @@
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Check that locations for lambda arguments are created
;; one-by-one --- like `let*', and not like `letrec':
(test '((1 10) (x1 10) (x2 z1))
'lambda-loc
(let ()
(define procs null)
(define again #f)
(define (f x
[y (let/cc k
(unless again
(set! again k))
(lambda () 'done))]
[z 10])
(set! procs
(cons (lambda (xv zv)
(begin0
(list x z)
(set! x xv)
(set! z zv)))
procs))
(y))
(f 1)
(let/cc esc (again esc))
(list
((cadr procs) 'x1 'z1)
((car procs) 'x2 'z2)
((cadr procs) 'x10 'z10))))
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(report-errs)