File: discussion.mdwn

package info (click to toggle)
ikiwiki 3.20260201-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 22,068 kB
  • sloc: perl: 31,488; javascript: 16,668; python: 428; sh: 213; makefile: 124
file content (20 lines) | stat: -rw-r--r-- 655 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Thanks for the tutorial!

But I think you have an error in the fib function! If you really start with

    my $last = 0;

and your fib function, you'll get this error, as you've produced a never ending recursion:

    Deep recursion on subroutine "IkiWiki::Plugin::fib::fib" at ./fib.pm line 29.

So the fib function should better look like this, which is its true definition (see [[Wikipedia|http://de.wikipedia.org/wiki/Fibonacci-Folge]], for example):

	sub fib {
		my $num=shift;
		return 0 if $num == 0;
		return 1 if $num == 1;
		return fib($num - 1) + fib($num - 2);
	}

Just as a hint for people who run into this error while doing this tutorial.