Debian Codegraph @

clib/sList.mli

raw symbols SCIP
1 (************************************************************************)
2 (* * The Rocq Prover / The Rocq Development Team *)
3 (* v * Copyright INRIA, CNRS and contributors *)
4 (* <O___,, * (see version control and CREDITS file for authors & dates) *)
5 (* \VV/ **************************************************************)
6 (* // * This file is distributed under the terms of the *)
7 (* * GNU Lesser General Public License Version 2.1 *)
8 (* * (see LICENSE file for the text of the license) *)
9 (************************************************************************)
10
11 (** Sparse lists. *)
12
13 (** {5 Constructors} *)
14
15 type +'a t = private
16 | Nil
17 | Cons of 'a * 'a t
18 | Default of int * 'a t
19 (** ['a t] is an efficient representation of ['a option list]. *)
20
21 val empty : 'a t
22 (** The empty list. *)
23
24 val cons : 'a -> 'a t -> 'a t
25 (** Isomorphic to [Some x :: l]. *)
26
27 val default : 'a t -> 'a t
28 (** Isomorphic to [None :: l]. *)
29
30 val cons_opt : 'a option -> 'a t -> 'a t
31 (** {!cons} if [Some], {!default} otherwise *)
32
33 val defaultn : int -> 'a t -> 'a t
34 (** Iterated variant of [default]. *)
35
36 (** {5 Destructor} *)
37
38 val view : 'a t -> ('a option * 'a t) option
39
40 val is_empty : 'a t -> bool
41
42 val is_default : 'a t -> bool
43
44 (** {5 Usual list-like operators} *)
45
46 val length : 'a t -> int
47
48 val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool
49
50 val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
51
52 val to_list : 'a t -> 'a option list
53
54 val of_full_list : 'a list -> 'a t
55
56 (** {5 Iterators ignoring optional values} *)
57
58 module Skip :
59 sig
60
61 val iter : ('a -> unit) -> 'a t -> unit
62 val map : ('a -> 'b) -> 'a t -> 'b t
63 val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
64 val for_all : ('a -> bool) -> 'a t -> bool
65 val exists : ('a -> bool) -> 'a t -> bool
66
67 end
68 (** These iterators ignore the default values in the list. *)
69
70 (** {5 Smart iterators} *)
71
72 module Smart :
73 sig
74 val map : ('a -> 'a) -> 'a t -> 'a t
75 val fold_left_map : ('a -> 'b -> 'a * 'b) -> 'a -> 'b t -> 'a * 'b t
76 end
77 (** These iterators also ignore the default values in the list. *)