doc λ in HtDP Intm+Lam and Adv

svn: r14540
This commit is contained in:
Matthew Flatt 2009-04-17 11:27:23 +00:00
parent b07a536ae3
commit e02aef66a4
2 changed files with 21 additions and 6 deletions

View File

@ -4,18 +4,24 @@
"prim-ops.ss"
(for-label lang/htdp-advanced))
@(define-syntax-rule (bd intm-define intm-define-struct intm-lambda intm-local intm-letrec intm-let intm-let* intm-time)
@(define-syntax-rule (bdl intm-define intm-lambda)
(begin
(require (for-label lang/htdp-intermediate-lambda))
(define intm-define (scheme define))
(define intm-lambda (scheme lambda))))
@(bdl intm-define intm-lambda)
@(define-syntax-rule (bd intm-define-struct intm-local intm-letrec intm-let intm-let* intm-time)
(begin
(require (for-label lang/htdp-intermediate))
(define intm-define (scheme define))
(define intm-define-struct (scheme define-struct))
(define intm-lambda (scheme lambda))
(define intm-local (scheme local))
(define intm-letrec (scheme letrec))
(define intm-let (scheme let))
(define intm-let* (scheme let*))
(define intm-time (scheme time))))
@(bd intm-define intm-define-struct intm-lambda intm-local intm-letrec intm-let intm-let* intm-time)
@(bd intm-define-struct intm-local intm-letrec intm-let intm-let* intm-time)
@(define-syntax-rule (bbd beg-define beg-define-struct beg-cond beg-if beg-and beg-or beg-check-expect beg-require)
(begin
@ -36,7 +42,7 @@
@declare-exporting[lang/htdp-advanced]
@schemegrammar*+qq[
#:literals (define define-struct lambda cond else if and or empty true false require lib planet
#:literals (define define-struct lambda λ cond else if and or empty true false require lib planet
local let let* letrec time begin begin0 set! delay shared recur when case unless
check-expect check-within check-error)
(check-expect check-within check-error require)
@ -53,6 +59,7 @@
(set! id expr)
(delay expr)
(lambda (id ...) expr)
(λ (id ...) expr)
(local [definition ...] expr)
(letrec ([id expr] ...) expr)
(shared ([id expr] ...) expr)
@ -126,7 +133,10 @@ additional set of operations:
@section[#:tag "advanced-lambda"]{@scheme[lambda]}
@defform[(lambda (id ...) expr)]{
@deftogether[(
@defform[(lambda (id ...) expr)]
@defform[(λ (id ...) expr)]
)]{
The same as Intermediate with Lambda's @|intm-lambda|, except that a
function is allowed to accept zero arguments.}

View File

@ -35,7 +35,7 @@
@declare-exporting[lang/htdp-intermediate-lambda]
@schemegrammar*+qq[
#:literals (define define-struct lambda cond else if and or empty true false require lib planet
#:literals (define define-struct lambda λ cond else if and or empty true false require lib planet
local let let* letrec time check-expect check-within check-error)
(check-expect check-within check-error require)
[program (code:line def-or-expr ...)]
@ -47,6 +47,7 @@
(define id expr)
(define-struct id (id ...))]
[expr (lambda (id id ...) expr)
(λ (id id ...) expr)
(local [definition ...] expr)
(letrec ([id expr] ...) expr)
(let ([id expr] ...) expr)
@ -97,6 +98,10 @@ for @scheme[lambda], since a @scheme[lambda] form is an expression.}
Creates a function that takes as many arguments as given @scheme[id]s,
and whose body is @scheme[expr].}
@defform[(λ (id id ...) expr)]{
The Greek letter @scheme[λ] is a synonym for @scheme[lambda].}
@; ----------------------------------------------------------------------
@section[#:tag "intermediate-lambda-call"]{Function Calls}