fix reported arity of `map' et al.

Closes PR 12561
This commit is contained in:
Matthew Flatt 2012-02-09 16:49:03 -07:00
parent a08a22bedb
commit 6d3a458847
3 changed files with 10 additions and 4 deletions

View File

@ -40,7 +40,7 @@
[else (cons (f (car l1) (car l2))
(loop (cdr l1) (cdr l2)))]))
(map f l1 l2))]
[(f . args) (apply map f args)])])
[(f l . args) (apply map f l args)])])
map))
(define for-each2
@ -67,7 +67,7 @@
[else (begin (f (car l1) (car l2))
(loop (cdr l1) (cdr l2)))]))
(for-each f l1 l2))]
[(f . args) (apply for-each f args)])])
[(f l . args) (apply for-each f l args)])])
for-each))
(define andmap2
@ -98,7 +98,7 @@
[else (and (f (car l1) (car l2))
(loop (cdr l1) (cdr l2)))])))
(andmap f l1 l2))]
[(f . args) (apply andmap f args)])])
[(f l . args) (apply andmap f l args)])])
andmap))
(define ormap2
@ -129,5 +129,5 @@
[else (or (f (car l1) (car l2))
(loop (cdr l1) (cdr l2)))])))
(ormap f l1 l2))]
[(f . args) (apply ormap f args)])])
[(f l . args) (apply ormap f l args)])])
ormap))))

View File

@ -1414,6 +1414,11 @@
(test #f list-length '(a b . c))
(test '() map cadr '())
(arity-test map 2 -1)
(arity-test for-each 2 -1)
(arity-test andmap 2 -1)
(arity-test ormap 2 -1)
;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; exceptions

View File

@ -283,6 +283,7 @@ transcript.
(apply f args))])
(printf "~s\n BUT EXPECTED ERROR\n" v)
(record-error (list v 'Error (cons f args))))))])
(test #t aok? (procedure-arity f))
(let loop ([n 0][l '()])
(unless (>= n min)
(unless (memq n except)