; status: design/speculative
; Uses recursive calls, `<=`, `*`, and `-` beyond the current strict
; compiler-supported subset. Value-producing `if` and top-level `test` are now
; promoted, but this full example remains speculative.

(module factorial)

(fn factorial ((n i32)) -> i32
  (if (<= n 1)
      1
      (* n (factorial (- n 1)))))

(test "factorial of zero"
  (= (factorial 0) 1))

(test "factorial of five"
  (= (factorial 5) 120))

(fn main () -> i32
  (print_i32 (factorial 5))
  0)
