LoginSignup
4
2

More than 5 years have passed since last update.

(ちいと古いが)Rubyのlambdaリテラル「->」の由来

Posted at

概要

かなり前のruby 1.9から導入されているlambdaリテラル「->」の由来
・案外知られてないんではないか? 
・こーゆーのがあると言語が覚えやすいのでは?
との思いで下記します。

matzさんによる、rubyのラムダリテラル「->」の由来説明

おそらくこんな英語

Someone says "this won't see a lambda,
you have to put the argument before the arrow
like Hask i mean the C# does."

It really does remind you the lambda once you get.
For example, I change the font, twist a bit,

here we go this is a lambda.
Anyway perl 6 does the same syntax.

適当な訳

「C#みたいに引数が矢印の前にこない文法でないと、ラムダに見えない」
というひともいましたが、
一度わかってもらえればこれは本当にラムダを思い出させる(リテラルです)。
たとえば、フォントを変えて、傾けると、、ラムダ「λ」だ!
Perl6もおなじ文法となっとります。

↓のコメント欄でも紹介されてました。
http://stackoverflow.com/a/25572560

所感

->を傾けると「λ」になると知ってると、無理にでも->で書こうという気になるので、とても気に入っている。
・Haskellもなんかリテラルがあるんかね?

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2