package containers

  1. Overview
  2. Docs
val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t
val iteri : (int -> 'a -> unit) -> 'a t -> unit
val foldi : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b

fold on list, with index

val get : 'a t -> int -> 'a option
val get_exn : 'a t -> int -> 'a

get the i-th element, or

  • raises Not_found

    if the index is invalid

val set : 'a t -> int -> 'a -> 'a t

set i-th element (removes the old one), or does nothing if index too high

val insert : 'a t -> int -> 'a -> 'a t

insert at i-th position, between the two existing elements. If the index is too high, append at the end of the list

val remove : 'a t -> int -> 'a t

Remove element at given index. Does nothing if the index is too high.

OCaml

Innovation. Community. Security.