
28 Jan
2010
28 Jan
'10
6:18 a.m.
Hallo all, I have two functions f and g of one arguments: f :: (Num a) => [a] -> [a] g :: (Num a) => [a] -> [a] I can do composition (f .f .f.) [a] or (g .g .g.) [a] for a few repeated functions. And what about if I want to nest f, say, many many times? The matter is more complicated (from my prespective :-) ) if I would like to get e.g.: the composition (g .f .g. g.f .f) [a] if t == 0 then f else g and having the list [1,0,1,1,0,0] as a pattern to construct above composition. How to make above, generally for arbitrary length ???