Functions

Define functions, recursion, and reusable abstractions.

Functions are first-class values.

fn add(a: Int, b: Int) -> Int {
  a + b
}

Recursion

fn fib(n: Int) -> Int {
  if n <= 1 { n }
  else { fib(n-1) + fib(n-2) }
}

Higher-order style

As the stdlib grows, higher-order helpers become the primary way to express loops and transforms.