matrix bug fixed

svn: r15738
This commit is contained in:
Matthias Felleisen 2009-08-14 22:59:52 +00:00
parent 5174bbb5f0
commit cd1d7d3985
3 changed files with 990 additions and 903 deletions

File diff suppressed because it is too large Load Diff

View File

@ -263,11 +263,12 @@
(define (check-matrix tag M* i j)
(define M (if (internal-matrix? M*)
M*
(let ([r (visible-matrix M*)])
(let ([r (if (visible? M*) (visible-matrix M*) M*)])
(cond
[(internal-matrix? r) r]
;; this next line is suspicious!
[(pair? r) (rectangle->imatrix r)]
[else (check-arg tag #f 'matrix "first" M)]))))
[else (check-arg tag #f 'matrix "first" M*)]))))
(check-arg tag (natural? i) 'Nat "second" i)
(check-arg tag (natural? j) 'Nat "third" j)
;; --- now that M is a matrix, i and j are natural numbers:
@ -286,8 +287,10 @@
;; Nat -> String
(define (th n)
(cond
[(= n 0) "th"]
[(= n 1) "st"]
[(= n 2) "nd"]
[(= n 3) "rd"]
[(> n 3) "th"]
[else (error 'th "can't happen")]))
[else (error 'th "can't happen ~e" n)]))

View File

@ -18,7 +18,7 @@
(unit
(import matrix^)
(export matrix-render^)
(define visible? v?)
(define (visible? m) (and (object? m) (v? m)))
(define visible-matrix v-m)
;; the graphical stuff follows .. it is code based on image.ss