title: Looking for an example to vividly illustrate that tail-recursive calls take less space than non-tail-recursive?
body: <p>Software developers in functional programming languages have been told that tail-recursive calls are better than non-tail-recursive ones. A classic example in textbooks is the tail-recursive factorial function (written in F#)</p>
  <pre><code>let rec faci n r = 
    if n = 0 then r else faci (n-1) (r * n) 
  </code></pre>
  <p>versus its non-tail-recursive counter-part.</p>
  <pre><code>let rec facr n = 
    if n = 0 then 1 else n * facr(n-1)
  </code></pre>
  <p>It is relatively clear that <code>faci</code> above does not need an extra stack frame when calling itself as <code>facr</code> would do. But I am looking for a more vivid example, preferable in F#, from which one can <em>demonstrate</em> why tail-recursive-functions are better than non-tail-recursive ones. Ideally, the improvement can be visualized, <em>e.g.</em>, with a memory profiler, or by printing some debugging info. Any idea about such an example?</p>