module Extra:Extra definitions.sig
..end
val head : ?n:int -> 'a list -> 'a list
List.hd
, but retrieve the list of first elements (by default n=1
as in List.hd
).
Thus, the result is a list.val tail : ?i:int -> 'a list -> 'a list
List.tl
, but the tail is extracted from the given index
(by default i=1
as in List.tl
)val substract : 'a list -> 'a list -> 'a list
val subset : 'a list -> 'a list -> bool
subset a b
check if a
is a subset of b
, i.e. if all elements of a belong to b.val eqset : 'a list -> 'a list -> bool
eqset a b
check if a and b represent the same set of values.val intersection : 'a list -> 'a list -> 'a list
val foreach : 'a list -> ('a -> unit) -> unit
List.iter
with arguments in the opposite order: before the list, then the action to perfom.val uniq : 'a list -> 'a list
val range : int -> int -> int list
range a b
returns the list [a; (a+1); .. ; (b-1); b]
containing all the values between the given limits (included) .val interval : int -> int -> int list
val indexes : 'a list -> int list
0
as usually.val asFunction : int list -> int -> int
val select : 'a list -> int list -> 'a list
# select ["aaa";"bbb";"ccc"] [1;2;0;1];;
: string list = ["bbb"; "ccc"; "aaa"; "bbb"]
val rmindex : 'a list -> int -> 'a list
val indexSuchThat : ('a -> bool) -> 'a list -> int option
val indexOf : 'a -> 'a list -> int option
val firstIndexOf : 'a -> 'a list -> int option
indexOf
.val lastIndexOf : 'a -> 'a list -> int option
val shuffle : 'a list -> 'a list
val permute : (int -> int) -> 'a list -> 'a list
f
that represents the permutation
(we suppose that this function will be a bijection w.r.t. the set of indexes of the given list).
In other words permute f l
is the list [(f 0) ; (f 1) ; (f 2) ; ... ]
.val shuffler : 'a list -> int -> int
val shuffleIndexes : 'a list -> int list
val big : ('a -> 'a -> 'a) -> 'a list -> 'a
List.fold_left
specialization:
Big
when
maximum generality is requested.val max : 'a list -> 'a
val min : 'a list -> 'a
val transpose : 'a list list -> 'a list list
# List.transpose [[1;2;3]; [4;5;6]; [7;8;9]];;
: int list list = [[1; 4; 7]; [2; 5; 8]; [3; 6; 9]]