I am currently trying to define a function that takes a list of lists, models that list as a square matrix and returns the diagonal of said matrix.
For example, input ((a b c) (d e f) (g h i))
gives (a e i)
.
I have a vague idea of how to go about solving this (taking the last element of the last list then the second to last element of the second to last list etc.) but I am not really sure of how to go about programming this in Scheme.
I would appreciate it if somebody could point me in the right direction.
Thanks.