Manipulating Lists with Belt.List
The Belt.List module defines a large number of functions for processing lists. (Just a note: the Belt.List definitions and examples[22] are written in OCaml format.) We’ll use the following list for many of the examples:
| let items = [10, 11, 12, 13, 14, 15, 16]; |
For example, the length function returns the number of elements in the list, so length(items) returns 7. You can use size as a synonym for length.
This section is going to be somewhat of a laundry list of utility functions because it’s difficult to find a specific example that uses all of them. (It’s not an exhaustive list. See the documentation for that.) To make it easier to read, I’ll avoid prefacing each function ...
Get Web Development with ReasonML now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.