http://en.wikipedia.org/wiki/Memoization
I'm wondering if anyone has experimented with creating an automatic
memoization function within LC? Given that we can access argument lists, and
have "do," it seems possible, but I'm betting commas in the arguments would
be a pain. Something like this:
function m functionName
local callHistory,callHistoryValue
-- parse out addition arguments to m
-- concatenate functionName & arguments into functionCallString
if callHistory[functionCallString] is not empty then
return callHistoryValue[functionCallString]
end if
-- get the function result
put it into callHistoryValue[functionCallString]
put 1 into callHistory[functionCallString]
return it
end m
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode