title: Save variable and use it on recursion
body: <p>Suppose I have the following function</p>
  
  <pre><code>printVariance :: [Float] -&gt; IO ()
  printVariance [] = return ()
  printVariance (x:xs)
      | x &gt;= avg (x:xs) = print (x - avg (x:xs)) &gt;&gt; printVariance xs
      | otherwise       = printVariance xs
  </code></pre>
  
  <p>Which gets a list, checks which elements are bigger than the average and prints their <code>value - avg</code>.</p>
  
  <p>My problem is that the <code>avg</code> value changes every step. How can I define it just once and use its value for the recursion?</p>