List module
The
gleam/list
standard library module contains functions for working with lists. A Gleam
program will likely make heavy use of this module, the various functions
serving as different types of loops over lists.
map
makes a new list by running a function on each element in a list.
filter
makes a new list containing only the elements for which a function returns
true.
fold
combines all the elements in a list into a single value by running a function
left-to-right on each element, passing the result of the previous call to the
next call.
find
returns the first element in a list for which a function returns
True
.
It's worth getting familiar with all the functions in this module when writing Gleam code, you'll be using them a lot!