Apply a function multiple times in Haskell -


learn haskell great good (section "higher order functions", subsection "some higher-orderism in order") describes example function applytwice calls function on argument twice:

applytwice :: (a -> a) -> ->   applytwice f x = f (f x) 

but need function applies function on argument arbitrary amount of times. example applyn 3 f x equivalent f $ f $ f x. how write function of repeated application in haskell? please post possible solutions, using recursion, higher-order functions or else.

i did iterate f x !! n.


Comments

Popular posts from this blog

css - I want to align grid in center -

Contact Form PHP Email Script -

python - SWIG function not printing output -