{"image_url":null,"url":"https://inamori.hateblo.jp/entry/20110510/p1","blog_title":"inamori\u2019s diary","version":"1.0","height":"190","author_name":"inamori","provider_name":"Hatena Blog","blog_url":"https://inamori.hateblo.jp/","author_url":"https://blog.hatena.ne.jp/inamori/","width":"100%","type":"rich","provider_url":"https://hatena.blog","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Finamori.hateblo.jp%2Fentry%2F20110510%2Fp1\" title=\"Scala\u3067Project Euler\uff085\uff09 - inamori\u2019s diary\" class=\"embed-card embed-blogcard\" scrolling=\"no\" frameborder=\"0\" style=\"display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;\"></iframe>","categories":["Scala"],"title":"Scala\u3067Project Euler\uff085\uff09","published":"2011-05-10 00:00:00","description":"Problem 2 Stream Iterable\u3092\u3064\u304b\u3063\u305f\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u306f\u30a4\u30b1\u3066\u306a\u304b\u3063\u305f\u3067\u3059\u304c\u3001\u3082\u3046\u4e00\u3064Haskell\u3068\u540c\u3058\u3088\u3046\u306a\u7121\u9650\u5217\u3092\u751f\u6210\u3059\u308b\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u304cStream\u3067\u3059\u3002\u6b21\u306fPython\u306ecount\u3068\u540c\u3058\u3088\u3046\u306b1\u305a\u3064\u5897\u3048\u308b\u7121\u9650\u5217\u3092\u751f\u6210\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u306e\u4f8b\u3067\u3059\u3002 def count(n :Int = 0) :Stream[Int] = Stream.cons(n, count(n + 1)) Stream\u306f\u5217\u306e\u5b9f\u4f53\u3092\u4fdd\u6301\u3057\u306a\u304c\u3089\u751f\u6210\u3057\u3066\u3044\u304f\u3088\u3046\u3067\u3059\uff08\u672c\u5f53\u306b\u4fdd\u6301\u3059\u308b\u304b\u306f\u305f\u3076\u3093\u307e\u305f\u5225\u306e\u8a71\uff09\u3002Stream.cons\u306fStream\u306e\u5217\u306e\u524d\u306b\u8981\u7d20\u3092\u52a0\u3048\u308b\u30e1\u30bd\u30c3\u30c9\u3067\u3059\u3002\u3053\u308c\u3067Haskell\u3068\u2026"}