title: Functional non recursive approach to looping in Haskell
body: <p>I use Haskell for my programming during leisure these days. Being a programmer in imperative languages for over 8 years, it is tough to wrap my head around some functional constructs (especially the folds). I was solving a problem from project Euler, and happened to produce the following code.</p>
  
  <pre><code>f (num, den) s | num*10 &lt; den = s
                 | otherwise = f (ratio (num, den) s') s'
                 where s' = (s+2)
  </code></pre>
  
  <p>Can this explicit recursion be rewritten using folds or some other functional construct? The main hurdle for me in using a fold was to come up with the step function. Eventually I gave up, and resorted to the recursion. </p>
  
  <p>EDIT: Also, how do I make the output returned by another function within a function as the input to the calling function without explicit recursion?</p>