RosettaCodeData/Task/Catamorphism/Gleam/catamorphism.gleam

8 lines
207 B
Gleam
Raw Permalink Normal View History

2026-04-30 12:34:36 -04:00
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
}