Talk:Formal power series: Difference between revisions

no edit summary
No edit summary
Line 4:
: You beat to me flagging it as incorrect :-) And the key is lazyness, which in principle should also work in a non-functional language. As D doesn't seem to support it directly, you'll have to emulate it: Each coefficient should be a class that either already has a concrete value (an infinite precision rational, if available), or contains a call to a generator that can calculate the value. The first time the value is required, the generator is called, the next time, the cached value is used ("call-by-need"). That will also get rid of the inefficiencies in your implementation when do e.g. multiply several series (which causes the same coefficients to be calculated many times). And you need an infinite list of coefficients, which can be done with the same trick for a cons-cell. Yes, it's much nicer if the language does this naturally, which is the point of this task :-) --[[User:Dirkt|Dirkt]] 03:09, 6 April 2008 (MDT)
::I found it can be done lastly. I struck at how to define the two object at the same time, which is not need. Thanks -- [[User:Badmadevil|badmadevil]] 03:30, 6 April 2008 (MDT)
::: I've seen you added an extra indirection, but I don't see how you handle "call-by-need", i.e. when you replace that indirection with the real value. So does it? But maybe my D guessing skills are not sufficient. --[[User:Dirkt|Dirkt]] 04:14, 6 April 2008 (MDT)
Anonymous user