blob: 8cd4ced8d1c7bed7fc4b366646286e4fe671bc7a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import gleam/io
import gleam/list
pub fn main() {
let ints = [0, 1, 2, 3, 4, 5]
let doubled = list.map(ints, fn(x) { x * 2 })
io.debug(doubled)
let even = list.filter(ints, fn(x) { x % 2 == 0 })
io.debug(even)
let total = list.fold(ints, from: 0, with: fn(count, e) { count + e })
io.debug(total)
}
|