{"published":"2015-06-10 20:18:22","author_name":"osyo-manga","title":"Ruby \u306e proc \u3068 lambda \u306e\u9055\u3044","provider_url":"https://hatena.blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsecret-garden.hatenablog.com%2Fentry%2F2015%2F06%2F10%2F201822\" title=\"Ruby \u306e proc \u3068 lambda \u306e\u9055\u3044 - Secret Garden(Instrumental)\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","image_url":null,"blog_title":"Secret Garden(Instrumental)","categories":["Ruby"],"url":"https://secret-garden.hatenablog.com/entry/2015/06/10/201822","type":"rich","provider_name":"Hatena Blog","height":"190","author_url":"https://blog.hatena.ne.jp/osyo-manga/","description":"Ruby \u3067\u30d6\u30ed\u30c3\u30af\u3092\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3068\u3057\u3066\u6271\u3044\u305f\u3044\u5834\u5408\u3001proc \u3084 lambda \u3092\u5229\u7528\u3059\u308b\u4e8b\u304c\u3067\u304d\u307e\u3059\u3002 proc = proc { |a, b| a + b } proc.call 1, 2 # => 3 lam = lambda { |a, b| a - b } lam.call 1, 2 # => -1 \u3053\u306e 2\u3064\u306f\u66f8\u304d\u65b9\u306f\u4f3c\u3066\u3044\u307e\u3059\u304c\u3001\u6319\u52d5\u304c\u5c11\u3057\u7570\u306a\u308a\u307e\u3059\u3002 \u5f15\u6570\u304c\u7570\u306a\u308b\u5834\u5408\u306e\u30a8\u30e9\u30fc\u306e\u6709\u7121 lambda \u306f\u30d6\u30ed\u30c3\u30af\u306e\u5f15\u6570\u304c\u7570\u306a\u308b\u3068\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u304c\u3001proc \u306e\u5834\u5408\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u305b\u3093\u3002 proc = proc { |a, b| a + b } # \u30a8\u30e9\u30fc\u306b\u306a\u3089\u306a\u3044 # \u7b2c\u4e09\u5f15\u6570\u4ee5\u964d\u2026","width":"100%","blog_url":"https://secret-garden.hatenablog.com/","version":"1.0"}