title: How to pass a function instead of a block
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/13834846/shorter-way-to-pass-every-element-of-an-array-to-a-function">Shorter way to pass every element of an array to a function</a>  </p>
  </blockquote>
  
  
  
  <p>I know this will work:</p>
  
  <pre><code>def inc(a)
    a+1
  end
  [1,2,3].map{|a| inc a}
  </code></pre>
  
  <p>but in Python, I just need to write:</p>
  
  <pre><code>map(inc, [1,2,3])
  </code></pre>
  
  <p>or</p>
  
  <pre><code>[inc(x) for x in [1,2,3])
  </code></pre>
  
  <p>I was wondering whether I can skip the steps of making a block in Ruby, and did this:</p>
  
  <pre><code>[1,2,3].map inc
  # =&gt; ArgumentError: wrong number of arguments (0 for 1)
  # from (irb):19:in `inc'
  </code></pre>
  
  <p>Does anyone have ideas about how to do this?</p>