Exercises part 3
-
Here is a function declaration for flattening a
List
ofList
s:flattenList : List (List a) -> List a
Implement
flattenList
and declare and implement a similar functionflattenVect
for flattening vectors of vectors. -
Implement functions
take'
andsplitAt'
like in the exercises of the previous section but using the technique shown fordrop'
. -
Implement function
transpose
for converting anm x n
-matrix (represented as aVect m (Vect n a)
) to ann x m
-matrix.Note: This might be a challenging exercise, but make sure to give it a try. As usual, make use of holes if you get stuck!
Here is an example how this should work in action:
Solutions.Dependent> transpose [[1,2,3],[4,5,6]] [[1, 4], [2, 5], [3, 6]]