Recursion
Shakedp opened this issue · comments
⭐️ Proposed change
Maybe it exists already, but I didn't find a way to use it - I need to write a recursive function but Ican't reference its name from within the function - doesn't compile.
🕺 Example
Ackermann function:
🍇 m🔢 n🔢 ➡️ 🔢
😀 🔤ackermann(🧲m🧲,🧲n🧲)🔤 ❗️
↪️ m 🙌 0 🍇
↩️ n ➕ 1
🍉
🙅↪️ n 🙌 0 🍇
↩️ result
🍉
🙅 🍇
↩️ result
🍉
🍉 ➡️ ackerman
Fails to compile:
file2.🍇:24:8: 🚨 error: Variable "ackerman" not defined.
⬆️
Write a method to easily achieve this.
(You can do this with callables but you would need to declare the variable as optional first, then assign the closure to the variable and obviously unwrap the accesses to your closure variable.)