Haskell for Perl ProgrammersList and String Manipulation RoutinesMulti-map Function

4.2. Multi-map Function

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


Written by Shlomi Fish