{"type":"rich","categories":["ruby"],"published":"2008-04-20 05:28:56","provider_url":"https://hatena.blog","height":"190","blog_url":"https://rubikitch.hatenadiary.org/","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Frubikitch.hatenadiary.org%2Fentry%2F20080420%2F1208636936\" title=\"Enumerable#inject\u306f\u304a\u304b\u3057\u304f\u306a\u3044 - http://rubikitch.com/\u306b\u79fb\u8ee2\u3057\u307e\u3057\u305f\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","title":"Enumerable#inject\u306f\u304a\u304b\u3057\u304f\u306a\u3044","author_name":"rubikitch","provider_name":"Hatena Blog","description":"ruby\u306einject\u306b\u306f\u30d0\u30b0\u304c\u3042\u308b\u306e\u304b? - \u8a08\u7b97\u6a5f\u3068\u622f\u308c\u308b\u65e5\u3005 [1, 2, 2, 3, 2].inject([1]){|a,i|p a;p a[-1];a<<i} # => [1, 1, 2, 2, 3, 2] # >> [1] # >> 1 # >> [1, 1] # >> 1 # >> [1, 1, 2] # >> 2 # >> [1, 1, 2, 2] # >> 2 # >> [1, 1, 2, 2, 3] # >> 3 [1, 2, 2, 3, 2].inject([1]){|a,i|p a;p a[-1];a<<i if i!=a[-1]} # ~> -:1:in `block\u2026","blog_title":"http://rubikitch.com/\u306b\u79fb\u8ee2\u3057\u307e\u3057\u305f","width":"100%","url":"https://rubikitch.hatenadiary.org/entry/20080420/1208636936","version":"1.0","image_url":null,"author_url":"https://blog.hatena.ne.jp/rubikitch/"}