4.2. Multi-map Function
- In this example we will construct a function that performs a certain operation on the n'th elements of multiple lists.
- Together we will get a mapping of multiple lists.
orig = [1 .. 10] one = [ i*2 | i <- orig ] two = [ i*3+1 | i <- orig ] three = orig four = [ 100-i | i <- orig ] lists = [one,two,three,four] transpose_list ([]:as) = [] transpose_list as = [ head(i) | i <- as] : transpose_list ([ tail (i) | i <- as]) multimap func list_of_lists = (map func (transpose_list list_of_lists)) result = multimap sum lists |