https://en.wikipedia.org/wiki/Factorialusing Functional Programming?
pay attention in class next time
>>107264252recursion
>>107264543i try it, it out of memory at fab(17)
>>107264610works on my machine
>>107264654now try:https://en.wikipedia.org/wiki/Fibonacci_sequence
>>107264674Done that also, works perfectly
>>107264904show code
>>107264940Sure, this is in Luafunction fib(n) return fib_helper(n, 0, 1)endfunction fib_helper(n, a, b) if n == 0 then return a else return fib_helper(n - 1, b, a + b) endendprint(fib(50))
function fib(n) return fib_helper(n, 0, 1)endfunction fib_helper(n, a, b) if n == 0 then return a else return fib_helper(n - 1, b, a + b) endendprint(fib(50))