RosettaCodeData/Task/Catamorphism/Gleam/catamorphism.gleam
2026-04-30 12:34:36 -04:00

7 lines
207 B
Gleam

import gleam/list
pub fn main() {
let _ = [1, 4, 8, 3] |> list.reduce(fn(x, y) { x + y }) // Ok(16)
// Or, with a seed
let _ = [1, 4, 8, 3] |> list.fold(from: 100, with: fn(x, y) { x + y }) // 116
}