<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>mkotha</author_name>
  <author_url>https://blog.hatena.ne.jp/mkotha/</author_url>
  <blog_title>www.kotha.netの裏</blog_title>
  <blog_url>https://mkotha.hatenadiary.org/</blog_url>
  <categories>
    <anon>haskell</anon>
  </categories>
  <description>Haskellでフィボナッチ数を計算するコードとして、次のものが有名だ。 fib :: [Integer] fib = 1 : 1 : zipWith (+) fib (tail fib) これのn番目の要素を取得するコードがO(n^2)よりも遅いということを指摘した記事があった。 Haskellの「fib = 1:1:zipWith (+) fib (tail fib)」はとても遅い - 西尾泰和のはてなダイアリー 実はこの現象は、リストfibを先頭から順番に使っていった場合には起こらない。(!!)などでリストの途中の要素を取得して、その値をいきなり評価した場合に発生する。以下が実証用コード…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fmkotha.hatenadiary.org%2Fentry%2F20100623%2F1277286946&quot; title=&quot; fib = 1 : 1 : zipWith (+) fib (tail fib) が遅いかどうかは、使い方に依存する - www.kotha.netの裏&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2010-06-23 18:55:46</published>
  <title> fib = 1 : 1 : zipWith (+) fib (tail fib) が遅いかどうかは、使い方に依存する</title>
  <type>rich</type>
  <url>https://mkotha.hatenadiary.org/entry/20100623/1277286946</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
