👩💻 Join our community of thousands of amazing developers!
As I slowly make progress on my little functional programming language Hue, I’d just wanted to share the “Hello World” of functional programming — factorial and fib. The factorial function calculates the factorial of a natural number: factorial = func (n Int) if n == 0 1 else n * factorial n - 1 factorial 10 # -> 3628800 The fib function computes Fibonacci numbers: fib = func (n Int) if n < 2 n else (fib n-1) + fib n-2 fib 32 # -> 2178309 Hue compiles the above functions into ve...