title: How do I reference a function in Ruby?
body: <p>In python, it's fairly straightforward to reference a function:</p>
  
  <pre><code>&gt;&gt;&gt; def foo():
  ...     print "foo called"
  ...     return 1
  ... 
  &gt;&gt;&gt; x = foo
  &gt;&gt;&gt; foo()
  foo called
  1
  &gt;&gt;&gt; x()
  foo called
  1
  &gt;&gt;&gt; x
  &lt;function foo at 0x1004ba5f0&gt;
  &gt;&gt;&gt; foo
  &lt;function foo at 0x1004ba5f0&gt;
  </code></pre>
  
  <p>However, it seems to be different in Ruby since a naked <code>foo</code> actually calls foo:</p>
  
  <pre><code>ruby-1.9.2-p0 &gt; def foo
  ruby-1.9.2-p0 ?&gt;  print "foo called"
  ruby-1.9.2-p0 ?&gt;  1
  ruby-1.9.2-p0 ?&gt;  end
   =&gt; nil 
  ruby-1.9.2-p0 &gt; x = foo
  foo called =&gt; 1 
  ruby-1.9.2-p0 &gt; foo
  foo called =&gt; 1 
  ruby-1.9.2-p0 &gt; x
   =&gt; 1 
  </code></pre>
  
  <p>How do I actually assign the <em>function</em> foo to x and then call it?  Or is there a more idiomatic way to do this?</p>