Skip to the content

Bagl playground

// A function, a recursive function and a call.
// The result is the sum of the squares from 1 to 10.
let square = fn x -> x * x in
letrec sum = fn n -> if n == 0 then 0 else square n + sum (n - 1)
in sum 10

Running