Questions In Matrix Multiplication
Posted: Wed Nov 09, 2011 3:28 pm
Hello there i have managed to multiply matrices with this(as shown at rosetta code):
where my map looks like this:
I have tested it and runs great!But i have some questions since i'm still learning:
1)In the first prodecure(line 6) we call as "map * row column" but my map is like (map proc lst).In line 6 there is one more argument.So i can't understand why and how it works.
2)In the second lambda why is not "column" inside parenthesis?Isn't the format of a lambda something like: and this returning 24?
I haven't found anywhere a lambda without arguments a the parenthesis.
Any kind of info should be useful since i'm a learn.Even the slightest.
Thanx in advance.
Code: Select all
(define (matrix-multiply matrix1 matrix2)
(map
(lambda (row)
(apply map
(lambda column
(apply + (map * row column)))
matrix2))
matrix1))
Code: Select all
;;map: act to a list with a procedure
;;proc ---> lst
(define (map proc lst)
(if (null? lst)
'()
(cons (proc (car lst))
(map proc (cdr lst)))))
1)In the first prodecure(line 6) we call as "map * row column" but my map is like (map proc lst).In line 6 there is one more argument.So i can't understand why and how it works.
2)In the second lambda why is not "column" inside parenthesis?Isn't the format of a lambda something like:
Code: Select all
((lambda (x) (+ x x)) (* 3 4))
I haven't found anywhere a lambda without arguments a the parenthesis.
Any kind of info should be useful since i'm a learn.Even the slightest.
Thanx in advance.