File: sList.mli

package info (click to toggle)
coq 8.20.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 44,116 kB
  • sloc: ml: 234,160; sh: 4,301; python: 3,270; ansic: 2,644; makefile: 882; lisp: 172; javascript: 63; xml: 24; sed: 2
file content (77 lines) | stat: -rw-r--r-- 2,141 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)

(** Sparse lists. *)

(** {5 Constructors} *)

type +'a t = private
| Nil
| Cons of 'a * 'a t
| Default of int * 'a t
(** ['a t] is an efficient representation of ['a option list]. *)

val empty : 'a t
(** The empty list. *)

val cons : 'a -> 'a t -> 'a t
(** Isomorphic to [Some x :: l]. *)

val default : 'a t -> 'a t
(** Isomorphic to [None :: l]. *)

val cons_opt : 'a option -> 'a t -> 'a t
(** {!cons} if [Some], {!default} otherwise *)

val defaultn : int -> 'a t -> 'a t
(** Iterated variant of [default]. *)

(** {5 Destructor} *)

val view : 'a t -> ('a option * 'a t) option

val is_empty : 'a t -> bool

val is_default : 'a t -> bool

(** {5 Usual list-like operators} *)

val length : 'a t -> int

val equal : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

val to_list : 'a t -> 'a option list

val of_full_list : 'a list -> 'a t

(** {5 Iterators ignoring optional values} *)

module Skip :
sig

val iter : ('a -> unit) -> 'a t -> unit
val map : ('a -> 'b) -> 'a t -> 'b t
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a
val for_all : ('a -> bool) -> 'a t -> bool
val exists : ('a -> bool) -> 'a t -> bool

end
(** These iterators ignore the default values in the list. *)

(** {5 Smart iterators} *)

module Smart :
sig
val map : ('a -> 'a) -> 'a t -> 'a t
val fold_left_map : ('a -> 'b -> 'a * 'b) -> 'a -> 'b t -> 'a * 'b t
end
(** These iterators also ignore the default values in the list. *)