append requires 2 args now
svn: r6106
This commit is contained in:
parent
88475bd517
commit
373860bb16
|
@ -279,7 +279,7 @@
|
||||||
((beginner-list* list*) (any ... (listof any) -> (listof any))
|
((beginner-list* list*) (any ... (listof any) -> (listof any))
|
||||||
"to construct a list by adding multiple items to a list")
|
"to construct a list by adding multiple items to a list")
|
||||||
|
|
||||||
((beginner-append append) ((listof any) ... -> (listof any))
|
((beginner-append append) ((listof any) (listof any) (listof any) ... -> (listof any))
|
||||||
"to create a single list from several, by juxtaposition of the items")
|
"to create a single list from several, by juxtaposition of the items")
|
||||||
(length (list -> number)
|
(length (list -> number)
|
||||||
"to compute the number of items on a list")
|
"to compute the number of items on a list")
|
||||||
|
|
|
@ -1,4 +1,13 @@
|
||||||
|
#| tests are at plt/collects/tests/mzscheme/
|
||||||
|
collects/tests/mzscheme/beginner.ss
|
||||||
|
.../beginner-abbr.ss
|
||||||
|
.../intermediate.ss
|
||||||
|
.../intermediate-lam.ss
|
||||||
|
.../advanced.ss
|
||||||
|
|
||||||
|
Each one has to run separately, since they mangle the top-level
|
||||||
|
namespace.
|
||||||
|
|#
|
||||||
(module teachprims mzscheme
|
(module teachprims mzscheme
|
||||||
|
|
||||||
(require "../imageeq.ss"
|
(require "../imageeq.ss"
|
||||||
|
@ -76,6 +85,7 @@
|
||||||
(format "~a: last argument must be of type <~a>, given ~e; other args:~a"
|
(format "~a: last argument must be of type <~a>, given ~e; other args:~a"
|
||||||
prim-name type
|
prim-name type
|
||||||
last
|
last
|
||||||
|
;; all-but-last:
|
||||||
(build-arg-list
|
(build-arg-list
|
||||||
(let loop ([args args])
|
(let loop ([args args])
|
||||||
(cond
|
(cond
|
||||||
|
@ -143,9 +153,9 @@
|
||||||
(apply list* x)))
|
(apply list* x)))
|
||||||
|
|
||||||
(define-teach beginner append
|
(define-teach beginner append
|
||||||
(lambda x
|
(lambda (a b . x)
|
||||||
(check-last 'append x)
|
(check-last 'append (cons a (cons b x)))
|
||||||
(apply append x)))
|
(apply append a b x)))
|
||||||
|
|
||||||
(define-teach beginner error
|
(define-teach beginner error
|
||||||
(lambda (sym str)
|
(lambda (sym str)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user