geam-stdlib 0.2.1

Official Gleam standard-library providers for Geam
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import gleam/int
import gleam/list

pub fn main() {
  let source = [1, 2, 3, 4, 5, 6]
  let shuffled = list.shuffle(source)
  assert list.sort(shuffled, int.compare) == source

  let sample = list.sample(source, 3)
  assert list.length(sample) == 3
  assert list.length(list.unique(sample)) == 3
  assert list.all(sample, fn(value) { list.contains(source, value) })
  Nil
}
// @geam:expect Nil