On Oct 21, 2008, at 1:51 PM, Wolfgang NŠŇasi-Donner wrote:

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

But all these now work with lambda, too:

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

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

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


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


I'm trying to work out if -> has any additional functionality over