7 (define (dot-product v w)
8 (accumulate + 0 (map * v w)))
10 (define (matrix-*-vector m v)
11 (map (lambda (r) (dot-product r v)) m))
13 (matrix-*-vector '((1 2 3 4) (4 5 6 6) (6 7 8 9)) '(1 2 3 4))
16 (accumulate-n cons '() m))
18 ;; (transpose '((1 2 3) (4 5 6) (7 8 9)))
21 (define (matrix-*-matrix m n)
22 (let ([cols (transpose n)])
23 (map (lambda (v) (matrix-*-vector cols v)) m)))
25 ;; (matrix-*-matrix '((0 -1 2) (4 11 2)) '((3 -1) (1 2) (6 1)))