this is a really basic question I know, I am a begginer in Haskell. So, I am wondering how to “take” the lists from a function like:
putStr( f [[1,2,3],[4,5,6],[6,7,8]])
I don’t know if I am expressing this correctly, but I want to create a function f that takes this type:
type Matrix a = [[a]]
type IntMat = Matrix Integer
and then does some things on each “row” of the matrix, nameley the inner lists.
The thing is, I am not quite sure as to how to address them! :S
If I am not making ANY sense at all, please ask me to explain!
Thank you in advance!
“find the max of each of the inner lists”, “find their length to use later on”, both of them can be done with the
maphigher-order function.If you have a list
M = [a, b, c, d, ...], and you want to use a functionfto transform the list intoN = [f(a), f(b), f(c), f(d), ...], then you could use the functionmap(N == map f M).