Stories
Slash Boxes
Comments
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • 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)
    }