Question about memoize

Richie richie at 4rensics.org
Wed Oct 3 18:45:45 PDT 2012


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.


More information about the Digitalmars-d-learn mailing list