module Ilist:Imbricated listssig
..end
type ('a, 'b)
el =
| |
Atome of |
(* | Terminal case | *) |
| |
List of |
(* | The element is recursively a list, with an attribute of type 'a . | *) |
type('a, 'b)
t ='a * ('a, 'b) el list
'a
is the type of attributes
associated to lists, and 'b
the type of elements.val cons : ('a, 'b) el -> ('a, 'b) t -> ('a, 'b) t
val atome : 'b -> ('a, 'b) el
val list : 'a -> ('a, 'b) el list -> ('a, 'b) el
val of_list : 'a -> 'b list -> ('a, 'b) t
val to_list : ('a, 'b) t -> 'b list
Ilist.flatten
).to_list [[a;b];c;[d;e]] = [a;b;c;d;e]
val hd : ('a, 'b) t -> ('a, 'b) el
val tl : ('a, 'b) t -> ('a, 'b) t
val length : ('a, 'b) t -> int
val depth : ('a, 'b) t -> int
depth [] = 0
depth [a;b;c] = 1
depth [[a];b] = 2
val append : combine:('a -> 'a -> 'a) ->
('a, 'b) t -> ('a, 'b) t -> ('a, 'b) t
val flatten : ?depth:int -> ('a, 'b) t -> ('a, 'b) t
flatten [] = []
flatten [a;[b;[c];d];e;[f]] = [a;b;c;d;e;f]
flatten ~depth:2 [a;[b;[c];d];e;[f]] = [a;[b;c;d];e;[f]]
flatten ~depth:3 [a;[b;[c];d];e;[f]] = [a;[b;[c];d];e;[f]]
val rev : ('a, 'b) t -> ('a, 'b) t
rev [a;[b;[c];d];e;[f]] = [[f];e;[d;[c];b];a]
val mem : 'b -> ('a, 'b) t -> bool
val exists : ('a -> 'b -> bool) -> ('a, 'b) t -> bool
val map : ('a -> 'c) ->
(bool -> 'a -> 'b -> 'd) -> ('a, 'b) t -> ('c, 'd) t
val iter : (bool -> 'a -> 'b -> unit) -> ('a, 'b) t -> unit
val fold_left : ('c -> bool -> 'a -> 'b -> 'c) -> 'c -> ('a, 'b) t -> 'c
val fold_right : (bool -> 'a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c
val print : ?first:(unit, Format.formatter, unit) Pervasives.format ->
?sep:(unit, Format.formatter, unit) Pervasives.format ->
?last:(unit, Format.formatter, unit) Pervasives.format ->
?firstexp:(unit, Format.formatter, unit) Pervasives.format ->
?lastexp:(unit, Format.formatter, unit) Pervasives.format ->
(Format.formatter -> 'a -> unit) ->
(Format.formatter -> 'b -> unit) ->
Format.formatter -> ('a, 'b) t -> unit