{"description":"Revenge of the Nerds Ruby def foo(n) lambda { |i| n += i } end f = foo(1) puts f.call(1) puts f.call(2) puts f.call(3) puts f.call(4) puts f.call(5) #=> 2 #=> 4 #=> 7 #=> 11 #=> 16 #=> nil Python Python \u306e lambda \u306f\u5f0f\u3057\u304b\u4f7f\u3048\u306a\u3044\u3002\u4ee3\u5165\u306f\u6587\u306a\u306e\u3067\u4e0b\u8a18\u306f\u30a8\u30e9\u30fc\u306b\u306a\u308b\u3002 def foo(n): lambda i: n += i # SyntaxError: invalid syntax \u3060\u304b\u2026","blog_url":"https://cortyuming.hateblo.jp/","author_name":"CortYuming","url":"https://cortyuming.hateblo.jp/entry/20120611/p1","provider_url":"https://hatena.blog","blog_title":"\u724c\u8a9e\u5099\u5fd8\u9332 -pygo","categories":["Python","Ruby"],"version":"1.0","title":"\u300e\u30cf\u30c3\u30ab\u30fc\u3068\u753b\u5bb6\u300f\u7b2c13\u7ae0 \u30aa\u30bf\u30af\u91ce\u90ce\u306e\u5fa9\u7fd2 \u4ed8\u9332\uff1a\u529b \u306e\u30a2\u30ad\u30e5\u30e0\u30ec\u30fc\u30bf\u306e\u3068\u3053\u30af\u30ed\u30fc\u30b8\u30e3\u306e\u4ef6\u306e\u30e1\u30e2","width":"100%","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fcortyuming.hateblo.jp%2Fentry%2F20120611%2Fp1\" title=\"\u300e\u30cf\u30c3\u30ab\u30fc\u3068\u753b\u5bb6\u300f\u7b2c13\u7ae0 \u30aa\u30bf\u30af\u91ce\u90ce\u306e\u5fa9\u7fd2 \u4ed8\u9332\uff1a\u529b \u306e\u30a2\u30ad\u30e5\u30e0\u30ec\u30fc\u30bf\u306e\u3068\u3053\u30af\u30ed\u30fc\u30b8\u30e3\u306e\u4ef6\u306e\u30e1\u30e2 - \u724c\u8a9e\u5099\u5fd8\u9332 -pygo\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","type":"rich","author_url":"https://blog.hatena.ne.jp/CortYuming/","provider_name":"Hatena Blog","image_url":null,"published":"2012-06-11 00:00:00","height":"190"}