mesv/util
A file containing various utility functions that don’t exactly fit into any of the other modules.
They are purely for internal use - but since most of them are generic, there’s nothing stopping you, as the end user, from calling them in your own code.
However, beacause:
- I doubt most people would find themselves in a situation where they need them
- They are not particularly easy to understand
these functions are not considered part of the functionality provided by this library, and therefore are not documented that well.
Values
pub fn count_occurences(of find: String, in in: String) -> Int
Internal helper function to count how many overlapping occurences of the first argument appear in the second argument.
If there are none, this function returns the length of the second argument.
pub fn list_merge_map(
list: List(a),
merge: fn(a, a) -> option.Option(a),
) -> List(a)
Internal helper function that traverses a list, calling the merge function on
all consecutive elements.
If the function returns Some(a), then the two elements are replaced with the contents,
and if it returns None, the function advances to the next pair of elements.