title: Apply a function multiple times in Haskell
body: <p><em>Learn You a Haskell For Great Good</em> (section "Higher Order Functions", <a href="http://learnyouahaskell.com/higher-order-functions#higher-orderism" rel="nofollow">subsection "Some higher-orderism is in order"</a>) describes an example function <code>applyTwice</code> that calls a function on an argument twice:</p>
  
  <pre><code>applyTwice :: (a -&gt; a) -&gt; a -&gt; a  
  applyTwice f x = f (f x)
  </code></pre>
  
  <p>But i need a function that applies some function over some argument an arbitrary amount of times. For example <code>applyN 3 f x</code> would be equivalent to <code>f $ f $ f x</code>. How would i write a function of repeated application in Haskell? Please post any possible solutions, using recursion, higher-order functions or anything else.</p>