Being able to call a Proc/method on multiple elements using the &: shorthand is great:
[0,4,7].map(&:to_s) # => ["0","4", "7"]
[0,4,7].select(&:zero?) # => [0]
[0,4,7].reduce(&:+) # => 11
[0,4,7].count(&:nil?) # => 0
Simply passing parameters or logical operators to the Proc doesn't work:
[0,4,7].map(&:to_s(2)) # Syntax error
[0,4,7].select(&:!zero?) # Syntax error
[0,4,7].select(&:<5) # Syntax error
[0,4,7].count(!&:nil?) # Syntax error
Instead, I need to use the long-form:
[0,4,7].map { |e| e.to_s(2)} # => ["0", "100", "111"]
[0,4,7].select { |e| !e.zero?} # => [4,7]
[0,4,7].select { |e| e < 5 } # => [0,4]
[0,4,7].count { |e| !e.nil? } # => 3
What other options do I have? Which ways can I modify the Proc or method I'm calling? Is there any way to pass parameters, or to use logical operators like negation (!)?