{"version":"1.0","categories":["Scala"],"published":"2011-05-09 00:00:00","image_url":null,"blog_url":"https://inamori.hateblo.jp/","author_url":"https://blog.hatena.ne.jp/inamori/","type":"rich","author_name":"inamori","html":"<iframe src=\"https://hatenablog-parts.com/embed?url=https%3A%2F%2Finamori.hateblo.jp%2Fentry%2F20110509%2Fp1\" title=\"Scala\u3067Project Euler\uff084\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>","url":"https://inamori.hateblo.jp/entry/20110509/p1","width":"100%","provider_url":"https://hatena.blog","title":"Scala\u3067Project Euler\uff084\uff09","height":"190","description":"Problem 2\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u3067\u3059\u306d\u3002\u3053\u308c\u306f\u7121\u9650\u306b\u7d9a\u304f\u30d5\u30a3\u30dc\u30ca\u30c3\u30c1\u6570\u5217\u3092\u4f5c\u308b\u554f\u984c\u3067\u3059\u3002Python\u306a\u3089 def fib(): a, b = 0, 1 while True: yield b a, b = b, a + b Haskell\u306a\u3089 fib = 1:1:[ a + b | (a, b) <- zip fib (tail fib) ] Scala\u306b\u306f2\u7a2e\u985e\u306e\u7121\u9650\u5217\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002 Iterator Iterator\u306fPython\u306e\u305d\u308c\u3068\u540c\u3058\u304f\u5217\u306e\u5b9f\u4f53\u306f\u6301\u305f\u306a\u3044\u3067\u5024\u3092\u751f\u6210\u3057\u3066\u3044\u304f\u6a5f\u69cb\u3067\u3059\u3002\u305f\u3060\u3001\u4e0a\u306ePython\u306egenerator\u306e\u3088\u3046\u306a\u304a\u624b\u8efd\u306a\u66f8\u304d\u65b9\u306f\u3067\u304d\u305a\u3001Iterator\u30af\u30e9\u30b9\u3092\u2026","blog_title":"inamori\u2019s diary","provider_name":"Hatena Blog"}