[Haskell-beginners] function nesting again
Zbigniew Stanasiuk
zbigergofun at gmail.com
Thu Jan 28 06:18:12 EST 2010
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 ???
More information about the Beginners
mailing list