package tezos-base

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
include module type of Tezos_stdlib.TzList
val remove : int -> 'a list -> 'a list

remove nb list remove the first nb elements from the list list.

val repeat : int -> 'a -> 'a list

repeat n x is a list of n x's

val shift : 'a list -> 'a list

shift (hd :: tl) computes tl @ [hd]

val product : 'a list -> 'b list -> ('a * 'b) list

product a b computes the Cartesian product of two lists a and b.

val take_n : ?compare:('a -> 'a -> int) -> int -> 'a list -> 'a list

take_n n l returns the n first elements of l. When compare is provided, it returns the n greatest element of l.

val split_n : int -> 'a list -> 'a list * 'a list

split_n n l is a pair of lists (j, k) where j contains the n first elements of l and k the remainder elements. If l has less than or exactly n elements, j is l and k is [].

val select : int -> 'a list -> 'a * 'a list

select n l is (nth element of l, l without that element)

val rev_sub : 'a list -> int -> 'a list

rev_sub l n is List.rev l capped to max n elements

val sub : 'a list -> int -> 'a list

sub l n is l capped to max n elements

val merge_filter2 : ?finalize:('a list -> 'a list) -> ?compare:('a -> 'a -> int) -> ?f:('a option -> 'a option -> 'a option) -> 'a list -> 'a list -> 'a list

merge_filter2 ~compare ~f l1 l2 merges two lists ordered by compare and whose items can be merged with f. Item is discarded or kept whether f returns Some or None

val merge2 : ?finalize:('a list -> 'a list) -> ?compare:('a -> 'a -> int) -> ?f:('a -> 'a -> 'a) -> 'a list -> 'a list -> 'a list

merge2 ~compare ~f l1 l2 merges two lists ordered by compare and whose items can be merged with f

val shuffle : 'a list -> 'a list

shuffle l is a list that contains the same elements as l but in a random order.

val index_of : ?compare:('a -> 'a -> int) -> 'a -> 'a list -> int option

Get the index of an element in a list.

val find_map : ('a -> 'b option) -> 'a list -> 'b option

find_map f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

Present in OCaml 4.10: this function can be removed once we catch up.

include module type of Tezos_error_monad.TzLwtreslib.List
type !'a t = 'a Stdlib.List.t =
  1. | []
  2. | :: of 'a * 'a list
val nil : 'a list
val nil_e : ('a list, 'trace) Stdlib.result
val nil_s : 'a list Lwt.t
val nil_es : ('a list, 'trace) Stdlib.result Lwt.t
val hd : 'a list -> 'a option
val tl : 'a list -> 'a list option
val nth : 'a list -> int -> 'a option
val nth_opt : 'a list -> int -> 'a option
val last : 'a -> 'a list -> 'a
val last_opt : 'a list -> 'a option
val find : ('a -> bool) -> 'a list -> 'a option
val find_opt : ('a -> bool) -> 'a list -> 'a option
val mem : equal:('a -> 'a -> bool) -> 'a -> 'a list -> bool
val assoc : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> 'b option
val assoc_opt : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> 'b option
val assq : 'a -> ('a * 'b) list -> 'b option
val assq_opt : 'a -> ('a * 'b) list -> 'b option
val mem_assoc : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> bool
val mem_assq : 'a -> ('a * 'b) list -> bool
val remove_assoc : equal:('a -> 'a -> bool) -> 'a -> ('a * 'b) list -> ('a * 'b) list
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
val init : when_negative_length:'trace -> int -> (int -> 'a) -> ('a list, 'trace) Stdlib.result
val length : 'a list -> int
val rev : 'a list -> 'a list
val concat : 'a list list -> 'a list
val append : 'a list -> 'a list -> 'a list
val rev_append : 'a list -> 'a list -> 'a list
val flatten : 'a list list -> 'a list
val combine : when_different_lengths:'trace -> 'a list -> 'b list -> (('a * 'b) list, 'trace) Stdlib.result
val rev_combine : when_different_lengths:'trace -> 'a list -> 'b list -> (('a * 'b) list, 'trace) Stdlib.result
val split : ('a * 'b) list -> 'a list * 'b list
val iter2 : when_different_lengths:'trace -> ('a -> 'b -> unit) -> 'a list -> 'b list -> (unit, 'trace) Stdlib.result
val map2 : when_different_lengths:'trace -> ('a -> 'b -> 'c) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result
val rev_map2 : when_different_lengths:'trace -> ('a -> 'b -> 'c) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result
val fold_left2 : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> ('a, 'trace) Stdlib.result
val fold_right2 : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> ('c, 'trace) Stdlib.result
val for_all2 : when_different_lengths:'trace -> ('a -> 'b -> bool) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result
val exists2 : when_different_lengths:'trace -> ('a -> 'b -> bool) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result
val init_e : when_negative_length:'trace -> int -> (int -> ('a, 'trace) Stdlib.result) -> ('a list, 'trace) Stdlib.result
val init_s : when_negative_length:'trace -> int -> (int -> 'a Lwt.t) -> ('a list, 'trace) Stdlib.result Lwt.t
val init_es : when_negative_length:'trace -> int -> (int -> ('a, 'trace) Stdlib.result Lwt.t) -> ('a list, 'trace) Stdlib.result Lwt.t
val init_p : when_negative_length:'trace -> int -> (int -> 'a Lwt.t) -> ('a list, 'trace) Stdlib.result Lwt.t
val find_e : ('a -> (bool, 'trace) Stdlib.result) -> 'a list -> ('a option, 'trace) Stdlib.result
val find_s : ('a -> bool Lwt.t) -> 'a list -> 'a option Lwt.t
val find_es : ('a -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('a option, 'trace) Stdlib.result Lwt.t
val filter : ('a -> bool) -> 'a list -> 'a list
val rev_filter : ('a -> bool) -> 'a list -> 'a list
val rev_filter_some : 'a option list -> 'a list
val filter_some : 'a option list -> 'a list
val rev_filter_ok : ('a, 'b) Stdlib.result list -> 'a list
val filter_ok : ('a, 'b) Stdlib.result list -> 'a list
val rev_filter_error : ('a, 'b) Stdlib.result list -> 'b list
val filter_error : ('a, 'b) Stdlib.result list -> 'b list
val rev_filter_e : ('a -> (bool, 'trace) Stdlib.result) -> 'a list -> ('a list, 'trace) Stdlib.result
val filter_e : ('a -> (bool, 'trace) Stdlib.result) -> 'a list -> ('a list, 'trace) Stdlib.result
val rev_filter_s : ('a -> bool Lwt.t) -> 'a list -> 'a list Lwt.t
val filter_s : ('a -> bool Lwt.t) -> 'a list -> 'a list Lwt.t
val rev_filter_es : ('a -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('a list, 'trace) Stdlib.result Lwt.t
val filter_es : ('a -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('a list, 'trace) Stdlib.result Lwt.t
val filter_p : ('a -> bool Lwt.t) -> 'a list -> 'a list Lwt.t
val rev_partition : ('a -> bool) -> 'a list -> 'a list * 'a list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
val rev_partition_result : ('a, 'b) Stdlib.result list -> 'a list * 'b list
val partition_result : ('a, 'b) Stdlib.result list -> 'a list * 'b list
val rev_partition_e : ('a -> (bool, 'trace) Stdlib.result) -> 'a list -> ('a list * 'a list, 'trace) Stdlib.result
val partition_e : ('a -> (bool, 'trace) Stdlib.result) -> 'a list -> ('a list * 'a list, 'trace) Stdlib.result
val rev_partition_s : ('a -> bool Lwt.t) -> 'a list -> ('a list * 'a list) Lwt.t
val partition_s : ('a -> bool Lwt.t) -> 'a list -> ('a list * 'a list) Lwt.t
val rev_partition_es : ('a -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('a list * 'a list, 'trace) Stdlib.result Lwt.t
val partition_es : ('a -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('a list * 'a list, 'trace) Stdlib.result Lwt.t
val partition_p : ('a -> bool Lwt.t) -> 'a list -> ('a list * 'a list) Lwt.t
val iter : ('a -> unit) -> 'a list -> unit
val iter_e : ('a -> (unit, 'trace) Stdlib.result) -> 'a list -> (unit, 'trace) Stdlib.result
val iter_s : ('a -> unit Lwt.t) -> 'a list -> unit Lwt.t
val iter_es : ('a -> (unit, 'trace) Stdlib.result Lwt.t) -> 'a list -> (unit, 'trace) Stdlib.result Lwt.t
val iter_p : ('a -> unit Lwt.t) -> 'a list -> unit Lwt.t
val iteri : (int -> 'a -> unit) -> 'a list -> unit
val iteri_e : (int -> 'a -> (unit, 'trace) Stdlib.result) -> 'a list -> (unit, 'trace) Stdlib.result
val iteri_s : (int -> 'a -> unit Lwt.t) -> 'a list -> unit Lwt.t
val iteri_es : (int -> 'a -> (unit, 'trace) Stdlib.result Lwt.t) -> 'a list -> (unit, 'trace) Stdlib.result Lwt.t
val iteri_p : (int -> 'a -> unit Lwt.t) -> 'a list -> unit Lwt.t
val map : ('a -> 'b) -> 'a list -> 'b list
val map_e : ('a -> ('b, 'trace) Stdlib.result) -> 'a list -> ('b list, 'trace) Stdlib.result
val map_s : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val map_es : ('a -> ('b, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'trace) Stdlib.result Lwt.t
val map_p : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val mapi_e : (int -> 'a -> ('b, 'trace) Stdlib.result) -> 'a list -> ('b list, 'trace) Stdlib.result
val mapi_s : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val mapi_es : (int -> 'a -> ('b, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'trace) Stdlib.result Lwt.t
val mapi_p : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val rev_map : ('a -> 'b) -> 'a list -> 'b list
val rev_mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
val rev_map_e : ('a -> ('b, 'trace) Stdlib.result) -> 'a list -> ('b list, 'trace) Stdlib.result
val rev_map_s : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val rev_map_es : ('a -> ('b, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'trace) Stdlib.result Lwt.t
val rev_map_p : ('a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val rev_mapi_e : (int -> 'a -> ('b, 'trace) Stdlib.result) -> 'a list -> ('b list, 'trace) Stdlib.result
val rev_mapi_s : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val rev_mapi_es : (int -> 'a -> ('b, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'trace) Stdlib.result Lwt.t
val rev_mapi_p : (int -> 'a -> 'b Lwt.t) -> 'a list -> 'b list Lwt.t
val rev_filter_map : ('a -> 'b option) -> 'a list -> 'b list
val rev_filter_map_e : ('a -> ('b option, 'trace) Stdlib.result) -> 'a list -> ('b list, 'trace) Stdlib.result
val filter_map_e : ('a -> ('b option, 'trace) Stdlib.result) -> 'a list -> ('b list, 'trace) Stdlib.result
val rev_filter_map_s : ('a -> 'b option Lwt.t) -> 'a list -> 'b list Lwt.t
val filter_map : ('a -> 'b option) -> 'a list -> 'b list
val filter_map_s : ('a -> 'b option Lwt.t) -> 'a list -> 'b list Lwt.t
val rev_filter_map_es : ('a -> ('b option, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'trace) Stdlib.result Lwt.t
val filter_map_es : ('a -> ('b option, 'trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'trace) Stdlib.result Lwt.t
val filter_map_p : ('a -> 'b option Lwt.t) -> 'a list -> 'b list Lwt.t
val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a
val fold_left_e : ('a -> 'b -> ('a, 'trace) Stdlib.result) -> 'a -> 'b list -> ('a, 'trace) Stdlib.result
val fold_left_s : ('a -> 'b -> 'a Lwt.t) -> 'a -> 'b list -> 'a Lwt.t
val fold_left_es : ('a -> 'b -> ('a, 'trace) Stdlib.result Lwt.t) -> 'a -> 'b list -> ('a, 'trace) Stdlib.result Lwt.t
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
val fold_right_e : ('a -> 'b -> ('b, 'trace) Stdlib.result) -> 'a list -> 'b -> ('b, 'trace) Stdlib.result
val fold_right_s : ('a -> 'b -> 'b Lwt.t) -> 'a list -> 'b -> 'b Lwt.t
val fold_right_es : ('a -> 'b -> ('b, 'trace) Stdlib.result Lwt.t) -> 'a list -> 'b -> ('b, 'trace) Stdlib.result Lwt.t
val iter2_e : when_different_lengths:'trace -> ('a -> 'b -> (unit, 'trace) Stdlib.result) -> 'a list -> 'b list -> (unit, 'trace) Stdlib.result
val iter2_s : when_different_lengths:'trace -> ('a -> 'b -> unit Lwt.t) -> 'a list -> 'b list -> (unit, 'trace) Stdlib.result Lwt.t
val iter2_es : when_different_lengths:'trace -> ('a -> 'b -> (unit, 'trace) Stdlib.result Lwt.t) -> 'a list -> 'b list -> (unit, 'trace) Stdlib.result Lwt.t
val map2_e : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) Stdlib.result) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result
val map2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result Lwt.t
val map2_es : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) Stdlib.result Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result Lwt.t
val rev_map2_e : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) Stdlib.result) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result
val rev_map2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result Lwt.t
val rev_map2_es : when_different_lengths:'trace -> ('a -> 'b -> ('c, 'trace) Stdlib.result Lwt.t) -> 'a list -> 'b list -> ('c list, 'trace) Stdlib.result Lwt.t
val fold_left2_e : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('a, 'trace) Stdlib.result) -> 'a -> 'b list -> 'c list -> ('a, 'trace) Stdlib.result
val fold_left2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'a Lwt.t) -> 'a -> 'b list -> 'c list -> ('a, 'trace) Stdlib.result Lwt.t
val fold_left2_es : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('a, 'trace) Stdlib.result Lwt.t) -> 'a -> 'b list -> 'c list -> ('a, 'trace) Stdlib.result Lwt.t
val fold_right2_e : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('c, 'trace) Stdlib.result) -> 'a list -> 'b list -> 'c -> ('c, 'trace) Stdlib.result
val fold_right2_s : when_different_lengths:'trace -> ('a -> 'b -> 'c -> 'c Lwt.t) -> 'a list -> 'b list -> 'c -> ('c, 'trace) Stdlib.result Lwt.t
val fold_right2_es : when_different_lengths:'trace -> ('a -> 'b -> 'c -> ('c, 'trace) Stdlib.result Lwt.t) -> 'a list -> 'b list -> 'c -> ('c, 'trace) Stdlib.result Lwt.t
val for_all : ('a -> bool) -> 'a list -> bool
val for_all_e : ('a -> (bool, 'trace) Stdlib.result) -> 'a list -> (bool, 'trace) Stdlib.result
val for_all_s : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t
val for_all_es : ('a -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> (bool, 'trace) Stdlib.result Lwt.t
val for_all_p : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t
val exists : ('a -> bool) -> 'a list -> bool
val exists_e : ('a -> (bool, 'trace) Stdlib.result) -> 'a list -> (bool, 'trace) Stdlib.result
val exists_s : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t
val exists_es : ('a -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> (bool, 'trace) Stdlib.result Lwt.t
val exists_p : ('a -> bool Lwt.t) -> 'a list -> bool Lwt.t
val for_all2_e : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) Stdlib.result) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result
val for_all2_s : when_different_lengths:'trace -> ('a -> 'b -> bool Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result Lwt.t
val for_all2_es : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result Lwt.t
val exists2_e : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) Stdlib.result) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result
val exists2_s : when_different_lengths:'trace -> ('a -> 'b -> bool Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result Lwt.t
val exists2_es : when_different_lengths:'trace -> ('a -> 'b -> (bool, 'trace) Stdlib.result Lwt.t) -> 'a list -> 'b list -> (bool, 'trace) Stdlib.result Lwt.t
val combine_drop : 'a list -> 'b list -> ('a * 'b) list
val combine_with_leftovers : 'a list -> 'b list -> ('a * 'b) list * [ `Left of 'a list | `Right of 'b list ] option
val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int
val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
val sort : ('a -> 'a -> int) -> 'a list -> 'a list
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list
val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list
val to_seq : 'a t -> 'a Stdlib.Seq.t
val of_seq : 'a Stdlib.Seq.t -> 'a list
val init_ep : when_negative_length:'error -> int -> (int -> ('a, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> ('a list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val filter_ep : ('a -> (bool, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> ('a list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val partition_ep : ('a -> (bool, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> ('a list * 'a list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val iter_ep : ('a -> (unit, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> (unit, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val iteri_ep : (int -> 'a -> (unit, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> (unit, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val map_ep : ('a -> ('b, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val mapi_ep : (int -> 'a -> ('b, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val rev_map_ep : ('a -> ('b, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val rev_mapi_ep : (int -> 'a -> ('b, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val filter_map_ep : ('a -> ('b option, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> ('b list, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val for_all_ep : ('a -> (bool, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> (bool, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
val exists_ep : ('a -> (bool, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t) -> 'a list -> (bool, 'error Tezos_error_monad.TzTrace.trace) Stdlib.result Lwt.t
OCaml

Innovation. Community. Security.