View mode: basic / threaded / horizontal-split · Log in · Help
October 04, 2012
Question about memoize
I've pasted a code sample here with a comment of what should be 
printed out: http://dpaste.dzfl.pl/02cfc280

memoize is taken straight from std.functional, I just added a 
writeln so I could see more about what was going on. 
slowFuncString should only be calculated twice with the input 
given: Once for "Test1" and once for "Test2" but it's being 
calculated every time. The same answer will probably answer both 
of these questions but:

1) Why does p = null when the tuple of Test2 is in the memo AA?
2) How does memoize appear to be adding more than one of the same 
key to the memo AA?

Thanks.
October 04, 2012
Re: Question about memoize
Richie:

> 2) How does memoize appear to be adding more than one of the 
> same key to the memo AA?
>
> Thanks.

I have not studied your code much, but maybe it's:
http://d.puremagic.com/issues/show_bug.cgi?id=3789

But this problem is for structs, I think tuples don't have it.

Bye,
bearophile
Top | Discussion index | About this forum | D home