{"provider_name":"Hatena Blog","title":"Scala\u306eforeach\u306f\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u3067\u66f8\u3051\u308b\u306e\u306d","width":"100%","type":"rich","provider_url":"https://hatena.blog","version":"1.0","description":"val hoge = List(1, 3, 5, 7) \u3053\u3093\u306a\u30ea\u30b9\u30c8\u304c\u3042\u308b\u3068\u3057\u3066 \u9806\u756a\u306b\u8981\u7d20\u3092\u51fa\u529b\u3057\u3066\u307f\u3088\u3046\u3002 \ud83d\udc7b\u4f8b1 foreach\u3092\u4f7f\u3046\u3068 hoge.foreach(h => { println(h) }) \u3053\u3046\u306a\u308b\u3002 \ud83d\udc7b\u4f8b2 \u3053\u308c\u3092\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u3068\u518d\u5e30\u7684\u306a\u30b5\u30e0\u30b7\u30f3\u3067\u3082\u66f8\u3051\u308b\u3063\u307d\u3044\u3002 @tailrec def f(hoge: List[Int]): List[Int] = { hoge match { case h :: fuga => println(h) f(fuga) case _ => List.empty[Int] } } f(hoge)\u3092\u547c\u3073\u51fa\u305b\u3070\u4f8b1\u3068\u540c\u3058\u306b\u306a\u308b\u3002 \u4f55\u6545\u6025\u306b\u3053\u2026","categories":["Scala"],"height":"190","blog_url":"https://ihcomega.hatenadiary.com/","author_url":"https://blog.hatena.ne.jp/ihcomega/","url":"https://ihcomega.hatenadiary.com/entry/2016/07/27/211148","published":"2016-07-27 21:11:48","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Fihcomega.hatenadiary.com%2Fentry%2F2016%2F07%2F27%2F211148\" title=\"Scala\u306eforeach\u306f\u30d1\u30bf\u30fc\u30f3\u30de\u30c3\u30c1\u3067\u66f8\u3051\u308b\u306e\u306d - \u3088\u3053\u306a\u306e\u3078\u305f\u306e\u3088\u3053\u305a\u304d\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","author_name":"ihcomega","image_url":"https://cdn-ak.f.st-hatena.com/images/fotolife/i/ihcomega/20160727/20160727210926.png","blog_title":"\u3088\u3053\u306a\u306e\u3078\u305f\u306e\u3088\u3053\u305a\u304d"}