append requires 2 args now

svn: r6106
This commit is contained in:
Matthias Felleisen 2007-05-01 01:55:31 +00:00
parent 88475bd517
commit 373860bb16
2 changed files with 14 additions and 4 deletions

View File

@ -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")

View File

@ -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)