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

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

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

google shop client API returns 400 bad request error while adding an item -