From 32b56eb7cd04bdd47a548b021602a018bdf782c6 Mon Sep 17 00:00:00 2001 From: Sebastian Porto Date: Sat, 8 May 2021 06:28:31 +1000 Subject: Add list.flat_map (#202) --- test/gleam/list_test.gleam | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/gleam/list_test.gleam b/test/gleam/list_test.gleam index 1e90583..c7e2a34 100644 --- a/test/gleam/list_test.gleam +++ b/test/gleam/list_test.gleam @@ -165,6 +165,11 @@ pub fn flatten_test() { |> should.equal([1, 2, 3, 4]) } +pub fn flat_map_test() { + list.flat_map([1, 10, 20], fn(x) { [x, x + 1] }) + |> should.equal([1, 2, 10, 11, 20, 21]) +} + pub fn fold_test() { [1, 2, 3] |> list.fold([], fn(x, acc) { [x, ..acc] }) -- cgit v1.2.3