On 31 January 2014 15:48, SASADA Koichi <ko1 / atdot.net> wrote:

>     p [1, 2, 3, 4].map(&4.method(:+)) #=3D> [5, 6, 7, 8]
>     p [1, 2, 3, 4].map(&=EB{|x| 4+x})  #=3D> [5, 6, 7, 8]
>     p [1, 2, 3, 4].map(&=EB(4, :+))    #=3D> [5, 6, 7, 8]
>     p [1, 2, 3, 4].map(&=EB("4+"))     #=3D> [5, 6, 7, 8]
>     p [1, 2, 3, 4].map(&=EB{4+_})      #=3D> [5, 6, 7, 8] (doesn't run)
>

Are any of these actually better than:

    p [1, 2, 3, 4].map{|x| 4+x }

?


--=20
  Matthew Kerwin
  http://matthew.kerwin.net.au/