fixed "inaccurate error message" bug in map when applied a non-list
argument.
This commit is contained in:
parent
4133bd73d3
commit
5d3ab96c2c
|
@ -525,14 +525,18 @@
|
||||||
($car d1) ($car d2)
|
($car d1) ($car d2)
|
||||||
($cdr d1) ($cdr d2)
|
($cdr d1) ($cdr d2)
|
||||||
($fxsub1 n))))]
|
($fxsub1 n))))]
|
||||||
[else (die who "length mismatch")])]
|
[(null? d2) (die who "length mismatch")]
|
||||||
|
[else (die who "not a proper list")])]
|
||||||
[(null? d1)
|
[(null? d1)
|
||||||
(cond
|
(cond
|
||||||
[(null? d2)
|
[(null? d2)
|
||||||
(if ($fxzero? n)
|
(if ($fxzero? n)
|
||||||
(cons (f a1 a2) '())
|
(cons (f a1 a2) '())
|
||||||
(die who "list was altered"))]
|
(die who "list was altered"))]
|
||||||
[else (die who "length mismatch")])]
|
[else
|
||||||
|
(die who (if (list? d2)
|
||||||
|
"length mismatch"
|
||||||
|
"not a proper list"))])]
|
||||||
[else (die who "list was altered")])))
|
[else (die who "list was altered")])))
|
||||||
(define cars
|
(define cars
|
||||||
(lambda (ls*)
|
(lambda (ls*)
|
||||||
|
@ -590,11 +594,17 @@
|
||||||
(if (pair? ls2)
|
(if (pair? ls2)
|
||||||
(let ([d ($cdr ls)])
|
(let ([d ($cdr ls)])
|
||||||
(map2 f ($car ls) ($car ls2) d ($cdr ls2) (len d d 0)))
|
(map2 f ($car ls) ($car ls2) d ($cdr ls2) (len d d 0)))
|
||||||
(die who "length mismatch"))]
|
(die who
|
||||||
|
(if (list? ls2)
|
||||||
|
"length mismatch"
|
||||||
|
"not a proper list")))]
|
||||||
[(null? ls)
|
[(null? ls)
|
||||||
(if (null? ls2)
|
(if (null? ls2)
|
||||||
'()
|
'()
|
||||||
(die who "length mismatch"))]
|
(die who
|
||||||
|
(if (list? ls2)
|
||||||
|
"length mismatch"
|
||||||
|
"not a proper list")))]
|
||||||
[else (die who "not a list")])]
|
[else (die who "not a list")])]
|
||||||
[(f ls . ls*)
|
[(f ls . ls*)
|
||||||
(unless (procedure? f)
|
(unless (procedure? f)
|
||||||
|
@ -606,7 +616,7 @@
|
||||||
[(null? ls)
|
[(null? ls)
|
||||||
(if (andmap null? ls*)
|
(if (andmap null? ls*)
|
||||||
'()
|
'()
|
||||||
(die who "length mismatch"))]
|
(die who "invalid arguments"))]
|
||||||
[else (die who "not a list" ls)])])))
|
[else (die who "not a list" ls)])])))
|
||||||
|
|
||||||
(module (for-each)
|
(module (for-each)
|
||||||
|
|
|
@ -18,20 +18,21 @@
|
||||||
(export get-fmt pretty-format)
|
(export get-fmt pretty-format)
|
||||||
(import (except (ikarus) pretty-format))
|
(import (except (ikarus) pretty-format))
|
||||||
|
|
||||||
(define *pretty-format* '*pretty-format*)
|
(define h (make-eq-hashtable))
|
||||||
(define (get-fmt name)
|
|
||||||
(getprop name *pretty-format*))
|
|
||||||
(define (set-fmt! name fmt)
|
|
||||||
(putprop name *pretty-format* fmt))
|
|
||||||
|
|
||||||
|
(define (get-fmt name)
|
||||||
|
(hashtable-ref h name #f))
|
||||||
|
|
||||||
|
(define (set-fmt! name fmt)
|
||||||
|
(hashtable-set! h name fmt))
|
||||||
|
|
||||||
(define pretty-format
|
(define pretty-format
|
||||||
(lambda (x)
|
(lambda (x)
|
||||||
(unless (symbol? x)
|
(unless (symbol? x)
|
||||||
(die 'pretty-format "not a symbol" x))
|
(die 'pretty-format "not a symbol" x))
|
||||||
(case-lambda
|
(case-lambda
|
||||||
[() (getprop x *pretty-format*)]
|
[() (hashtable-ref h x)]
|
||||||
[(v) (putprop x *pretty-format* v)])))
|
[(v) (hashtable-set! h x v)])))
|
||||||
|
|
||||||
;;; standard formats
|
;;; standard formats
|
||||||
(set-fmt! 'quote '(read-macro . "'"))
|
(set-fmt! 'quote '(read-macro . "'"))
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
1473
|
1475
|
||||||
|
|
Loading…
Reference in New Issue