Legend:
Library
Module
Module type
Parameter
Class
Class type
A Nel, for Non Empty List, is a list that ensures it has at least one element, which is very useful for describing, for example, error lists, where if there is an error, we ensure that there is at least one error.
Types
type'a t =
| ::of'a * 'a list
A non-empty list is nothing more than a pair of a value and a list.
concat nel Concatenate a non-empty list of non-empty lists. The elements of the argument are all concatenated together (in the same order) to give the result.
iteri f nel same as iter but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.
mapi f nel same as map but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.
rev_mapi f nel same as rev_map but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.
concat_mapi f nel same as concat_map but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.
fold_left reducer default nel is fold_left f init [b1; ...; bn] is f (...
(f (f init b1) b2) ...) bn.
val fold_lefti : (int ->'acc->'a->'acc)->'acc->'at->'acc
fold_lefti f default nel same as fold_left but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.
val fold_right : ('a->'acc->'acc)->'at->'acc->'acc
fold_right f nel default is fold_right f [a1; ...; an] init is f a1 (f a2
(... (f an init) ...)).
val fold_righti : (int ->'a->'acc->'acc)->'at->'acc->'acc
fold_righti f nel default same as fold_right but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.