Talk:Formal power series: Difference between revisions

no edit summary
mNo edit summary
No edit summary
Line 6:
::: 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)
::::Is ''indirection'' mean the ''interface'' which called like a class? I think it is one of the D ways to do ''closure''. Actually I am still wondering how it work. -- [[User:Badmadevil|badmadevil]] 04:32, 6 April 2008 (MDT)
::::: It's the extra member ''term'' of type ''UT''. I don't understand D enough to say why you need an ''interface'', or if you need one at all. I only understand that the usual way to implement lazyness is to use such an extra variable. And yes, it's related to closures -- the call to a generator mentioned above can also be a closure. As I said, I don't understand D well enough, but it still doesn't look like I would expect it. In particular, you still seem to have the efficiency problem (try multiplying three series, and insert some debugging code that shows you when a coefficient gets calculated. You should see that the same coefficient gets calculated multiple times, which means a '''lot''' of times at higher numbered coefficients. --[[User:Dirkt|Dirkt]] 05:36, 6 April 2008 (MDT)
 
BTW, I only mentioned the rationals as a "nice to have" feature (because then you can immediately see if the coefficients for sine and cosine are correct). If you need an extra module that implements the rationals from scratch, and if you don't have arbitrary precision anyway, I personally would prefer ''double''s. The task leaves this detail unspecified on purpose. --[[User:Dirkt|Dirkt]] 05:36, 6 April 2008 (MDT)
Anonymous user