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))
|
||||
"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")
|
||||
(length (list -> number)
|
||||
"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
|
||||
|
||||
(require "../imageeq.ss"
|
||||
|
@ -76,6 +85,7 @@
|
|||
(format "~a: last argument must be of type <~a>, given ~e; other args:~a"
|
||||
prim-name type
|
||||
last
|
||||
;; all-but-last:
|
||||
(build-arg-list
|
||||
(let loop ([args args])
|
||||
(cond
|
||||
|
@ -143,9 +153,9 @@
|
|||
(apply list* x)))
|
||||
|
||||
(define-teach beginner append
|
||||
(lambda x
|
||||
(check-last 'append x)
|
||||
(apply append x)))
|
||||
(lambda (a b . x)
|
||||
(check-last 'append (cons a (cons b x)))
|
||||
(apply append a b x)))
|
||||
|
||||
(define-teach beginner error
|
||||
(lambda (sym str)
|
||||
|
|
Loading…
Reference in New Issue
Block a user