maksimKorzh/tapelang

examples/fibonacci.tl crashes with user input of '1'

Closed this issue · 1 comments

As the title says, though unfortunately I'm not experienced enough in Tapelang to understand why it's happening.

Hi @phunanon, thanks for pointing out a bug. The problem was as follows:

in file fibonacci.tl:
line 21: {0 #3 =#4 .% #6. #0-} if count &= 0 next &= count
line 22: {1 #3 =#4 .% #6. #0-} if count &= 1 next &= count

changed to
line 21: {0 #3 =#4 .% #6. } if count &= 0 next &= count
line 22: {1 #3 =#4 .% #6. } if count &= 1 next &= count

I've used #0- for debugging and forgot to remove it, sorry for inconvenience)
That wasn't really a crush... It was simply trapped into a loop after decrementing byte at cell 0, so
the byte before "[" returned wrong value. After it has wrapped around byte value from -128 to 127 and finally returned. Just a typo. I've fixed both fibonacci example files, it should now work fine. Thanks for your feedback.