package alba
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=203ee151ce793a977b2d3e66f8b3a0cd7a82cc7f15550c63d88cb30c71eb5f95
md5=64367c393f80ca784f88d07155da4fb0
doc/alba.fmlib/Fmlib/List/index.html
Module Fmlib.List
List Monad
val return : 'a -> 'a treturn a makes a singleton list with the element a.
l >>= f applies the function f to all elements of the list l and concatenates all lists.
f >=> g composes the two monadic functions f and g.
flst <*> lst is equivalent to flst >>= fun f -> map f lst i.e. it maps all functions contained in flst over the list lst and then concatenates the results.
join is the same as concat.
Modified list functions
val find : ('a -> bool) -> 'a t -> 'a optionfind p l finds an element e in the list l which satisfies p e.
val nth_strict : int -> 'a t -> 'aith_strict n list returns the nth element of the list. Precondition: list has at least n + 1 elements.
val nth : int -> 'a t -> 'a optionith_strict n list returns the nth element of the list if the list is long enough. Otherwise None is returned.
List functions from Stdlib
append a b prepends the lists a in front of the list b. Synonym a @ b.
concat ll concatenates all lists contained in the list of lists ll.
rev_append a b prepends the lists rev a in front of the list b.
val length : 'a t -> intAdditional list functions
map_and_filter f list maps the list with f and removes the element for which f e = None.
split_at p lst scans the list until it finds the first element satisfying p and returns the prefix and the remainder starting at the encountered element.
Monadic list folding
module Monadic_fold (M : Module_types.MONAD) : sig ... endMonadic list folding