new to stackoverflow and new to racket. I've been studying racket using this documentation: https://docs.racket-lang.org/reference/pairs.html
This is my understanding of map:
(map (lambda (number) (+ 1 number))'(1 2 3 4))
this assigns '(1 2 3 4)
to variable number
,then map performs (+ 1 '(1 2 3 4))
.
but when I see things like:
(define (matrix_addition matrix_a matrix_b)
(map (lambda (x y) (map + x y)) matrix_a matrix_b))
I get very lost. I assume we're assigning two variables x
and y
, then performing (map + x y)
,but I don't understand what or how (map + x y)
works.
Another one I'm having trouble with is
(define (matrix_transpose matrix_a)
(apply map (lambda x x) matrix_a))
what does (lambda x x)
exactly do?
Thank you so much for clarifying. As you can see I've been working on matrix operations as suggested by a friend of mine.