title: How do you write a fun that's recursive in Erlang?
body: <p>I'm trying to write a recursive fun in an Erlang shell, but I keep getting an unbound variable exception:</p>
  
  <pre><code>1&gt; Foo = fun(X) -&gt; Foo(X) end.
  * 1: variable 'Foo' is unbound
  </code></pre>
  
  <p>This probably goes without saying, but I'm not trying to create an infinite loop! This is just a simple example of the error I'm getting.</p>