【发布时间】:2011-06-28 20:16:33
【问题描述】:
我在 D http://www.digitalmars.com/d/2.0/lazy-evaluation.html 中找到了对函数参数进行惰性求值的示例
我想知道如何在 D 中实现可能的无限数据结构,就像 haskell 列表的常见行为一样。
有例子吗?
无限斐波那契数列的等价物是什么:
fibs = 0 : 1 : zipWith (+) fibs (tail fibs)
【问题讨论】:
-
d-programming-language.org/phobos/std_range.html#recurrence 这样的东西能满足你的条件吗?
标签: d lazy-evaluation