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

user interface - How to replace the Python logo in a Tkinter-based Python GUI app? -

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -