// A map/filter/fold pipeline over a million integers, ten times (each // round a little longer, so that no compiler computes it only once). import std/io import std/list fn round :: k: Int acc: Int -> Int { if k == 0 { acc } else { let doubled = list.map (list.range 1 (1000000 + k)) fn x { x * 2 } let sum = list.fold (list.filter doubled fn x { x % 3 == 0 }) 0 fn a x { a + x } round (k - 1) (acc + sum) } } pub fn main :: -> () / { io.println (show (round 10 0)) }