{"published":"2015-07-17 19:10:47","author_name":"yuhei_kagaya","title":"\u6700\u8fd1\u5b66\u3093\u3060Ruby","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fyuheikagaya.hatenablog.jp%2Fentry%2F2015%2F07%2F17%2F191047\" title=\"\u6700\u8fd1\u5b66\u3093\u3060Ruby - yuhei.kagaya\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","height":"190","categories":["ruby"],"blog_title":"yuhei.kagaya","provider_name":"Hatena Blog","type":"rich","blog_url":"https://yuheikagaya.hatenablog.jp/","width":"100%","image_url":null,"provider_url":"https://hatena.blog","url":"https://yuheikagaya.hatenablog.jp/entry/2015/07/17/191047","version":"1.0","author_url":"https://blog.hatena.ne.jp/yuhei_kagaya/","description":"Range\u306e\u7bc4\u56f2 p (1..10).to_a p (1...10).to_a [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] [1, 2, 3, 4, 5, 6, 7, 8, 9] \u591a\u91cd\u4ee3\u5165\u3068flatten \u8907\u6570\u306e\u5f15\u6570\u3067\u3082\u3001\u914d\u5217\u3067\u3082\u3001\u3069\u3063\u3061\u3067\u3082\u5f15\u6570\u306b\u3068\u308c\u3066\u4fbf\u5229 def f(*params) params.flatten.reduce { |sum, v| sum + v } end p f 10, 20, 30 p f [10, 20, 30] p f 10, [20, 30] 60 60 60 Proc#curry \u30ab\u30ea\u30fc\u5316\u3057\u305fProc\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u8fd4\u3059 def f(&bl\u2026"}