title: Passing a method as a parameter in Ruby
body: <p>I am trying to mess around a little bit with Ruby. Therefor I try to implement the algorithms (given in Python) from the book "Programming Collective Intelligence" Ruby.</p>
  
  <p>In chapter 8 the author passes a method a as parameter. This seems to work in Python but not in Ruby.</p>
  
  <p>I have here the method</p>
  
  <pre><code>def gaussian(dist, sigma=10.0)
    foo
  end
  </code></pre>
  
  <p>and want to call this with another method</p>
  
  <pre><code>def weightedknn(data, vec1, k = 5, weightf = gaussian)
    foo
    weight = weightf(dist)
    foo
  end
  </code></pre>
  
  <p>All I got is an error</p>
  
  <pre><code>ArgumentError: wrong number of arguments (0 for 1)
  </code></pre>