Skip to content

Commit

Permalink
Update lecture03.md
Browse files Browse the repository at this point in the history
  • Loading branch information
daryamih02 authored Mar 16, 2024
1 parent 675f74e commit eecb75c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lectures/lecture03.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ The results are collected in a list. Using quasiquoting, we can write it down as
Note that a special case of the matrix transposition is the useful [zipping](https://en.wikipedia.org/wiki/Zipping_(computer_science)) of two (or more) lists. For two lists of the same length, their zipping is the list consisting of the pairs of respective elements. E.g.,
```scheme
> (map list '(1 2 3) '(a b c))
'((1 a) (2 b) (3 b))
'((1 a) (2 b) (3 c))
```
One more example of `map` extracts the diagonal of a matrix. It applies the function [`list-ref`](https://docs.racket-lang.org/reference/pairs.html#%28def._%28%28quote._~23~25kernel%29._list-ref%29%29) that takes a list and a position and returns the element on that position. To extract the diagonal, we need to get the first element from the first row, the second element from the second row, etc. Note that lists are indexed from zero.
```scheme
Expand Down

0 comments on commit eecb75c

Please sign in to comment.