list
The Disco standard list library can be imported with
import list
It provides the following functions. For more information, import the
list module and ask for documentation on any function. For
example,
:doc foldr
You can also look at the Disco source code of the list library.
foldris for folding a list, i.e. reducing a list to a summary value.appendglues two lists end-to-end into a single list.concatflattens a list of lists into a single list.eachlistapplies a function to every element of a list. This can also be done via the built-ineachfunction, buteachlistis provided so you can look at its implementation.takereturns a prefix of a given length.lengthcomputes the length of a list.listCPcomputes the Cartesian product of two lists.zipWithapplies a binary function pairwise to the elements of two lists.filterlistfilters a list according to a predicate. Again, this can also be done with the built-infilterfunction, but it’s nice to see howfilterlistis implemented.