NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
free memoize, perhaps (Score:2)
What happens if you write name(5) and there is a name array that only has 4 elements but there is also a name function?
If it automatically switches to using the function if there is no element at the requested index then you get memoize for free!
fibonacci(n) {
if( n < 2 ) {
fibonacci(n) = 1
else {
fibonacci(n) = fibonacci(n-1) + fibonacci(n-2)
}
return fibonacci(n)
}
Reply to This