On Oct 21, 2008, at 1:51 PM, Wolfgang N=E1dasi-Donner wrote:

> If you include "it can be very confusing" into the list of possible =20=

> answers, then the examples from "eigenclass.org" will show it...
>
> irb(main):001:0> -> a, b  { a + b }.call(1,2)
> =3D> 3
> irb(main):002:0> c =3D 1; -> a, b; c  { c =3D a + b }.call(1,2); c
> =3D> 1
> irb(main):003:0> c =3D 2; -> ;c { c =3D 1 }.call; c
> =3D> 2
> irb(main):004:0> c =3D 2; -> *d ; c { d }.call(1,2,3)
> =3D> [1, 2, 3]
> irb(main):005:0> c =3D 2; -> ; c { c =3D 1 }.call; c
> =3D> 2
>
> Because the parantheses can be ommited, it can came closer to =20
> RegExes from the viewpoint of readability ;-)

But all these now work with lambda, too:

p(-> a, b  { a + b }.call(1,2))
# =3D> 3
p((lambda {|a, b| a + b }).call(1,2))
# =3D> 3

c =3D 1; -> a, b; c  { c =3D a + b }.call(1,2); p c
# =3D> 1
c =3D 1; (lambda { |a, b; c| c =3D a + b }).call(1,2); p c
# =3D> 1

c =3D 2; -> ;c { c =3D 1 }.call; p c
# =3D> 2
c =3D 2; (lambda { |;c| c =3D 1 }).call; p c
# =3D> 2


c =3D 2;p( -> *d ; c { d }.call(1,2,3))
# =3D> [1, 2, 3]
c =3D 2; p(lambda {|*d ; c| d }.call(1,2,3))
# =3D> [1, 2, 3]


I'm trying to work out if -> has any additional functionality over =20
lambda.=