Super fast recursive Fibonacci implementation in LuaX
The Fibonacci sequence is a classical hello-world application for functional programming. The challenge here is to get a fast implementation. We will first show two classical implementations: the trivial recursive definition that is very slow and the iterative version that is slightly faster.
And a third one that is blazing fast.
So here is my own version...
- the source code in LuaX: fib.lua
- the source code of the document for Typst: fib.typ
- the document rendered in PDF: lua-fibonacci.pdf
See also an implementation in Haskell: https://github.com/CDSoft/haskell-fibonacci