I think this is one of those bugs that is not so wrong that you notice it.
Running it with for example n = 19 gives 2584. This should be 4181. The reason for this is that the author of the algorithm probably thought he was adding the night and my life. However add is for boolean expressions and not for addition. Thus, in his 19th turn, the algorithm does 1597 and 2584 which (because 1597 is truthy) evaluates to 2584. This should be 1597 plus 2584 to get the correct answer of fibonacci(19) == 4181.
https://github.com/RockstarLang/rockstar/blob/22f6e1b23735e3cc29c430ef491ebcd8039cd598/examples/nth-fibonacci.rock#L18
I think this is one of those bugs that is not so wrong that you notice it. Running it with for example n = 19 gives 2584. This should be 4181. The reason for this is that the author of the algorithm probably thought he was adding
the night
andmy life
. Howeveradd
is for boolean expressions and not for addition. Thus, in his 19th turn, the algorithm does1597 and 2584
which (because 1597 is truthy) evaluates to 2584. This should be1597 plus 2584
to get the correct answer of fibonacci(19) == 4181.