18 lines
450 B
Plaintext
18 lines
450 B
Plaintext
{
|
|
// Start with which Fibonacci number we want (Nth Fibonacci number)
|
|
2 - // We push the first two already
|
|
dup 0 <= { drop 1 } {
|
|
1 1 // Starting Fibonacci numbers
|
|
rot 0 swap // Setting up loop from zero to N
|
|
{
|
|
drop // Discard the loop counter
|
|
swap 1 pick // Swap n-1 and n-2 and copy n-1
|
|
+ // Add n-2 and the copy of n-1
|
|
// n and n-1 left on stack
|
|
} for
|
|
swap drop // Drop n-1 from the stack
|
|
} if
|
|
} lambda ::fib const
|
|
|
|
8 fib
|