2010/5/28 Caleb Clausen <vikkous / gmail.com>:
> On 5/27/10, Paul A. <cyril.staff / gmail.com> wrote:
>> Hi,
>>
>> Just a thin post in order to purpose this:
>>
>> I think it could be cool to call lambda function just like: >>
>> Such as:
>>
>> a = 0
>> my_while    >>  >>    >> end
>
> Honestly, why is this better than:
>
>  ½
>   
>  >  «>  

or even

5.times do |a|
  puts a
end

or even

puts (0...5).to_a

> This way is so much less noisy and more succinct. You could even leave
> off the do.
>
> lambdas should not be used to replace arbitrary expressions. Only
> where you need them.

Yep, fully agree.

> Putting Robert's doubts about encoding issues aside, you can already
> do this in both 1.8 and 1.9:
>
> #encoding: utf-8
> alias lambda
> x= p :foo }
> x.call #=> :foo
>
> In 1.8, you do have to pass -Ku on the command line, tho.

This is cool!  Thanks for that.

> I am with Piyush on the question of how you type these things, tho. My
> keyboard only has ascii on it. I'm putting off adopting unicode until
> a unicode keyboard is available.

You'll need a new desk then, too - and probably a set of arm extensions. :-)

Cheers

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/