diff --git a/doc/index.html b/doc/index.html index 8dcda4e..dc93038 100644 --- a/doc/index.html +++ b/doc/index.html @@ -11,7 +11,7 @@

OCaml package documentation

    -
  1. iter 1.8
  2. +
  3. iter 1.9
diff --git a/doc/iter/Iter/IO/index.html b/doc/iter/Iter/IO/index.html index 0258298..b3ced81 100644 --- a/doc/iter/Iter/IO/index.html +++ b/doc/iter/Iter/IO/index.html @@ -1,27 +1,27 @@ -IO (iter.Iter.IO)

Module Iter.IO

Basic IO

Very basic interface to manipulate files as iterator of chunks/lines. The iterators take care of opening and closing files properly; every time one iterates over an iterator, the file is opened/closed again.

Example: copy a file "a" into file "b", removing blank lines:

Iterator.(IO.lines_of "a" |> filter (fun l-> l<> "") |> IO.write_lines "b");;

By chunks of 4096 bytes:

Iterator.IO.(chunks_of ~size:4096 "a" |> write_to "b");;

Read the lines of a file into a list:

Iterator.IO.lines "a" |> Iterator.to_list
val lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string t

lines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results

  • parameter mode

    default 0o644

  • parameter flags

    default: [Open_rdonly]

val chunks_of : - ?mode:int -> - ?flags:Stdlib.open_flag list -> - ?size:int -> +IO (iter.Iter.IO)

Module Iter.IO

Basic IO

Very basic interface to manipulate files as iterator of chunks/lines. The iterators take care of opening and closing files properly; every time one iterates over an iterator, the file is opened/closed again.

Example: copy a file "a" into file "b", removing blank lines:

Iterator.(IO.lines_of "a" |> filter (fun l-> l<> "") |> IO.write_lines "b");;

By chunks of 4096 bytes:

Iterator.IO.(chunks_of ~size:4096 "a" |> write_to "b");;

Read the lines of a file into a list:

Iterator.IO.lines "a" |> Iterator.to_list
  • since 0.5.1
val lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string t

lines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results

  • parameter mode

    default 0o644

  • parameter flags

    default: [Open_rdonly]

val chunks_of : + ?mode:int -> + ?flags:Stdlib.open_flag list -> + ?size:int -> string -> string t

Read chunks of the given size from the file. The last chunk might be smaller. Behaves like lines_of regarding errors and options. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results

val write_to : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> string t -> unit

write_to filename seq writes all strings from seq into the given file. It takes care of opening and closing the file.

  • parameter mode

    default 0o644

  • parameter flags

    used by open_out_gen. Default: [Open_creat;Open_wronly].

val write_bytes_to : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> Stdlib.Bytes.t t -> unit
  • since 0.5.4
val write_lines : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> string t -> unit

Same as write_to, but intercales '\n' between each string

val write_bytes_lines : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> Stdlib.Bytes.t t -> - unit
  • since 0.5.4
\ No newline at end of file + unit
  • since 0.5.4
diff --git a/doc/iter/Iter/Infix/index.html b/doc/iter/Iter/Infix/index.html index 2da4663..d48ea7f 100644 --- a/doc/iter/Iter/Infix/index.html +++ b/doc/iter/Iter/Infix/index.html @@ -1,2 +1,2 @@ -Infix (iter.Iter.Infix)

Module Iter.Infix

val (--) : int -> int -> int t

a -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.

val (--^) : int -> int -> int t

a --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind (infix version of flat_map

  • since 0.5
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Infix version of map

  • since 0.5
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative operator (product+application)

  • since 0.5
val (<+>) : 'a t -> 'a t -> 'a t

Concatenation of iterators

  • since 0.5
val let+ : 'a t -> ('a -> 'b) -> 'b t

Alias for map

  • since 1.7
val and+ : 'a t -> 'b t -> ('a * 'b) t

Alias for product

  • since 1.7
val let* : 'a t -> ('a -> 'b t) -> 'b t

Alias for flat_map

  • since 1.7
val and* : 'a t -> 'b t -> ('a * 'b) t

Alias for product

  • since 1.7
\ No newline at end of file +Infix (iter.Iter.Infix)

Module Iter.Infix

val (--) : int -> int -> int t

a -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.

val (--^) : int -> int -> int t

a --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind (infix version of flat_map

  • since 0.5
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Infix version of map

  • since 0.5
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative operator (product+application)

  • since 0.5
val (<+>) : 'a t -> 'a t -> 'a t

Concatenation of iterators

  • since 0.5
val let+ : 'a t -> ('a -> 'b) -> 'b t

Alias for map

  • since 1.7
val and+ : 'a t -> 'b t -> ('a * 'b) t

Alias for product

  • since 1.7
val let* : 'a t -> ('a -> 'b t) -> 'b t

Alias for flat_map

  • since 1.7
val and* : 'a t -> 'b t -> ('a * 'b) t

Alias for product

  • since 1.7
diff --git a/doc/iter/Iter/Map/Adapt/index.html b/doc/iter/Iter/Map/Adapt/index.html index dfc011d..45dc4c6 100644 --- a/doc/iter/Iter/Map/Adapt/index.html +++ b/doc/iter/Iter/Map/Adapt/index.html @@ -1,6 +1,6 @@ -Adapt (iter.Iter.Map.Adapt)

Module Map.Adapt

Adapt a pre-existing Map module to make it iterator-aware

Parameters

module M : Stdlib.Map.S

Signature

include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
type key = M.key
type 'a t = 'a M.t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : +Adapt (iter.Iter.Map.Adapt)

Module Map.Adapt

Adapt a pre-existing Map module to make it iterator-aware

Parameters

module M : Stdlib.Map.S

Signature

include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
type key = M.key
type 'a t = 'a M.t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> - 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
\ No newline at end of file + 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
diff --git a/doc/iter/Iter/Map/Make/index.html b/doc/iter/Iter/Map/Make/index.html index 21237ed..b4598bf 100644 --- a/doc/iter/Iter/Map/Make/index.html +++ b/doc/iter/Iter/Map/Make/index.html @@ -1,6 +1,6 @@ -Make (iter.Iter.Map.Make)

Module Map.Make

Create an enriched Map module, with iterator-aware functions

Parameters

module V : Stdlib.Map.OrderedType

Signature

include Stdlib.Map.S with type key = V.t
type key = V.t
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : +Make (iter.Iter.Map.Make)

Module Map.Make

Create an enriched Map module, with iterator-aware functions

Parameters

module V : Stdlib.Map.OrderedType

Signature

include Stdlib.Map.S with type key = V.t
type key = V.t
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> - 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
\ No newline at end of file + 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
diff --git a/doc/iter/Iter/Map/index.html b/doc/iter/Iter/Map/index.html index 16991f6..2ceef56 100644 --- a/doc/iter/Iter/Map/index.html +++ b/doc/iter/Iter/Map/index.html @@ -1,4 +1,4 @@ -Map (iter.Iter.Map)

Module Iter.Map

module type S = sig ... end
module Adapt +Map (iter.Iter.Map)

Module Iter.Map

module type S = sig ... end
module Adapt (M : Stdlib.Map.S) : - S with type key = M.key and type 'a t = 'a M.t

Adapt a pre-existing Map module to make it iterator-aware

module Make (V : Stdlib.Map.OrderedType) : S with type key = V.t

Create an enriched Map module, with iterator-aware functions

\ No newline at end of file + S with type key = M.key and type 'a t = 'a M.t

Adapt a pre-existing Map module to make it iterator-aware

module Make (V : Stdlib.Map.OrderedType) : S with type key = V.t

Create an enriched Map module, with iterator-aware functions

diff --git a/doc/iter/Iter/Map/module-type-S/index.html b/doc/iter/Iter/Map/module-type-S/index.html index fab9611..02658d2 100644 --- a/doc/iter/Iter/Map/module-type-S/index.html +++ b/doc/iter/Iter/Map/module-type-S/index.html @@ -1,6 +1,6 @@ -S (iter.Iter.Map.S)

Module type Map.S

include Stdlib.Map.S
type key
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : +S (iter.Iter.Map.S)

Module type Map.S

include Stdlib.Map.S
type key
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> - 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
\ No newline at end of file + 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
diff --git a/doc/iter/Iter/Set/Adapt/index.html b/doc/iter/Iter/Set/Adapt/index.html index dbfb56f..d2ec872 100644 --- a/doc/iter/Iter/Set/Adapt/index.html +++ b/doc/iter/Iter/Set/Adapt/index.html @@ -1,2 +1,2 @@ -Adapt (iter.Iter.Set.Adapt)

Module Set.Adapt

Create an enriched Set module from the given one

Parameters

module X : Stdlib.Set.S

Signature

include Stdlib.Set.S with type elt = X.elt with type t = X.t
type elt = X.elt
type t = X.t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
\ No newline at end of file +Adapt (iter.Iter.Set.Adapt)

Module Set.Adapt

Create an enriched Set module from the given one

Parameters

module X : Stdlib.Set.S

Signature

include Stdlib.Set.S with type elt = X.elt with type t = X.t
type elt = X.elt
type t = X.t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
diff --git a/doc/iter/Iter/Set/Make/index.html b/doc/iter/Iter/Set/Make/index.html index 3a7c44a..b53a2b9 100644 --- a/doc/iter/Iter/Set/Make/index.html +++ b/doc/iter/Iter/Set/Make/index.html @@ -1,2 +1,2 @@ -Make (iter.Iter.Set.Make)

Module Set.Make

Functor to build an extended Set module from an ordered type

Parameters

module X : Stdlib.Set.OrderedType

Signature

include Stdlib.Set.S with type elt = X.t
type elt = X.t
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
\ No newline at end of file +Make (iter.Iter.Set.Make)

Module Set.Make

Functor to build an extended Set module from an ordered type

Parameters

module X : Stdlib.Set.OrderedType

Signature

include Stdlib.Set.S with type elt = X.t
type elt = X.t
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
diff --git a/doc/iter/Iter/Set/index.html b/doc/iter/Iter/Set/index.html index 5e6b5ce..76f0591 100644 --- a/doc/iter/Iter/Set/index.html +++ b/doc/iter/Iter/Set/index.html @@ -1,2 +1,2 @@ -Set (iter.Iter.Set)

Module Iter.Set

module type S = sig ... end
module Adapt (X : Stdlib.Set.S) : S with type elt = X.elt and type t = X.t

Create an enriched Set module from the given one

module Make (X : Stdlib.Set.OrderedType) : S with type elt = X.t

Functor to build an extended Set module from an ordered type

\ No newline at end of file +Set (iter.Iter.Set)

Module Iter.Set

module type S = sig ... end
module Adapt (X : Stdlib.Set.S) : S with type elt = X.elt and type t = X.t

Create an enriched Set module from the given one

module Make (X : Stdlib.Set.OrderedType) : S with type elt = X.t

Functor to build an extended Set module from an ordered type

diff --git a/doc/iter/Iter/Set/module-type-S/index.html b/doc/iter/Iter/Set/module-type-S/index.html index 8f0d151..3ffa77e 100644 --- a/doc/iter/Iter/Set/module-type-S/index.html +++ b/doc/iter/Iter/Set/module-type-S/index.html @@ -1,2 +1,2 @@ -S (iter.Iter.Set.S)

Module type Set.S

include Stdlib.Set.S
type elt
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
\ No newline at end of file +S (iter.Iter.Set.S)

Module type Set.S

include Stdlib.Set.S
type elt
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
diff --git a/doc/iter/Iter/index.html b/doc/iter/Iter/index.html index 8ec4a42..f4ac43a 100644 --- a/doc/iter/Iter/index.html +++ b/doc/iter/Iter/index.html @@ -1,30 +1,30 @@ -Iter (iter.Iter)

Module Iter

Simple and Efficient Iterators.

The iterators are designed to allow easy transfer (mappings) between data structures, without defining n^2 conversions between the n types. The implementation relies on the assumption that an iterator can be iterated on as many times as needed; this choice allows for high performance of many combinators. However, for transient iterators, the persistent function is provided, storing elements of a transient iterator in memory; the iterator can then be used several times (See further).

Note that some combinators also return iterators (e.g. group). The transformation is computed on the fly every time one iterates over the resulting iterator. If a transformation performs heavy computation, persistent can also be used as intermediate storage.

Most functions are lazy, i.e. they do not actually use their arguments until their result is iterated on. For instance, if one calls map on an iterator, one gets a new iterator, but nothing else happens until this new iterator is used (by folding or iterating on it).

If an iterator is built from an iteration function that is repeatable (i.e. calling it several times always iterates on the same set of elements, for instance List.iter or Map.iter), then the resulting t object is also repeatable. For one-time iter functions such as iteration on a file descriptor or a Seq, the persistent function can be used to iterate and store elements in a memory structure; the result is an iterator that iterates on the elements of this memory structure, cheaply and repeatably.

type +'a t = ('a -> unit) -> unit

An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.

type +'a iter = 'a t
type 'a equal = 'a -> 'a -> bool
type 'a hash = 'a -> int

Creation

val from_iter : (('a -> unit) -> unit) -> 'a t

Build an iterator from a iter function

val from_labelled_iter : (f:('a -> unit) -> unit) -> 'a t

Build an iterator from a labelled iter function

  • since 1.2
val from_fun : (unit -> 'a option) -> 'a t

Call the function repeatedly until it returns None. This iterator is transient, use persistent if needed!

val empty : 'a t

Empty iterator. It contains no element.

val singleton : 'a -> 'a t

Singleton iterator, with exactly one element.

val doubleton : 'a -> 'a -> 'a t

Iterator with exactly two elements

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

init f is the infinite iterator f 0; f 1; f 2; ….

  • since 0.9
val cons : 'a -> 'a t -> 'a t

cons x l yields x, then yields from l. Same as append (singleton x) l.

Caution: it is advised not to build long iterators out of cons, because it's inefficient. Each additional cons x i adds one layer of function call per item traversed in i.

val snoc : 'a t -> 'a -> 'a t

Same as cons but yields the element after iterating on l.

val return : 'a -> 'a t

Synonym to singleton

val pure : 'a -> 'a t

Synonym to singleton

val repeat : 'a -> 'a t

Infinite iterator of the same element. You may want to look at take and the likes if you iterate on it.

val iterate : ('a -> 'a) -> 'a -> 'a t

iterate f x is the infinite iterator x, f(x), f(f(x)), ...

val forever : (unit -> 'b) -> 'b t

Iterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.

val cycle : 'a t -> 'a t

Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.

val unfoldr : ('b -> ('a * 'b) option) -> 'b -> 'a t

unfoldr f b will apply f to b. If it yields Some (x,b') then x is returned and unfoldr recurses with b'.

val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t

Iterator of intermediate results

Consumption

val iter : ('a -> unit) -> 'a t -> unit

Consume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.

val iteri : (int -> 'a -> unit) -> 'a t -> unit

Iterate on elements and their index in the iterator

val for_each : 'a t -> ('a -> unit) -> unit

Consume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.

  • since 1.4
val for_eachi : 'a t -> (int -> 'a -> unit) -> unit

Iterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.

  • since 1.4
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a

Fold over elements of the iterator, consuming it

val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a

Fold over elements of the iterator and their index, consuming it

val fold_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a t -> 'b t

fold_map f acc l is like map, but it carries some state as in fold. The state is not returned, it is just used to thread some information to the map function.

  • since 0.9
val fold_filter_map : ('acc -> 'a -> 'acc * 'b option) -> 'acc -> 'a t -> 'b t

fold_filter_map f acc l is a fold_map-like function, but the function can choose to skip an element by retuning None.

  • since 0.9
val map : ('a -> 'b) -> 'a t -> 'b t

Map objects of the iterator into other elements, lazily

val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t

Map objects, along with their index in the iterator

val map_by_2 : ('a -> 'a -> 'a) -> 'a t -> 'a t

Map objects two by two. lazily. The last element is kept in the iterator if the count is odd.

  • since 0.7
val for_all : ('a -> bool) -> 'a t -> bool

Do all elements satisfy the predicate?

val exists : ('a -> bool) -> 'a t -> bool

Exists there some element satisfying the predicate?

val mem : ?eq:('a -> 'a -> bool) -> 'a -> 'a t -> bool

Is the value a member of the iterator?

  • parameter eq

    the equality predicate to use (default (=))

  • since 0.5
val find : ('a -> 'b option) -> 'a t -> 'b option

Find the first element on which the function doesn't return None

  • since 0.5
val find_map : ('a -> 'b option) -> 'a t -> 'b option

Alias to find

  • since 0.10
val findi : (int -> 'a -> 'b option) -> 'a t -> 'b option

Indexed version of find

  • since 0.9
val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

Alias to findi

  • since 0.10
val find_pred : ('a -> bool) -> 'a t -> 'a option

find_pred p l finds the first element of l that satisfies p, or returns None if no element satisfies p

  • since 0.9
val find_pred_exn : ('a -> bool) -> 'a t -> 'a

Unsafe version of find_pred

  • raises Not_found

    if no such element is found

  • since 0.9
val length : 'a t -> int

How long is the iterator? Forces the iterator.

val is_empty : 'a t -> bool

Is the iterator empty? Forces the iterator.

Transformation

val filter : ('a -> bool) -> 'a t -> 'a t

Filter on elements of the iterator

val append : 'a t -> 'a t -> 'a t

Append two iterators. Iterating on the result is like iterating on the first, then on the second.

val append_l : 'a t list -> 'a t

Append iterators. Iterating on the result is like iterating on the each iterator of the list in order.

  • since 0.11
val concat : 'a t t -> 'a t

Concatenate an iterator of iterators into one iterator.

val flatten : 'a t t -> 'a t

Alias for concat

val flat_map : ('a -> 'b t) -> 'a t -> 'b t

Monadic bind. Intuitively, it applies the function to every element of the initial iterator, and calls concat. Formerly flatMap

  • since 0.5
val flat_map_l : ('a -> 'b list) -> 'a t -> 'b t

Convenience function combining flat_map and of_list

  • since 0.9
val seq_list : 'a t list -> 'a list t

seq_list l returns all the ways to pick one element in each sub-iterator in l. Assumes the sub-iterators can be iterated on several times.

  • since 0.11
val seq_list_map : ('a -> 'b t) -> 'a list -> 'b list t

seq_list_map f l maps f over every element of l, then calls seq_list

  • since 0.11
val filter_map : ('a -> 'b option) -> 'a t -> 'b t

Map and only keep non-None elements Formerly fmap

  • since 0.5
val filter_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b t

Map with indices, and only keep non-None elements

  • since 0.11
val filter_count : ('a -> bool) -> 'a t -> int

Count how many elements satisfy the given predicate

  • since 1.0
val intersperse : 'a -> 'a t -> 'a t

Insert the single element between every element of the iterator

val keep_some : 'a option t -> 'a t

filter_some l retains only elements of the form Some x. Same as filter_map (fun x->x)

  • since 1.0
val keep_ok : ('a, _) Stdlib.result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.0
val keep_error : (_, 'e) Stdlib.result t -> 'e t

keep_error l retains only elements of the form Error x.

  • since 1.0

Caching

val persistent : 'a t -> 'a t

Iterate on the iterator, storing elements in an efficient internal structure.. The resulting iterator can be iterated on as many times as needed. Note: calling persistent on an already persistent iterator will still make a new copy of the iterator!

val persistent_lazy : 'a t -> 'a t

Lazy version of persistent. When calling persistent_lazy s, a new iterator s' is immediately returned (without actually consuming s) in constant time; the first time s' is iterated on, it also consumes s and caches its content into a inner data structure that will back s' for future iterations.

warning: on the first traversal of s', if the traversal is interrupted prematurely (take, etc.) then s' will not be memorized, and the next call to s' will traverse s again.

Misc

val sort : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator. Eager, O(n) ram and O(n ln(n)) time. It iterates on elements of the argument iterator immediately, before it sorts them.

val sort_uniq : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator and remove duplicates. Eager, same as sort

val sorted : ?cmp:('a -> 'a -> int) -> 'a t -> bool

Checks whether the iterator is sorted. Eager, same as sort.

  • since 0.9
val group_succ_by : ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal consecutive elements. Linear time. Formerly synonym to group. note: Order of items in each list is unspecified.

  • since 0.6
val group_by : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal elements, disregarding their order of appearance. precondition: for any x and y, if eq x y then hash x=hash y must hold. note: Order of items in each list is unspecified.

  • since 0.6
val count : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> ('a * int) t

Map each distinct element to its number of occurrences in the whole seq. Similar to group_by seq |> map (fun l->List.hd l, List.length l) precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val uniq : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t

Remove consecutive duplicate elements. Basically this is like fun seq -> map List.hd (group seq).

val product : 'a t -> 'b t -> ('a * 'b) t

Cartesian product of iterators. When calling product a b, the caller MUST ensure that b can be traversed as many times as required (several times), possibly by calling persistent on it beforehand.

val diagonal_l : 'a list -> ('a * 'a) t

All pairs of distinct positions of the list. diagonal l will return the iterator of all List.nth i l, List.nth j l if i < j.

  • since 0.9
val diagonal : 'a t -> ('a * 'a) t

All pairs of distinct positions of the iterator. Iterates only once on the iterator, which must be finite.

  • since 0.9
val join : join_row:('a -> 'b -> 'c option) -> 'a t -> 'b t -> 'c t

join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.

val join_by : - ?eq:'key equal -> - ?hash:'key hash -> +Iter (iter.Iter)

Module Iter

Simple and Efficient Iterators.

The iterators are designed to allow easy transfer (mappings) between data structures, without defining n^2 conversions between the n types. The implementation relies on the assumption that an iterator can be iterated on as many times as needed; this choice allows for high performance of many combinators. However, for transient iterators, the persistent function is provided, storing elements of a transient iterator in memory; the iterator can then be used several times (See further).

Note that some combinators also return iterators (e.g. group). The transformation is computed on the fly every time one iterates over the resulting iterator. If a transformation performs heavy computation, persistent can also be used as intermediate storage.

Most functions are lazy, i.e. they do not actually use their arguments until their result is iterated on. For instance, if one calls map on an iterator, one gets a new iterator, but nothing else happens until this new iterator is used (by folding or iterating on it).

If an iterator is built from an iteration function that is repeatable (i.e. calling it several times always iterates on the same set of elements, for instance List.iter or Map.iter), then the resulting t object is also repeatable. For one-time iter functions such as iteration on a file descriptor or a Seq, the persistent function can be used to iterate and store elements in a memory structure; the result is an iterator that iterates on the elements of this memory structure, cheaply and repeatably.

type +'a t = ('a -> unit) -> unit

An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.

type +'a iter = 'a t
type 'a equal = 'a -> 'a -> bool
type 'a hash = 'a -> int

Creation

val from_iter : (('a -> unit) -> unit) -> 'a t

Build an iterator from a iter function

val from_labelled_iter : (f:('a -> unit) -> unit) -> 'a t

Build an iterator from a labelled iter function

  • since 1.2
val from_fun : (unit -> 'a option) -> 'a t

Call the function repeatedly until it returns None. This iterator is transient, use persistent if needed!

val empty : 'a t

Empty iterator. It contains no element.

val singleton : 'a -> 'a t

Singleton iterator, with exactly one element.

val doubleton : 'a -> 'a -> 'a t

Iterator with exactly two elements

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

init f is the infinite iterator f 0; f 1; f 2; ….

  • since 0.9
val cons : 'a -> 'a t -> 'a t

cons x l yields x, then yields from l. Same as append (singleton x) l.

Caution: it is advised not to build long iterators out of cons, because it's inefficient. Each additional cons x i adds one layer of function call per item traversed in i.

val snoc : 'a t -> 'a -> 'a t

Same as cons but yields the element after iterating on l.

val return : 'a -> 'a t

Synonym to singleton

val pure : 'a -> 'a t

Synonym to singleton

val repeat : 'a -> 'a t

Infinite iterator of the same element. You may want to look at take and the likes if you iterate on it.

val iterate : ('a -> 'a) -> 'a -> 'a t

iterate f x is the infinite iterator x, f(x), f(f(x)), ...

val forever : (unit -> 'b) -> 'b t

Iterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.

val cycle : 'a t -> 'a t

Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.

val unfoldr : ('b -> ('a * 'b) option) -> 'b -> 'a t

unfoldr f b will apply f to b. If it yields Some (x,b') then x is returned and unfoldr recurses with b'.

val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t

Iterator of intermediate results

Consumption

val iter : ('a -> unit) -> 'a t -> unit

Consume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.

val iteri : (int -> 'a -> unit) -> 'a t -> unit

Iterate on elements and their index in the iterator

val for_each : 'a t -> ('a -> unit) -> unit

Consume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.

  • since 1.4
val for_eachi : 'a t -> (int -> 'a -> unit) -> unit

Iterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.

  • since 1.4
val fold : ('a -> 'b -> 'a) -> 'a -> 'b t -> 'a

Fold over elements of the iterator, consuming it

val foldi : ('a -> int -> 'b -> 'a) -> 'a -> 'b t -> 'a

Fold over elements of the iterator and their index, consuming it

val fold_map : ('acc -> 'a -> 'acc * 'b) -> 'acc -> 'a t -> 'b t

fold_map f acc l is like map, but it carries some state as in fold. The state is not returned, it is just used to thread some information to the map function.

  • since 0.9
val fold_filter_map : ('acc -> 'a -> 'acc * 'b option) -> 'acc -> 'a t -> 'b t

fold_filter_map f acc l is a fold_map-like function, but the function can choose to skip an element by retuning None.

  • since 0.9
val map : ('a -> 'b) -> 'a t -> 'b t

Map objects of the iterator into other elements, lazily

val mapi : (int -> 'a -> 'b) -> 'a t -> 'b t

Map objects, along with their index in the iterator

val map_by_2 : ('a -> 'a -> 'a) -> 'a t -> 'a t

Map objects two by two. lazily. The last element is kept in the iterator if the count is odd.

  • since 0.7
val for_all : ('a -> bool) -> 'a t -> bool

Do all elements satisfy the predicate?

val exists : ('a -> bool) -> 'a t -> bool

Exists there some element satisfying the predicate?

val mem : ?eq:('a -> 'a -> bool) -> 'a -> 'a t -> bool

Is the value a member of the iterator?

  • parameter eq

    the equality predicate to use (default (=))

  • since 0.5
val find : ('a -> 'b option) -> 'a t -> 'b option

Find the first element on which the function doesn't return None

  • since 0.5
val find_map : ('a -> 'b option) -> 'a t -> 'b option

Alias to find

  • since 0.10
val findi : (int -> 'a -> 'b option) -> 'a t -> 'b option

Indexed version of find

  • since 0.9
val find_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b option

Alias to findi

  • since 0.10
val find_pred : ('a -> bool) -> 'a t -> 'a option

find_pred p l finds the first element of l that satisfies p, or returns None if no element satisfies p

  • since 0.9
val find_pred_exn : ('a -> bool) -> 'a t -> 'a

Unsafe version of find_pred

  • raises Not_found

    if no such element is found

  • since 0.9
val length : 'a t -> int

How long is the iterator? Forces the iterator.

val is_empty : 'a t -> bool

Is the iterator empty? Forces the iterator.

Transformation

val filter : ('a -> bool) -> 'a t -> 'a t

Filter on elements of the iterator

val append : 'a t -> 'a t -> 'a t

Append two iterators. Iterating on the result is like iterating on the first, then on the second.

val append_l : 'a t list -> 'a t

Append iterators. Iterating on the result is like iterating on the each iterator of the list in order.

  • since 0.11
val concat : 'a t t -> 'a t

Concatenate an iterator of iterators into one iterator.

val flatten : 'a t t -> 'a t

Alias for concat

val flat_map : ('a -> 'b t) -> 'a t -> 'b t

Monadic bind. Intuitively, it applies the function to every element of the initial iterator, and calls concat. Formerly flatMap

  • since 0.5
val flat_map_l : ('a -> 'b list) -> 'a t -> 'b t

Convenience function combining flat_map and of_list

  • since 0.9
val seq_list : 'a t list -> 'a list t

seq_list l returns all the ways to pick one element in each sub-iterator in l. Assumes the sub-iterators can be iterated on several times.

  • since 0.11
val seq_list_map : ('a -> 'b t) -> 'a list -> 'b list t

seq_list_map f l maps f over every element of l, then calls seq_list

  • since 0.11
val filter_map : ('a -> 'b option) -> 'a t -> 'b t

Map and only keep non-None elements Formerly fmap

  • since 0.5
val filter_mapi : (int -> 'a -> 'b option) -> 'a t -> 'b t

Map with indices, and only keep non-None elements

  • since 0.11
val filter_count : ('a -> bool) -> 'a t -> int

Count how many elements satisfy the given predicate

  • since 1.0
val intersperse : 'a -> 'a t -> 'a t

Insert the single element between every element of the iterator

val keep_some : 'a option t -> 'a t

filter_some l retains only elements of the form Some x. Same as filter_map (fun x->x)

  • since 1.0
val keep_ok : ('a, _) Stdlib.result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.0
val keep_error : (_, 'e) Stdlib.result t -> 'e t

keep_error l retains only elements of the form Error x.

  • since 1.0

Caching

val persistent : 'a t -> 'a t

Iterate on the iterator, storing elements in an efficient internal structure.. The resulting iterator can be iterated on as many times as needed. Note: calling persistent on an already persistent iterator will still make a new copy of the iterator!

val persistent_lazy : 'a t -> 'a t

Lazy version of persistent. When calling persistent_lazy s, a new iterator s' is immediately returned (without actually consuming s) in constant time; the first time s' is iterated on, it also consumes s and caches its content into a inner data structure that will back s' for future iterations.

warning: on the first traversal of s', if the traversal is interrupted prematurely (take, etc.) then s' will not be memorized, and the next call to s' will traverse s again.

Misc

val sort : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator. Eager, O(n) ram and O(n ln(n)) time. It iterates on elements of the argument iterator immediately, before it sorts them.

val sort_uniq : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator and remove duplicates. Eager, same as sort

val sorted : ?cmp:('a -> 'a -> int) -> 'a t -> bool

Checks whether the iterator is sorted. Eager, same as sort.

  • since 0.9
val group_succ_by : ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal consecutive elements. Linear time. Formerly synonym to group. note: Order of items in each list is unspecified.

  • since 0.6
val group_by : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal elements, disregarding their order of appearance. precondition: for any x and y, if eq x y then hash x=hash y must hold. note: Order of items in each list is unspecified.

  • since 0.6
val count : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> ('a * int) t

Map each distinct element to its number of occurrences in the whole seq. Similar to group_by seq |> map (fun l->List.hd l, List.length l) precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val uniq : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t

Remove consecutive duplicate elements. Basically this is like fun seq -> map List.hd (group seq).

val product : 'a t -> 'b t -> ('a * 'b) t

Cartesian product of iterators. When calling product a b, the caller MUST ensure that b can be traversed as many times as required (several times), possibly by calling persistent on it beforehand.

val diagonal_l : 'a list -> ('a * 'a) t

All pairs of distinct positions of the list. diagonal l will return the iterator of all List.nth i l, List.nth j l if i < j.

  • since 0.9
val diagonal : 'a t -> ('a * 'a) t

All pairs of distinct positions of the iterator. Iterates only once on the iterator, which must be finite.

  • since 0.9
val join : join_row:('a -> 'b -> 'c option) -> 'a t -> 'b t -> 'c t

join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.

val join_by : + ?eq:'key equal -> + ?hash:'key hash -> ('a -> 'key) -> ('b -> 'key) -> - merge:('key -> 'a -> 'b -> 'c option) -> + merge:('key -> 'a -> 'b -> 'c option) -> 'a t -> 'b t -> 'c t

join key1 key2 ~merge is a binary operation that takes two iterators a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val join_all_by : - ?eq:'key equal -> - ?hash:'key hash -> + ?eq:'key equal -> + ?hash:'key hash -> ('a -> 'key) -> ('b -> 'key) -> - merge:('key -> 'a list -> 'b list -> 'c option) -> + merge:('key -> 'a list -> 'b list -> 'c option) -> 'a t -> 'b t -> 'c t

join_all_by key1 key2 ~merge is a binary operation that takes two iterators a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:

  • compute the list l1 of elements of a that map to k
  • compute the list l2 of elements of b that map to k
  • call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
  • since 0.10
val group_join_by : - ?eq:'a equal -> - ?hash:'a hash -> + ?eq:'a equal -> + ?hash:'a hash -> ('b -> 'a) -> 'a t -> 'b t -> - ('a * 'b list) t

group_join_by key2 associates to every element x of the first iterator, all the elements y of the second iterator such that eq x (key y). Elements of the first iterators without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10

Set-like

val inter : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Intersection of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val union : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Union of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val diff : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Set difference. Eager.

  • since 0.10
val subset : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> bool

subset a b returns true if all elements of a belong to b. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10

Arithmetic

val max : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Max element of the iterator, using the given comparison function.

  • returns

    None if the iterator is empty, Some m where m is the maximal element otherwise

val max_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of max

  • raises Not_found

    if the iterator is empty

  • since 0.10
val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Min element of the iterator, using the given comparison function. see max for more details.

val min_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of min

  • raises Not_found

    if the iterator is empty

  • since 0.10
val sum : int t -> int

Sum of elements

  • since 0.11
val sumf : float t -> float

Sum of elements, using Kahan summation

  • since 0.11

List-like

val head : 'a t -> 'a option

First element, if any, otherwise None

  • since 0.5.1
val head_exn : 'a t -> 'a

First element, if any, fails

  • raises Invalid_argument

    if the iterator is empty

  • since 0.5.1
val take : int -> 'a t -> 'a t

Take at most n elements from the iterator. Works on infinite iterators.

val take_while : ('a -> bool) -> 'a t -> 'a t

Take elements while they satisfy the predicate, then stops iterating. Will work on an infinite iterator s if the predicate is false for at least one element of s.

val map_while : + ('a * 'b list) t

group_join_by key2 associates to every element x of the first iterator, all the elements y of the second iterator such that eq x (key y). Elements of the first iterators without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10

Set-like

val inter : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Intersection of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val union : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Union of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val diff : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Set difference. Eager.

  • since 0.10
val subset : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> bool

subset a b returns true if all elements of a belong to b. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10

Arithmetic

val max : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Max element of the iterator, using the given comparison function.

  • returns

    None if the iterator is empty, Some m where m is the maximal element otherwise

val max_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of max

  • raises Not_found

    if the iterator is empty

  • since 0.10
val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Min element of the iterator, using the given comparison function. see max for more details.

val min_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of min

  • raises Not_found

    if the iterator is empty

  • since 0.10
val sum : int t -> int

Sum of elements

  • since 0.11
val sumf : float t -> float

Sum of elements, using Kahan summation

  • since 0.11

List-like

val head : 'a t -> 'a option

First element, if any, otherwise None

  • since 0.5.1
val head_exn : 'a t -> 'a

First element, if any, fails

  • raises Invalid_argument

    if the iterator is empty

  • since 0.5.1
val take : int -> 'a t -> 'a t

Take at most n elements from the iterator. Works on infinite iterators.

val take_while : ('a -> bool) -> 'a t -> 'a t

Take elements while they satisfy the predicate, then stops iterating. Will work on an infinite iterator s if the predicate is false for at least one element of s.

val map_while : ('a -> [ `Yield of 'b | `Return of 'b | `Stop ]) -> 'a t -> - 'b t

Maps over elements of the iterator, stopping early if the mapped function returns `Stop or `Return x. At each iteration:

  • If f returns `Yield y, y is added to the sequence and the iteration continues.
  • If f returns `Stop, nothing is added to the sequence and the iteration stops.
  • If f returns `Return y, y is added to the sequence and the iteration stops.
  • since 1.8
val fold_while : ('a -> 'b -> 'a * [ `Stop | `Continue ]) -> 'a -> 'b t -> 'a

Folds over elements of the iterator, stopping early if the accumulator returns ('a, `Stop)

  • since 0.5.5
val drop : int -> 'a t -> 'a t

Drop the n first elements of the iterator. Lazy.

val drop_while : ('a -> bool) -> 'a t -> 'a t

Predicate version of drop

val rev : 'a t -> 'a t

Reverse the iterator. O(n) memory and time, needs the iterator to be finite. The result is persistent and does not depend on the input being repeatable.

val zip_i : 'a t -> (int * 'a) t

Zip elements of the iterator with their index in the iterator.

  • since 1.0 Changed type to just give an iterator of pairs

Pair iterators

val fold2 : ('c -> 'a -> 'b -> 'c) -> 'c -> ('a * 'b) t -> 'c
val iter2 : ('a -> 'b -> unit) -> ('a * 'b) t -> unit
val map2 : ('a -> 'b -> 'c) -> ('a * 'b) t -> 'c t
val map2_2 : ('a -> 'b -> 'c) -> ('a -> 'b -> 'd) -> ('a * 'b) t -> ('c * 'd) t

map2_2 f g seq2 maps each x, y of seq2 into f x y, g x y

Data structures converters

val to_list : 'a t -> 'a list

Convert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.

val to_rev_list : 'a t -> 'a list

Get the list of the reversed iterator (more efficient than to_list)

val of_list : 'a list -> 'a t
val on_list : ('a t -> 'b t) -> 'a list -> 'b list

on_list f l is equivalent to to_list @@ f @@ of_list l.

  • since 0.5.2
val pair_with_idx : 'a t -> (int * 'a) t

Similar to zip_i but returns a normal iterator of tuples

  • since 0.11
val to_opt : 'a t -> 'a option

Alias to head

  • since 0.5.1
val to_array : 'a t -> 'a array

Convert to an array. Currently not very efficient because an intermediate list is used.

val of_array : 'a array -> 'a t
val of_array_i : 'a array -> (int * 'a) t

Elements of the array, with their index

val array_slice : 'a array -> int -> int -> 'a t

array_slice a i j Iterator of elements whose indexes range from i to j

val of_opt : 'a option -> 'a t

Iterate on 0 or 1 values.

  • since 0.5.1
val of_seq : 'a Stdlib.Seq.t -> 'a t

Iterator of elements of a Seq.t.

  • since 1.5
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.t

Convert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.

  • since 1.5
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unit

Push elements of the iterator on the stack

val of_stack : 'a Stdlib.Stack.t -> 'a t

Iterator of elements of the stack (same order as Stack.iter)

val to_queue : 'a Stdlib.Queue.t -> 'a t -> unit

Push elements of the iterator into the queue

val of_queue : 'a Stdlib.Queue.t -> 'a t

Iterator of elements contained in the queue, FIFO order

val hashtbl_add : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.add

val hashtbl_replace : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)

val to_hashtbl : ('a * 'b) t -> ('a, 'b) Stdlib.Hashtbl.t

Build a hashtable from an iterator of key/value pairs

val of_hashtbl : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t

Iterator of key/value pairs from the hashtable

val hashtbl_keys : ('a, 'b) Stdlib.Hashtbl.t -> 'a t
val hashtbl_values : ('a, 'b) Stdlib.Hashtbl.t -> 'b t
val of_str : string -> char t
val to_str : char t -> string
val concat_str : string t -> string

Concatenate strings together, eagerly. Also see intersperse to add a separator.

  • since 0.5
exception OneShotSequence

Raised when the user tries to iterate several times on a transient iterator

val of_in_channel : Stdlib.in_channel -> char t

Iterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.

  • raises OneShotIterator

    when used more than once.

val to_buffer : char t -> Stdlib.Buffer.t -> unit

Copy content of the iterator into the buffer

val int_range : start:int -> stop:int -> int t

Iterator on integers in start...stop by steps 1. Also see (--) for an infix version.

val int_range_dec : start:int -> stop:int -> int t

Iterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version

val int_range_by : step:int -> int -> int -> int t

int_range_by ~step i j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.

  • raises Invalid_argument

    if step=0

val bools : bool t

Iterates on true and false

  • since 0.7
val of_set : + 'b t

Maps over elements of the iterator, stopping early if the mapped function returns `Stop or `Return x. At each iteration:

  • If f returns `Yield y, y is added to the sequence and the iteration continues.
  • If f returns `Stop, nothing is added to the sequence and the iteration stops.
  • If f returns `Return y, y is added to the sequence and the iteration stops.
  • since 1.8
val fold_while : ('a -> 'b -> 'a * [ `Stop | `Continue ]) -> 'a -> 'b t -> 'a

Folds over elements of the iterator, stopping early if the accumulator returns ('a, `Stop)

  • since 0.5.5
val drop : int -> 'a t -> 'a t

Drop the n first elements of the iterator. Lazy.

val drop_while : ('a -> bool) -> 'a t -> 'a t

Predicate version of drop

val rev : 'a t -> 'a t

Reverse the iterator. O(n) memory and time, needs the iterator to be finite. The result is persistent and does not depend on the input being repeatable.

val zip_i : 'a t -> (int * 'a) t

Zip elements of the iterator with their index in the iterator.

  • since 1.0 Changed type to just give an iterator of pairs

Pair iterators

val fold2 : ('c -> 'a -> 'b -> 'c) -> 'c -> ('a * 'b) t -> 'c
val iter2 : ('a -> 'b -> unit) -> ('a * 'b) t -> unit
val map2 : ('a -> 'b -> 'c) -> ('a * 'b) t -> 'c t
val map2_2 : ('a -> 'b -> 'c) -> ('a -> 'b -> 'd) -> ('a * 'b) t -> ('c * 'd) t

map2_2 f g seq2 maps each x, y of seq2 into f x y, g x y

Data structures converters

val to_list : 'a t -> 'a list

Convert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.

val to_rev_list : 'a t -> 'a list

Get the list of the reversed iterator (more efficient than to_list)

val of_list : 'a list -> 'a t
val on_list : ('a t -> 'b t) -> 'a list -> 'b list

on_list f l is equivalent to to_list @@ f @@ of_list l.

  • since 0.5.2
val pair_with_idx : 'a t -> (int * 'a) t

Similar to zip_i but returns a normal iterator of tuples

  • since 0.11
val to_opt : 'a t -> 'a option

Alias to head

  • since 0.5.1
val to_array : 'a t -> 'a array

Convert to an array. Currently not very efficient because an intermediate list is used.

val of_array : 'a array -> 'a t
val of_array_i : 'a array -> (int * 'a) t

Elements of the array, with their index

val array_slice : 'a array -> int -> int -> 'a t

array_slice a i j Iterator of elements whose indexes range from i to j

val of_opt : 'a option -> 'a t

Iterate on 0 or 1 values.

  • since 0.5.1
val of_seq : 'a Stdlib.Seq.t -> 'a t

Iterator of elements of a Seq.t.

  • since 1.5
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.t

Convert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.

  • since 1.5
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unit

Push elements of the iterator on the stack

val of_stack : 'a Stdlib.Stack.t -> 'a t

Iterator of elements of the stack (same order as Stack.iter)

val to_queue : 'a Stdlib.Queue.t -> 'a t -> unit

Push elements of the iterator into the queue

val of_queue : 'a Stdlib.Queue.t -> 'a t

Iterator of elements contained in the queue, FIFO order

val hashtbl_add : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.add

val hashtbl_replace : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)

val to_hashtbl : ('a * 'b) t -> ('a, 'b) Stdlib.Hashtbl.t

Build a hashtable from an iterator of key/value pairs

val of_hashtbl : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t

Iterator of key/value pairs from the hashtable

val hashtbl_keys : ('a, 'b) Stdlib.Hashtbl.t -> 'a t
val hashtbl_values : ('a, 'b) Stdlib.Hashtbl.t -> 'b t
val of_str : string -> char t
val to_str : char t -> string
val concat_str : string t -> string

Concatenate strings together, eagerly. Also see intersperse to add a separator.

  • since 0.5
exception OneShotSequence

Raised when the user tries to iterate several times on a transient iterator

val of_in_channel : Stdlib.in_channel -> char t

Iterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.

  • raises OneShotIterator

    when used more than once.

val to_buffer : char t -> Stdlib.Buffer.t -> unit

Copy content of the iterator into the buffer

val int_range : start:int -> stop:int -> int t

Iterator on integers in start...stop by steps 1. Also see (--) for an infix version.

val int_range_dec : start:int -> stop:int -> int t

Iterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version

val int_range_by : step:int -> int -> int -> int t

int_range_by ~step i j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.

  • raises Invalid_argument

    if step=0

val bools : bool t

Iterates on true and false

  • since 0.7
val of_set : (module Stdlib.Set.S with type elt = 'a and type t = 'b) -> 'b -> 'a t

Convert the given set to an iterator. The set module must be provided.

val to_set : @@ -35,13 +35,13 @@ let () = Random.self_init () (* Generate random values. *) let l = Iter.random_int 1000 |> Iter.take 3 |> Iter.to_list

Infix functions

module Infix : sig ... end
include module type of Infix
val (--) : int -> int -> int t

a -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.

val (--^) : int -> int -> int t

a --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind (infix version of flat_map

  • since 0.5
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Infix version of map

  • since 0.5
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative operator (product+application)

  • since 0.5
val (<+>) : 'a t -> 'a t -> 'a t

Concatenation of iterators

  • since 0.5
val let+ : 'a t -> ('a -> 'b) -> 'b t

Alias for map

  • since 1.7
val and+ : 'a t -> 'b t -> ('a * 'b) t

Alias for product

  • since 1.7
val let* : 'a t -> ('a -> 'b t) -> 'b t

Alias for flat_map

  • since 1.7
val and* : 'a t -> 'b t -> ('a * 'b) t

Alias for product

  • since 1.7

Pretty printing

val pp_seq : - ?sep:string -> + ?sep:string -> (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a t -> unit

Pretty print an iterator of 'a, using the given pretty printer to print each elements. An optional separator string can be provided.

val pp_buf : - ?sep:string -> + ?sep:string -> (Stdlib.Buffer.t -> 'a -> unit) -> Stdlib.Buffer.t -> 'a t -> - unit

Print into a buffer

val to_string : ?sep:string -> ('a -> string) -> 'a t -> string

Print into a string

module IO : sig ... end

Basic IO

\ No newline at end of file + unit

Print into a buffer

val to_string : ?sep:string -> ('a -> string) -> 'a t -> string

Print into a string

module IO : sig ... end

Basic IO

diff --git a/doc/iter/IterBigarray/index.html b/doc/iter/IterBigarray/index.html index b62a2f1..de7783e 100644 --- a/doc/iter/IterBigarray/index.html +++ b/doc/iter/IterBigarray/index.html @@ -1,2 +1,2 @@ -IterBigarray (iter.IterBigarray)

Module IterBigarray

Interface and Helpers for bigarrays

  • since 0.5.4
val of_bigarray : ('a, _, _) Stdlib.Bigarray.Array1.t -> 'a Iter.t

Iterate on the elements of a 1-D array

val mmap : string -> char Iter.t

Map the file into memory, and read the characters.

\ No newline at end of file +IterBigarray (iter.IterBigarray)

Module IterBigarray

Interface and Helpers for bigarrays

  • since 0.5.4
val of_bigarray : ('a, _, _) Stdlib.Bigarray.Array1.t -> 'a Iter.t

Iterate on the elements of a 1-D array

val mmap : string -> char Iter.t

Map the file into memory, and read the characters.

diff --git a/doc/iter/IterLabels/IO/index.html b/doc/iter/IterLabels/IO/index.html index d917ed5..461223c 100644 --- a/doc/iter/IterLabels/IO/index.html +++ b/doc/iter/IterLabels/IO/index.html @@ -1,27 +1,27 @@ -IO (iter.IterLabels.IO)

Module IterLabels.IO

val lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string t

lines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results

  • parameter mode

    default 0o644

  • parameter flags

    default: [Open_rdonly]

val chunks_of : - ?mode:int -> - ?flags:Stdlib.open_flag list -> - ?size:int -> +IO (iter.IterLabels.IO)

Module IterLabels.IO

val lines_of : ?mode:int -> ?flags:Stdlib.open_flag list -> string -> string t

lines_of filename reads all lines of the given file. It raises the same exception as would opening the file and read from it, except from End_of_file (which is caught). The file is always properly closed. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results

  • parameter mode

    default 0o644

  • parameter flags

    default: [Open_rdonly]

val chunks_of : + ?mode:int -> + ?flags:Stdlib.open_flag list -> + ?size:int -> string -> string t

Read chunks of the given size from the file. The last chunk might be smaller. Behaves like lines_of regarding errors and options. Every time the iterator is iterated on, the file is opened again, so different iterations might return different results

val write_to : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> string t -> unit

write_to filename seq writes all strings from seq into the given file. It takes care of opening and closing the file.

  • parameter mode

    default 0o644

  • parameter flags

    used by open_out_gen. Default: [Open_creat;Open_wronly].

val write_bytes_to : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> Stdlib.Bytes.t t -> unit
  • since 0.5.4
val write_lines : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> string t -> unit

Same as write_to, but intercales '\n' between each string

val write_bytes_lines : - ?mode:int -> - ?flags:Stdlib.open_flag list -> + ?mode:int -> + ?flags:Stdlib.open_flag list -> string -> Stdlib.Bytes.t t -> - unit
  • since 0.5.4
\ No newline at end of file + unit
  • since 0.5.4
diff --git a/doc/iter/IterLabels/Infix/index.html b/doc/iter/IterLabels/Infix/index.html index 436d348..eee92c6 100644 --- a/doc/iter/IterLabels/Infix/index.html +++ b/doc/iter/IterLabels/Infix/index.html @@ -1,2 +1,2 @@ -Infix (iter.IterLabels.Infix)

Module IterLabels.Infix

val (--) : int -> int -> int t

a -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.

val (--^) : int -> int -> int t

a --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind (infix version of flat_map

  • since 0.5
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Infix version of map

  • since 0.5
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative operator (product+application)

  • since 0.5
val (<+>) : 'a t -> 'a t -> 'a t

Concatenation of iterators

  • since 0.5
\ No newline at end of file +Infix (iter.IterLabels.Infix)

Module IterLabels.Infix

val (--) : int -> int -> int t

a -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.

val (--^) : int -> int -> int t

a --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind (infix version of flat_map

  • since 0.5
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Infix version of map

  • since 0.5
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative operator (product+application)

  • since 0.5
val (<+>) : 'a t -> 'a t -> 'a t

Concatenation of iterators

  • since 0.5
diff --git a/doc/iter/IterLabels/Map/Adapt/index.html b/doc/iter/IterLabels/Map/Adapt/index.html index 205e8b5..edea11d 100644 --- a/doc/iter/IterLabels/Map/Adapt/index.html +++ b/doc/iter/IterLabels/Map/Adapt/index.html @@ -1,6 +1,6 @@ -Adapt (iter.IterLabels.Map.Adapt)

Module Map.Adapt

Adapt a pre-existing Map module to make it iterator-aware

Parameters

module M : Stdlib.Map.S

Signature

include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
type key = M.key
type 'a t = 'a M.t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : +Adapt (iter.IterLabels.Map.Adapt)

Module Map.Adapt

Adapt a pre-existing Map module to make it iterator-aware

Parameters

module M : Stdlib.Map.S

Signature

include Stdlib.Map.S with type key = M.key with type 'a t = 'a M.t
type key = M.key
type 'a t = 'a M.t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> - 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
\ No newline at end of file + 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
diff --git a/doc/iter/IterLabels/Map/Make/index.html b/doc/iter/IterLabels/Map/Make/index.html index 515f469..666d7f3 100644 --- a/doc/iter/IterLabels/Map/Make/index.html +++ b/doc/iter/IterLabels/Map/Make/index.html @@ -1,6 +1,6 @@ -Make (iter.IterLabels.Map.Make)

Module Map.Make

Create an enriched Map module, with iterator-aware functions

Parameters

module V : Stdlib.Map.OrderedType

Signature

include Stdlib.Map.S with type key = V.t
type key = V.t
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : +Make (iter.IterLabels.Map.Make)

Module Map.Make

Create an enriched Map module, with iterator-aware functions

Parameters

module V : Stdlib.Map.OrderedType

Signature

include Stdlib.Map.S with type key = V.t
type key = V.t
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> - 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
\ No newline at end of file + 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
diff --git a/doc/iter/IterLabels/Map/index.html b/doc/iter/IterLabels/Map/index.html index 4147235..5b55306 100644 --- a/doc/iter/IterLabels/Map/index.html +++ b/doc/iter/IterLabels/Map/index.html @@ -1,4 +1,4 @@ -Map (iter.IterLabels.Map)

Module IterLabels.Map

module type S = sig ... end
module Adapt +Map (iter.IterLabels.Map)

Module IterLabels.Map

module type S = sig ... end
module Adapt (M : Stdlib.Map.S) : - S with type key = M.key and type 'a t = 'a M.t

Adapt a pre-existing Map module to make it iterator-aware

module Make (V : Stdlib.Map.OrderedType) : S with type key = V.t

Create an enriched Map module, with iterator-aware functions

\ No newline at end of file + S with type key = M.key and type 'a t = 'a M.t

Adapt a pre-existing Map module to make it iterator-aware

module Make (V : Stdlib.Map.OrderedType) : S with type key = V.t

Create an enriched Map module, with iterator-aware functions

diff --git a/doc/iter/IterLabels/Map/module-type-S/index.html b/doc/iter/IterLabels/Map/module-type-S/index.html index e816813..168f9c4 100644 --- a/doc/iter/IterLabels/Map/module-type-S/index.html +++ b/doc/iter/IterLabels/Map/module-type-S/index.html @@ -1,6 +1,6 @@ -S (iter.IterLabels.Map.S)

Module type Map.S

include Stdlib.Map.S
type key
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : +S (iter.IterLabels.Map.S)

Module type Map.S

include Stdlib.Map.S
type key
type !+'a t
val empty : 'a t
val add : key -> 'a -> 'a t -> 'a t
val add_to_list : key -> 'a -> 'a list t -> 'a list t
val update : key -> ('a option -> 'a option) -> 'a t -> 'a t
val singleton : key -> 'a -> 'a t
val remove : key -> 'a t -> 'a t
val merge : (key -> 'a option -> 'b option -> 'c option) -> 'a t -> 'b t -> - 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
\ No newline at end of file + 'c t
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t
val cardinal : 'a t -> int
val bindings : 'a t -> (key * 'a) list
val min_binding : 'a t -> key * 'a
val min_binding_opt : 'a t -> (key * 'a) option
val max_binding : 'a t -> key * 'a
val max_binding_opt : 'a t -> (key * 'a) option
val choose : 'a t -> key * 'a
val choose_opt : 'a t -> (key * 'a) option
val find : key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
val find_first : (key -> bool) -> 'a t -> key * 'a
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option
val find_last : (key -> bool) -> 'a t -> key * 'a
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option
val iter : (key -> 'a -> unit) -> 'a t -> unit
val fold : (key -> 'a -> 'acc -> 'acc) -> 'a t -> 'acc -> 'acc
val map : ('a -> 'b) -> 'a t -> 'b t
val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
val filter : (key -> 'a -> bool) -> 'a t -> 'a t
val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t
val split : key -> 'a t -> 'a t * 'a option * 'a t
val is_empty : 'a t -> bool
val mem : key -> 'a t -> bool
val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
val for_all : (key -> 'a -> bool) -> 'a t -> bool
val exists : (key -> 'a -> bool) -> 'a t -> bool
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t
val to_iter : 'a t -> (key * 'a) iter
val of_iter : (key * 'a) iter -> 'a t
val keys : 'a t -> key iter
val values : 'a t -> 'a iter
val to_list : 'a t -> (key * 'a) list
val of_list : (key * 'a) list -> 'a t
val to_seq : 'a t -> (key * 'a) iter
val of_seq : (key * 'a) iter -> 'a t
diff --git a/doc/iter/IterLabels/Set/Adapt/index.html b/doc/iter/IterLabels/Set/Adapt/index.html index c12351f..f394051 100644 --- a/doc/iter/IterLabels/Set/Adapt/index.html +++ b/doc/iter/IterLabels/Set/Adapt/index.html @@ -1,2 +1,2 @@ -Adapt (iter.IterLabels.Set.Adapt)

Module Set.Adapt

Create an enriched Set module from the given one

Parameters

module X : Stdlib.Set.S

Signature

include Stdlib.Set.S with type elt = X.elt with type t = X.t
type elt = X.elt
type t = X.t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
\ No newline at end of file +Adapt (iter.IterLabels.Set.Adapt)

Module Set.Adapt

Create an enriched Set module from the given one

Parameters

module X : Stdlib.Set.S

Signature

include Stdlib.Set.S with type elt = X.elt with type t = X.t
type elt = X.elt
type t = X.t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
diff --git a/doc/iter/IterLabels/Set/Make/index.html b/doc/iter/IterLabels/Set/Make/index.html index 74252e2..f52e827 100644 --- a/doc/iter/IterLabels/Set/Make/index.html +++ b/doc/iter/IterLabels/Set/Make/index.html @@ -1,2 +1,2 @@ -Make (iter.IterLabels.Set.Make)

Module Set.Make

Functor to build an extended Set module from an ordered type

Parameters

module X : Stdlib.Set.OrderedType

Signature

include Stdlib.Set.S with type elt = X.t
type elt = X.t
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
\ No newline at end of file +Make (iter.IterLabels.Set.Make)

Module Set.Make

Functor to build an extended Set module from an ordered type

Parameters

module X : Stdlib.Set.OrderedType

Signature

include Stdlib.Set.S with type elt = X.t
type elt = X.t
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
diff --git a/doc/iter/IterLabels/Set/index.html b/doc/iter/IterLabels/Set/index.html index bd44344..138548d 100644 --- a/doc/iter/IterLabels/Set/index.html +++ b/doc/iter/IterLabels/Set/index.html @@ -1,2 +1,2 @@ -Set (iter.IterLabels.Set)

Module IterLabels.Set

module type S = sig ... end
module Adapt (X : Stdlib.Set.S) : S with type elt = X.elt and type t = X.t

Create an enriched Set module from the given one

module Make (X : Stdlib.Set.OrderedType) : S with type elt = X.t

Functor to build an extended Set module from an ordered type

\ No newline at end of file +Set (iter.IterLabels.Set)

Module IterLabels.Set

module type S = sig ... end
module Adapt (X : Stdlib.Set.S) : S with type elt = X.elt and type t = X.t

Create an enriched Set module from the given one

module Make (X : Stdlib.Set.OrderedType) : S with type elt = X.t

Functor to build an extended Set module from an ordered type

diff --git a/doc/iter/IterLabels/Set/module-type-S/index.html b/doc/iter/IterLabels/Set/module-type-S/index.html index b8e56e3..0a27132 100644 --- a/doc/iter/IterLabels/Set/module-type-S/index.html +++ b/doc/iter/IterLabels/Set/module-type-S/index.html @@ -1,2 +1,2 @@ -S (iter.IterLabels.Set.S)

Module type Set.S

include Stdlib.Set.S
type elt
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
\ No newline at end of file +S (iter.IterLabels.Set.S)

Module type Set.S

include Stdlib.Set.S
type elt
type t
val empty : t
val add : elt -> t -> t
val singleton : elt -> t
val remove : elt -> t -> t
val union : t -> t -> t
val inter : t -> t -> t
val disjoint : t -> t -> bool
val diff : t -> t -> t
val cardinal : t -> int
val elements : t -> elt list
val min_elt : t -> elt
val min_elt_opt : t -> elt option
val max_elt : t -> elt
val max_elt_opt : t -> elt option
val choose : t -> elt
val choose_opt : t -> elt option
val find : elt -> t -> elt
val find_opt : elt -> t -> elt option
val find_first : (elt -> bool) -> t -> elt
val find_first_opt : (elt -> bool) -> t -> elt option
val find_last : (elt -> bool) -> t -> elt
val find_last_opt : (elt -> bool) -> t -> elt option
val iter : (elt -> unit) -> t -> unit
val fold : (elt -> 'acc -> 'acc) -> t -> 'acc -> 'acc
val map : (elt -> elt) -> t -> t
val filter : (elt -> bool) -> t -> t
val filter_map : (elt -> elt option) -> t -> t
val partition : (elt -> bool) -> t -> t * t
val split : elt -> t -> t * bool * t
val is_empty : t -> bool
val mem : elt -> t -> bool
val equal : t -> t -> bool
val compare : t -> t -> int
val subset : t -> t -> bool
val for_all : (elt -> bool) -> t -> bool
val exists : (elt -> bool) -> t -> bool
val to_seq_from : elt -> t -> elt Stdlib.Seq.t
val to_rev_seq : t -> elt Stdlib.Seq.t
val add_seq : elt Stdlib.Seq.t -> t -> t
val of_iter : elt iter -> t
val to_iter : t -> elt iter
val to_list : t -> elt list
val of_list : elt list -> t
val of_seq : elt iter -> t
val to_seq : t -> elt iter
diff --git a/doc/iter/IterLabels/index.html b/doc/iter/IterLabels/index.html index f6cbdcb..3c529be 100644 --- a/doc/iter/IterLabels/index.html +++ b/doc/iter/IterLabels/index.html @@ -1,56 +1,56 @@ -IterLabels (iter.IterLabels)

Module IterLabels

Simple and Efficient Iterators

Version of Iterator with labels

  • since 0.5.5
type +'a t = ('a -> unit) -> unit

An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.

type +'a iter = 'a t

NOTE Type ('a, 'b) t2 = ('a -> 'b -> unit) -> unit has been removed and subsumed by ('a * 'b) t

  • since 1.0
type 'a equal = 'a -> 'a -> bool
type 'a hash = 'a -> int

Creation

val from_iter : (('a -> unit) -> unit) -> 'a t

Build an iterator from a iter function

val from_labelled_iter : (f:('a -> unit) -> unit) -> 'a t

Build an iterator from a labelled iter function

  • since 1.2
val from_fun : (unit -> 'a option) -> 'a t

Call the function repeatedly until it returns None. This iterator is transient, use persistent if needed!

val empty : 'a t

Empty iterator. It contains no element.

val singleton : 'a -> 'a t

Singleton iterator, with exactly one element.

val doubleton : 'a -> 'a -> 'a t

Iterator with exactly two elements

val init : f:(int -> 'a) -> 'a t

init f is the infinite iterator f 0; f 1; f 2; ….

  • since 0.9
val cons : 'a -> 'a t -> 'a t

cons x l yields x, then yields from l. Same as append (singleton x) l

val snoc : 'a t -> 'a -> 'a t

Same as cons but yields the element after iterating on l

val return : 'a -> 'a t

Synonym to singleton

val pure : 'a -> 'a t

Synonym to singleton

val repeat : 'a -> 'a t

Infinite iterator of the same element. You may want to look at take and the likes if you iterate on it.

val iterate : ('a -> 'a) -> 'a -> 'a t

iterate f x is the infinite iterator x, f(x), f(f(x)), ...

val forever : (unit -> 'b) -> 'b t

Iterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.

val cycle : 'a t -> 'a t

Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.

Consumption

val iter : f:('a -> unit) -> 'a t -> unit

Consume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.

val iteri : f:(int -> 'a -> unit) -> 'a t -> unit

Iterate on elements and their index in the iterator

val for_each : seq:'a t -> ('a -> unit) -> unit

Consume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.

  • since 1.4
val for_eachi : seq:'a t -> (int -> 'a -> unit) -> unit

Iterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.

  • since 1.4
val fold : f:('a -> 'b -> 'a) -> init:'a -> 'b t -> 'a

Fold over elements of the iterator, consuming it

val foldi : f:('a -> int -> 'b -> 'a) -> init:'a -> 'b t -> 'a

Fold over elements of the iterator and their index, consuming it

val fold_map : f:('acc -> 'a -> 'acc * 'b) -> init:'acc -> 'a t -> 'b t

fold_map f acc l is like map, but it carries some state as in fold. The state is not returned, it is just used to thread some information to the map function.

  • since 0.9
val fold_filter_map : - f:('acc -> 'a -> 'acc * 'b option) -> - init:'acc -> +IterLabels (iter.IterLabels)

Module IterLabels

Simple and Efficient Iterators

Version of Iterator with labels

  • since 0.5.5
type +'a t = ('a -> unit) -> unit

An iterator of values of type 'a. If you give it a function 'a -> unit it will be applied to every element of the iterator successively.

type +'a iter = 'a t

NOTE Type ('a, 'b) t2 = ('a -> 'b -> unit) -> unit has been removed and subsumed by ('a * 'b) t

  • since 1.0
type 'a equal = 'a -> 'a -> bool
type 'a hash = 'a -> int

Creation

val from_iter : (('a -> unit) -> unit) -> 'a t

Build an iterator from a iter function

val from_labelled_iter : (f:('a -> unit) -> unit) -> 'a t

Build an iterator from a labelled iter function

  • since 1.2
val from_fun : (unit -> 'a option) -> 'a t

Call the function repeatedly until it returns None. This iterator is transient, use persistent if needed!

val empty : 'a t

Empty iterator. It contains no element.

val singleton : 'a -> 'a t

Singleton iterator, with exactly one element.

val doubleton : 'a -> 'a -> 'a t

Iterator with exactly two elements

val init : f:(int -> 'a) -> 'a t

init f is the infinite iterator f 0; f 1; f 2; ….

  • since 0.9
val cons : 'a -> 'a t -> 'a t

cons x l yields x, then yields from l. Same as append (singleton x) l

val snoc : 'a t -> 'a -> 'a t

Same as cons but yields the element after iterating on l

val return : 'a -> 'a t

Synonym to singleton

val pure : 'a -> 'a t

Synonym to singleton

val repeat : 'a -> 'a t

Infinite iterator of the same element. You may want to look at take and the likes if you iterate on it.

val iterate : ('a -> 'a) -> 'a -> 'a t

iterate f x is the infinite iterator x, f(x), f(f(x)), ...

val forever : (unit -> 'b) -> 'b t

Iterator that calls the given function to produce elements. The iterator may be transient (depending on the function), and definitely is infinite. You may want to use take and persistent.

val cycle : 'a t -> 'a t

Cycle forever through the given iterator. Assume the given iterator can be traversed any amount of times (not transient). This yields an infinite iterator, you should use something like take not to loop forever.

Consumption

val iter : f:('a -> unit) -> 'a t -> unit

Consume the iterator, passing all its arguments to the function. Basically iter f seq is just seq f.

val iteri : f:(int -> 'a -> unit) -> 'a t -> unit

Iterate on elements and their index in the iterator

val for_each : seq:'a t -> ('a -> unit) -> unit

Consume the iterator, passing all its arguments to the function. for_each seq f is the same as iter f seq, i.e., iter with arguments reversed.

  • since 1.4
val for_eachi : seq:'a t -> (int -> 'a -> unit) -> unit

Iterate on elements and their index in the iterator. for_eachi seq f is the same as iteri f seq, i.e., iteri with arguments reversed.

  • since 1.4
val fold : f:('a -> 'b -> 'a) -> init:'a -> 'b t -> 'a

Fold over elements of the iterator, consuming it

val foldi : f:('a -> int -> 'b -> 'a) -> init:'a -> 'b t -> 'a

Fold over elements of the iterator and their index, consuming it

val fold_map : f:('acc -> 'a -> 'acc * 'b) -> init:'acc -> 'a t -> 'b t

fold_map f acc l is like map, but it carries some state as in fold. The state is not returned, it is just used to thread some information to the map function.

  • since 0.9
val fold_filter_map : + f:('acc -> 'a -> 'acc * 'b option) -> + init:'acc -> 'a t -> - 'b t

fold_filter_map f acc l is a fold_map-like function, but the function can choose to skip an element by retuning None.

  • since 0.9
val map : f:('a -> 'b) -> 'a t -> 'b t

Map objects of the iterator into other elements, lazily

val mapi : f:(int -> 'a -> 'b) -> 'a t -> 'b t

Map objects, along with their index in the iterator

val map_by_2 : f:('a -> 'a -> 'a) -> 'a t -> 'a t

Map objects two by two. lazily. The last element is kept in the iterator if the count is odd.

  • since 0.7
val for_all : f:('a -> bool) -> 'a t -> bool

Do all elements satisfy the predicate?

val exists : f:('a -> bool) -> 'a t -> bool

Exists there some element satisfying the predicate?

val mem : ?eq:('a -> 'a -> bool) -> x:'a -> 'a t -> bool

Is the value a member of the iterator?

  • parameter eq

    the equality predicate to use (default (=))

  • since 0.5
val find : ('a -> 'b option) -> 'a t -> 'b option

Find the first element on which the function doesn't return None

  • since 0.5
val find_map : f:('a -> 'b option) -> 'a t -> 'b option

Alias to find

  • since 0.10
val findi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option

Indexed version of find

  • since 0.9
val find_mapi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option

Alias to findi

  • since 0.10
val find_pred : f:('a -> bool) -> 'a t -> 'a option

find_pred p l finds the first element of l that satisfies p, or returns None if no element satisfies p

  • since 0.9
val find_pred_exn : f:('a -> bool) -> 'a t -> 'a

Unsafe version of find_pred

  • raises Not_found

    if no such element is found

  • since 0.9
val length : 'a t -> int

How long is the iterator? Forces the iterator.

val is_empty : 'a t -> bool

Is the iterator empty? Forces the iterator.

Transformation

val filter : f:('a -> bool) -> 'a t -> 'a t

Filter on elements of the iterator

val append : 'a t -> 'a t -> 'a t

Append two iterators. Iterating on the result is like iterating on the first, then on the second.

val append_l : 'a t list -> 'a t

Append iterators. Iterating on the result is like iterating on the each iterator of the list in order.

  • since 0.11
val concat : 'a t t -> 'a t

Concatenate an iterator of iterators into one iterator.

val flatten : 'a t t -> 'a t

Alias for concat

val flat_map : f:('a -> 'b t) -> 'a t -> 'b t

Alias to flatMap with a more explicit name

val flat_map_l : f:('a -> 'b list) -> 'a t -> 'b t

Convenience function combining flat_map and of_list

  • since 0.9
val seq_list : 'a t list -> 'a list t

seq_list l returns all the ways to pick one element in each sub-iterator in l. Assumes the sub-iterators can be iterated on several times.

  • since 0.11
val seq_list_map : f:('a -> 'b t) -> 'a list -> 'b list t

seq_list_map f l maps f over every element of l, then calls seq_list

  • since 0.11
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t

Map and only keep non-None elements Formerly fmap

val filter_mapi : f:(int -> 'a -> 'b option) -> 'a t -> 'b t

Map with indices, and only keep non-None elements

  • since 0.11
val filter_count : f:('a -> bool) -> 'a t -> int

Count how many elements satisfy the given predicate

  • since 1.0
val intersperse : x:'a -> 'a t -> 'a t

Insert the single element between every element of the iterator

val keep_some : 'a option t -> 'a t

filter_some l retains only elements of the form Some x. Same as filter_map (fun x->x)

  • since 1.0
val keep_ok : ('a, _) Stdlib.result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.0
val keep_error : (_, 'e) Stdlib.result t -> 'e t

keep_error l retains only elements of the form Error x.

  • since 1.0

Caching

val persistent : 'a t -> 'a t

Iterate on the iterator, storing elements in an efficient internal structure.. The resulting iterator can be iterated on as many times as needed. Note: calling persistent on an already persistent iterator will still make a new copy of the iterator!

val persistent_lazy : 'a t -> 'a t

Lazy version of persistent. When calling persistent_lazy s, a new iterator s' is immediately returned (without actually consuming s) in constant time; the first time s' is iterated on, it also consumes s and caches its content into a inner data structure that will back s' for future iterations.

warning: on the first traversal of s', if the traversal is interrupted prematurely (take, etc.) then s' will not be memorized, and the next call to s' will traverse s again.

Misc

val sort : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator. Eager, O(n) ram and O(n ln(n)) time. It iterates on elements of the argument iterator immediately, before it sorts them.

val sort_uniq : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator and remove duplicates. Eager, same as sort

val sorted : ?cmp:('a -> 'a -> int) -> 'a t -> bool

Checks whether the iterator is sorted. Eager, same as sort.

  • since 0.9
val group_succ_by : ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal consecutive elements. Formerly synonym to group.

  • since 0.6
val group_by : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal elements, disregarding their order of appearance. The result iterator is traversable as many times as required. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.6
val count : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> ('a * int) t

Map each distinct element to its number of occurrences in the whole seq. Similar to group_by seq |> map (fun l->List.hd l, List.length l)

  • since 0.10
val uniq : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t

Remove consecutive duplicate elements. Basically this is like fun seq -> map List.hd (group seq).

val product : 'a t -> 'b t -> ('a * 'b) t

Cartesian product of the iterators. When calling product a b, the caller MUST ensure that b can be traversed as many times as required (several times), possibly by calling persistent on it beforehand.

val diagonal_l : 'a list -> ('a * 'a) t

All pairs of distinct positions of the list. diagonal l will return the iterator of all List.nth i l, List.nth j l if i < j.

  • since 0.9
val diagonal : 'a t -> ('a * 'a) t

All pairs of distinct positions of the iterator. Iterates only once on the iterator, which must be finite.

  • since 0.9
val join : join_row:('a -> 'b -> 'c option) -> 'a t -> 'b t -> 'c t

join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.

val join_by : - ?eq:'key equal -> - ?hash:'key hash -> + 'b t

fold_filter_map f acc l is a fold_map-like function, but the function can choose to skip an element by retuning None.

  • since 0.9
val map : f:('a -> 'b) -> 'a t -> 'b t

Map objects of the iterator into other elements, lazily

val mapi : f:(int -> 'a -> 'b) -> 'a t -> 'b t

Map objects, along with their index in the iterator

val map_by_2 : f:('a -> 'a -> 'a) -> 'a t -> 'a t

Map objects two by two. lazily. The last element is kept in the iterator if the count is odd.

  • since 0.7
val for_all : f:('a -> bool) -> 'a t -> bool

Do all elements satisfy the predicate?

val exists : f:('a -> bool) -> 'a t -> bool

Exists there some element satisfying the predicate?

val mem : ?eq:('a -> 'a -> bool) -> x:'a -> 'a t -> bool

Is the value a member of the iterator?

  • parameter eq

    the equality predicate to use (default (=))

  • since 0.5
val find : ('a -> 'b option) -> 'a t -> 'b option

Find the first element on which the function doesn't return None

  • since 0.5
val find_map : f:('a -> 'b option) -> 'a t -> 'b option

Alias to find

  • since 0.10
val findi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option

Indexed version of find

  • since 0.9
val find_mapi : f:(int -> 'a -> 'b option) -> 'a t -> 'b option

Alias to findi

  • since 0.10
val find_pred : f:('a -> bool) -> 'a t -> 'a option

find_pred p l finds the first element of l that satisfies p, or returns None if no element satisfies p

  • since 0.9
val find_pred_exn : f:('a -> bool) -> 'a t -> 'a

Unsafe version of find_pred

  • raises Not_found

    if no such element is found

  • since 0.9
val length : 'a t -> int

How long is the iterator? Forces the iterator.

val is_empty : 'a t -> bool

Is the iterator empty? Forces the iterator.

Transformation

val filter : f:('a -> bool) -> 'a t -> 'a t

Filter on elements of the iterator

val append : 'a t -> 'a t -> 'a t

Append two iterators. Iterating on the result is like iterating on the first, then on the second.

val append_l : 'a t list -> 'a t

Append iterators. Iterating on the result is like iterating on the each iterator of the list in order.

  • since 0.11
val concat : 'a t t -> 'a t

Concatenate an iterator of iterators into one iterator.

val flatten : 'a t t -> 'a t

Alias for concat

val flat_map : f:('a -> 'b t) -> 'a t -> 'b t

Alias to flatMap with a more explicit name

val flat_map_l : f:('a -> 'b list) -> 'a t -> 'b t

Convenience function combining flat_map and of_list

  • since 0.9
val seq_list : 'a t list -> 'a list t

seq_list l returns all the ways to pick one element in each sub-iterator in l. Assumes the sub-iterators can be iterated on several times.

  • since 0.11
val seq_list_map : f:('a -> 'b t) -> 'a list -> 'b list t

seq_list_map f l maps f over every element of l, then calls seq_list

  • since 0.11
val filter_map : f:('a -> 'b option) -> 'a t -> 'b t

Map and only keep non-None elements Formerly fmap

val filter_mapi : f:(int -> 'a -> 'b option) -> 'a t -> 'b t

Map with indices, and only keep non-None elements

  • since 0.11
val filter_count : f:('a -> bool) -> 'a t -> int

Count how many elements satisfy the given predicate

  • since 1.0
val intersperse : x:'a -> 'a t -> 'a t

Insert the single element between every element of the iterator

val keep_some : 'a option t -> 'a t

filter_some l retains only elements of the form Some x. Same as filter_map (fun x->x)

  • since 1.0
val keep_ok : ('a, _) Stdlib.result t -> 'a t

keep_ok l retains only elements of the form Ok x.

  • since 1.0
val keep_error : (_, 'e) Stdlib.result t -> 'e t

keep_error l retains only elements of the form Error x.

  • since 1.0

Caching

val persistent : 'a t -> 'a t

Iterate on the iterator, storing elements in an efficient internal structure.. The resulting iterator can be iterated on as many times as needed. Note: calling persistent on an already persistent iterator will still make a new copy of the iterator!

val persistent_lazy : 'a t -> 'a t

Lazy version of persistent. When calling persistent_lazy s, a new iterator s' is immediately returned (without actually consuming s) in constant time; the first time s' is iterated on, it also consumes s and caches its content into a inner data structure that will back s' for future iterations.

warning: on the first traversal of s', if the traversal is interrupted prematurely (take, etc.) then s' will not be memorized, and the next call to s' will traverse s again.

Misc

val sort : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator. Eager, O(n) ram and O(n ln(n)) time. It iterates on elements of the argument iterator immediately, before it sorts them.

val sort_uniq : ?cmp:('a -> 'a -> int) -> 'a t -> 'a t

Sort the iterator and remove duplicates. Eager, same as sort

val sorted : ?cmp:('a -> 'a -> int) -> 'a t -> bool

Checks whether the iterator is sorted. Eager, same as sort.

  • since 0.9
val group_succ_by : ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal consecutive elements. Formerly synonym to group.

  • since 0.6
val group_by : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> 'a list t

Group equal elements, disregarding their order of appearance. The result iterator is traversable as many times as required. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.6
val count : ?hash:('a -> int) -> ?eq:('a -> 'a -> bool) -> 'a t -> ('a * int) t

Map each distinct element to its number of occurrences in the whole seq. Similar to group_by seq |> map (fun l->List.hd l, List.length l)

  • since 0.10
val uniq : ?eq:('a -> 'a -> bool) -> 'a t -> 'a t

Remove consecutive duplicate elements. Basically this is like fun seq -> map List.hd (group seq).

val product : 'a t -> 'b t -> ('a * 'b) t

Cartesian product of the iterators. When calling product a b, the caller MUST ensure that b can be traversed as many times as required (several times), possibly by calling persistent on it beforehand.

val diagonal_l : 'a list -> ('a * 'a) t

All pairs of distinct positions of the list. diagonal l will return the iterator of all List.nth i l, List.nth j l if i < j.

  • since 0.9
val diagonal : 'a t -> ('a * 'a) t

All pairs of distinct positions of the iterator. Iterates only once on the iterator, which must be finite.

  • since 0.9
val join : join_row:('a -> 'b -> 'c option) -> 'a t -> 'b t -> 'c t

join ~join_row a b combines every element of a with every element of b using join_row. If join_row returns None, then the two elements do not combine. Assume that b allows for multiple iterations.

val join_by : + ?eq:'key equal -> + ?hash:'key hash -> ('a -> 'key) -> ('b -> 'key) -> - merge:('key -> 'a -> 'b -> 'c option) -> + merge:('key -> 'a -> 'b -> 'c option) -> 'a t -> 'b t -> 'c t

join key1 key2 ~merge is a binary operation that takes two iterators a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val join_all_by : - ?eq:'key equal -> - ?hash:'key hash -> + ?eq:'key equal -> + ?hash:'key hash -> ('a -> 'key) -> ('b -> 'key) -> - merge:('key -> 'a list -> 'b list -> 'c option) -> + merge:('key -> 'a list -> 'b list -> 'c option) -> 'a t -> 'b t -> 'c t

join_all_by key1 key2 ~merge is a binary operation that takes two iterators a and b, projects their elements resp. with key1 and key2, and, for each key k occurring in at least one of them:

  • compute the list l1 of elements of a that map to k
  • compute the list l2 of elements of b that map to k
  • call merge k l1 l2. If merge returns None, the combination of values is discarded, otherwise it returns Some c and c is inserted in the result.
  • since 0.10
val group_join_by : - ?eq:'a equal -> - ?hash:'a hash -> + ?eq:'a equal -> + ?hash:'a hash -> ('b -> 'a) -> 'a t -> 'b t -> - ('a * 'b list) t

group_join_by key2 associates to every element x of the first iterator, all the elements y of the second iterator such that eq x (key y). Elements of the first iterators without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val inter : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Intersection of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val union : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Union of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val diff : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Set difference. Eager.

  • since 0.10
val subset : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> bool

subset a b returns true if all elements of a belong to b. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val unfoldr : ('b -> ('a * 'b) option) -> 'b -> 'a t

unfoldr f b will apply f to b. If it yields Some (x,b') then x is returned and unfoldr recurses with b'.

val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t

Iterator of intermediate results

val max : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Max element of the iterator, using the given comparison function.

  • returns

    None if the iterator is empty, Some m where m is the maximal element otherwise

val max_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of max

  • raises Not_found

    if the iterator is empty

  • since 0.10
val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Min element of the iterator, using the given comparison function. see max for more details.

val min_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of min

  • raises Not_found

    if the iterator is empty

  • since 0.10
val sum : int t -> int

Sum of elements

  • since 0.11
val sumf : float t -> float

Sum of elements, using Kahan summation

  • since 0.11
val head : 'a t -> 'a option

First element, if any, otherwise None

  • since 0.5.1
val head_exn : 'a t -> 'a

First element, if any, fails

  • raises Invalid_argument

    if the iterator is empty

  • since 0.5.1
val take : int -> 'a t -> 'a t

Take at most n elements from the iterator. Works on infinite iterators.

val take_while : f:('a -> bool) -> 'a t -> 'a t

Take elements while they satisfy the predicate, then stops iterating. Will work on an infinite iterator s if the predicate is false for at least one element of s.

val fold_while : - f:('a -> 'b -> 'a * [ `Stop | `Continue ]) -> - init:'a -> + ('a * 'b list) t

group_join_by key2 associates to every element x of the first iterator, all the elements y of the second iterator such that eq x (key y). Elements of the first iterators without corresponding values in the second one are mapped to [] precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val inter : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Intersection of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val union : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Union of two collections. Each element will occur at most once in the result. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val diff : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> 'a t

Set difference. Eager.

  • since 0.10
val subset : ?eq:'a equal -> ?hash:'a hash -> 'a t -> 'a t -> bool

subset a b returns true if all elements of a belong to b. Eager. precondition: for any x and y, if eq x y then hash x=hash y must hold.

  • since 0.10
val unfoldr : ('b -> ('a * 'b) option) -> 'b -> 'a t

unfoldr f b will apply f to b. If it yields Some (x,b') then x is returned and unfoldr recurses with b'.

val scan : ('b -> 'a -> 'b) -> 'b -> 'a t -> 'b t

Iterator of intermediate results

val max : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Max element of the iterator, using the given comparison function.

  • returns

    None if the iterator is empty, Some m where m is the maximal element otherwise

val max_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of max

  • raises Not_found

    if the iterator is empty

  • since 0.10
val min : ?lt:('a -> 'a -> bool) -> 'a t -> 'a option

Min element of the iterator, using the given comparison function. see max for more details.

val min_exn : ?lt:('a -> 'a -> bool) -> 'a t -> 'a

Unsafe version of min

  • raises Not_found

    if the iterator is empty

  • since 0.10
val sum : int t -> int

Sum of elements

  • since 0.11
val sumf : float t -> float

Sum of elements, using Kahan summation

  • since 0.11
val head : 'a t -> 'a option

First element, if any, otherwise None

  • since 0.5.1
val head_exn : 'a t -> 'a

First element, if any, fails

  • raises Invalid_argument

    if the iterator is empty

  • since 0.5.1
val take : int -> 'a t -> 'a t

Take at most n elements from the iterator. Works on infinite iterators.

val take_while : f:('a -> bool) -> 'a t -> 'a t

Take elements while they satisfy the predicate, then stops iterating. Will work on an infinite iterator s if the predicate is false for at least one element of s.

val fold_while : + f:('a -> 'b -> 'a * [ `Stop | `Continue ]) -> + init:'a -> 'b t -> - 'a

Folds over elements of the iterator, stopping early if the accumulator returns ('a, `Stop)

  • since 0.5.5
val drop : int -> 'a t -> 'a t

Drop the n first elements of the iterator. Lazy.

val drop_while : f:('a -> bool) -> 'a t -> 'a t

Predicate version of drop

val rev : 'a t -> 'a t

Reverse the iterator. O(n) memory and time, needs the iterator to be finite. The result is persistent and does not depend on the input being repeatable.

val zip_i : 'a t -> (int * 'a) t

Zip elements of the iterator with their index in the iterator.

  • since 1.0 Changed type to just give an iterator of pairs
val fold2 : f:('c -> 'a -> 'b -> 'c) -> init:'c -> ('a * 'b) t -> 'c
val iter2 : f:('a -> 'b -> unit) -> ('a * 'b) t -> unit
val map2 : f:('a -> 'b -> 'c) -> ('a * 'b) t -> 'c t
val map2_2 : - f:('a -> 'b -> 'c) -> + 'a

Folds over elements of the iterator, stopping early if the accumulator returns ('a, `Stop)

  • since 0.5.5
val drop : int -> 'a t -> 'a t

Drop the n first elements of the iterator. Lazy.

val drop_while : f:('a -> bool) -> 'a t -> 'a t

Predicate version of drop

val rev : 'a t -> 'a t

Reverse the iterator. O(n) memory and time, needs the iterator to be finite. The result is persistent and does not depend on the input being repeatable.

val zip_i : 'a t -> (int * 'a) t

Zip elements of the iterator with their index in the iterator.

  • since 1.0 Changed type to just give an iterator of pairs
val fold2 : f:('c -> 'a -> 'b -> 'c) -> init:'c -> ('a * 'b) t -> 'c
val iter2 : f:('a -> 'b -> unit) -> ('a * 'b) t -> unit
val map2 : f:('a -> 'b -> 'c) -> ('a * 'b) t -> 'c t
val map2_2 : + f:('a -> 'b -> 'c) -> ('a -> 'b -> 'd) -> ('a * 'b) t -> - ('c * 'd) t

map2_2 f g seq2 maps each x, y of seq2 into f x y, g x y

Data structures converters

val to_list : 'a t -> 'a list

Convert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.

val to_rev_list : 'a t -> 'a list

Get the list of the reversed iterator (more efficient than to_list)

val of_list : 'a list -> 'a t
val on_list : ('a t -> 'b t) -> 'a list -> 'b list

on_list f l is equivalent to to_list @@ f @@ of_list l.

  • since 0.5.2
val pair_with_idx : 'a t -> (int * 'a) t

Similar to zip_i but returns a normal iterator of tuples

  • since 0.11
val to_opt : 'a t -> 'a option

Alias to head

  • since 0.5.1
val to_array : 'a t -> 'a array

Convert to an array. Currently not very efficient because an intermediate list is used.

val of_array : 'a array -> 'a t
val of_array_i : 'a array -> (int * 'a) t

Elements of the array, with their index

val array_slice : 'a array -> int -> int -> 'a t

array_slice a i j Iterator of elements whose indexes range from i to j

val of_opt : 'a option -> 'a t

Iterate on 0 or 1 values.

  • since 0.5.1
val of_seq : 'a Stdlib.Seq.t -> 'a t

Iterator of elements of a Seq.t.

  • since 1.5
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.t

Convert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.

  • since 1.5
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unit

Push elements of the iterator on the stack

val of_stack : 'a Stdlib.Stack.t -> 'a t

Iterator of elements of the stack (same order as Stack.iter)

val to_queue : 'a Stdlib.Queue.t -> 'a t -> unit

Push elements of the iterator into the queue

val of_queue : 'a Stdlib.Queue.t -> 'a t

Iterator of elements contained in the queue, FIFO order

val hashtbl_add : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.add

val hashtbl_replace : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)

val to_hashtbl : ('a * 'b) t -> ('a, 'b) Stdlib.Hashtbl.t

Build a hashtable from an iterator of key/value pairs

val of_hashtbl : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t

Iterator of key/value pairs from the hashtable

val hashtbl_keys : ('a, 'b) Stdlib.Hashtbl.t -> 'a t
val hashtbl_values : ('a, 'b) Stdlib.Hashtbl.t -> 'b t
val of_str : string -> char t
val to_str : char t -> string
val concat_str : string t -> string

Concatenate strings together, eagerly. Also see intersperse to add a separator.

  • since 0.5
exception OneShotSequence

Raised when the user tries to iterate several times on a transient iterator

val of_in_channel : Stdlib.in_channel -> char t

Iterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.

  • raises OneShotIterator

    when used more than once.

val to_buffer : char t -> Stdlib.Buffer.t -> unit

Copy content of the iterator into the buffer

val int_range : start:int -> stop:int -> int t

Iterator on integers in start...stop by steps 1. Also see (--) for an infix version.

val int_range_dec : start:int -> stop:int -> int t

Iterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version

val int_range_by : step:int -> start:int -> stop:int -> int t

int_range_by ~step ~start:i ~stop:j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.

  • since 0.9
  • raises Invalid_argument

    if step=0

val bools : bool t

Iterates on true and false

  • since 0.9
val of_set : + ('c * 'd) t

map2_2 f g seq2 maps each x, y of seq2 into f x y, g x y

Data structures converters

val to_list : 'a t -> 'a list

Convert the iterator into a list. Preserves order of elements. This function is tail-recursive, but consumes 2*n memory. If order doesn't matter to you, consider to_rev_list.

val to_rev_list : 'a t -> 'a list

Get the list of the reversed iterator (more efficient than to_list)

val of_list : 'a list -> 'a t
val on_list : ('a t -> 'b t) -> 'a list -> 'b list

on_list f l is equivalent to to_list @@ f @@ of_list l.

  • since 0.5.2
val pair_with_idx : 'a t -> (int * 'a) t

Similar to zip_i but returns a normal iterator of tuples

  • since 0.11
val to_opt : 'a t -> 'a option

Alias to head

  • since 0.5.1
val to_array : 'a t -> 'a array

Convert to an array. Currently not very efficient because an intermediate list is used.

val of_array : 'a array -> 'a t
val of_array_i : 'a array -> (int * 'a) t

Elements of the array, with their index

val array_slice : 'a array -> int -> int -> 'a t

array_slice a i j Iterator of elements whose indexes range from i to j

val of_opt : 'a option -> 'a t

Iterate on 0 or 1 values.

  • since 0.5.1
val of_seq : 'a Stdlib.Seq.t -> 'a t

Iterator of elements of a Seq.t.

  • since 1.5
val to_seq_persistent : 'a t -> 'a Stdlib.Seq.t

Convert to a Seq. Linear in memory and time (a copy is made in memory). This does not work on infinite iterators.

  • since 1.5
val to_stack : 'a Stdlib.Stack.t -> 'a t -> unit

Push elements of the iterator on the stack

val of_stack : 'a Stdlib.Stack.t -> 'a t

Iterator of elements of the stack (same order as Stack.iter)

val to_queue : 'a Stdlib.Queue.t -> 'a t -> unit

Push elements of the iterator into the queue

val of_queue : 'a Stdlib.Queue.t -> 'a t

Iterator of elements contained in the queue, FIFO order

val hashtbl_add : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.add

val hashtbl_replace : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t -> unit

Add elements of the iterator to the hashtable, with Hashtbl.replace (erases conflicting bindings)

val to_hashtbl : ('a * 'b) t -> ('a, 'b) Stdlib.Hashtbl.t

Build a hashtable from an iterator of key/value pairs

val of_hashtbl : ('a, 'b) Stdlib.Hashtbl.t -> ('a * 'b) t

Iterator of key/value pairs from the hashtable

val hashtbl_keys : ('a, 'b) Stdlib.Hashtbl.t -> 'a t
val hashtbl_values : ('a, 'b) Stdlib.Hashtbl.t -> 'b t
val of_str : string -> char t
val to_str : char t -> string
val concat_str : string t -> string

Concatenate strings together, eagerly. Also see intersperse to add a separator.

  • since 0.5
exception OneShotSequence

Raised when the user tries to iterate several times on a transient iterator

val of_in_channel : Stdlib.in_channel -> char t

Iterates on characters of the input (can block when one iterates over the iterator). If you need to iterate several times on this iterator, use persistent.

  • raises OneShotIterator

    when used more than once.

val to_buffer : char t -> Stdlib.Buffer.t -> unit

Copy content of the iterator into the buffer

val int_range : start:int -> stop:int -> int t

Iterator on integers in start...stop by steps 1. Also see (--) for an infix version.

val int_range_dec : start:int -> stop:int -> int t

Iterator on decreasing integers in stop...start by steps -1. See (--^) for an infix version

val int_range_by : step:int -> start:int -> stop:int -> int t

int_range_by ~step ~start:i ~stop:j is the range starting at i, including j, where the difference between successive elements is step. use a negative step for a decreasing iterator.

  • since 0.9
  • raises Invalid_argument

    if step=0

val bools : bool t

Iterates on true and false

  • since 0.9
val of_set : (module Stdlib.Set.S with type elt = 'a and type t = 'b) -> 'b -> 'a t

Convert the given set to an iterator. The set module must be provided.

val to_set : (module Stdlib.Set.S with type elt = 'a and type t = 'b) -> 'a t -> - 'b

Convert the iterator to a set, given the proper set module

type 'a gen = unit -> 'a option
val of_gen : 'a gen -> 'a t

Traverse eagerly the generator and build an iterator from it

val of_gen_once : 'a gen -> 'a t

One shot iterator using this generator. It must not be traversed twice.

  • since 1.5
val to_gen : 'a t -> 'a gen

Make the iterator persistent (O(n)) and then iterate on it. Eager.

Sets

module Set : sig ... end

Maps

module Map : sig ... end

Random iterators

Generating

val random_int : int -> int t

Infinite iterator of random integers between 0 and the given higher bound (see Random.int)

val random_bool : bool t

Infinite iterator of random bool values

val random_float : float -> float t
val random_array : 'a array -> 'a t

Iterator of choices of an element in the array

val random_list : 'a list -> 'a t

Infinite iterator of random elements of the list. Basically the same as random_array.

val shuffle : 'a t -> 'a t

shuffle seq returns a perfect shuffle of seq. Uses O(length seq) memory and time. Eager.

  • since 0.7
val shuffle_buffer : n:int -> 'a t -> 'a t

shuffle_buffer n seq returns an iterator of element of seq in random order. The shuffling is not uniform. Uses O(n) memory.

The first n elements of the iterator are consumed immediately. The rest is consumed lazily.

  • since 0.7

Sampling

val sample : n:int -> 'a t -> 'a array

sample n seq returns k samples of seq, with uniform probability. It will consume the iterator and use O(n) memory.

It returns an array of size min (length seq) n.

  • since 0.7

Seeding

Random iterators use Random.int, Random.float, Random.bool, etc., under the hood, so they will respect seeding of the random generator in the usual way. I.e., if you do not initialize the random generator with one of Random.init, Random.full_init, or Random.self_init before calling these functions, they will yield the same values across seperate invocations of your program.

Example:

(* Ensure a fresh random seed each time the program is executed. *)
+  'b

Convert the iterator to a set, given the proper set module

type 'a gen = unit -> 'a option
val of_gen : 'a gen -> 'a t

Traverse eagerly the generator and build an iterator from it

val of_gen_once : 'a gen -> 'a t

One shot iterator using this generator. It must not be traversed twice.

  • since 1.5
val to_gen : 'a t -> 'a gen

Make the iterator persistent (O(n)) and then iterate on it. Eager.

Sets

module Set : sig ... end

Maps

module Map : sig ... end

Random iterators

Generating

val random_int : int -> int t

Infinite iterator of random integers between 0 and the given higher bound (see Random.int)

val random_bool : bool t

Infinite iterator of random bool values

val random_float : float -> float t
val random_array : 'a array -> 'a t

Iterator of choices of an element in the array

val random_list : 'a list -> 'a t

Infinite iterator of random elements of the list. Basically the same as random_array.

val shuffle : 'a t -> 'a t

shuffle seq returns a perfect shuffle of seq. Uses O(length seq) memory and time. Eager.

  • since 0.7
val shuffle_buffer : n:int -> 'a t -> 'a t

shuffle_buffer n seq returns an iterator of element of seq in random order. The shuffling is not uniform. Uses O(n) memory.

The first n elements of the iterator are consumed immediately. The rest is consumed lazily.

  • since 0.7

Sampling

val sample : n:int -> 'a t -> 'a array

sample n seq returns k samples of seq, with uniform probability. It will consume the iterator and use O(n) memory.

It returns an array of size min (length seq) n.

  • since 0.7

Seeding

Random iterators use Random.int, Random.float, Random.bool, etc., under the hood, so they will respect seeding of the random generator in the usual way. I.e., if you do not initialize the random generator with one of Random.init, Random.full_init, or Random.self_init before calling these functions, they will yield the same values across seperate invocations of your program.

Example:

(* Ensure a fresh random seed each time the program is executed. *)
 let () = Random.self_init ()
 
 (* Generate random values. *)
 let l = Iter.random_int 1000 |> Iter.take 3 |> Iter.to_list

Infix functions

module Infix : sig ... end
include module type of Infix
val (--) : int -> int -> int t

a -- b is the range of integers from a to b, both included, in increasing order. It will therefore be empty if a > b.

val (--^) : int -> int -> int t

a --^ b is the range of integers from b to a, both included, in decreasing order (starts from a). It will therefore be empty if a < b.

val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

Monadic bind (infix version of flat_map

  • since 0.5
val (>|=) : 'a t -> ('a -> 'b) -> 'b t

Infix version of map

  • since 0.5
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t

Applicative operator (product+application)

  • since 0.5
val (<+>) : 'a t -> 'a t -> 'a t

Concatenation of iterators

  • since 0.5

Pretty printing

val pp_seq : - ?sep:string -> + ?sep:string -> (Stdlib.Format.formatter -> 'a -> unit) -> Stdlib.Format.formatter -> 'a t -> unit

Pretty print an iterator of 'a, using the given pretty printer to print each elements. An optional separator string can be provided.

val pp_buf : - ?sep:string -> + ?sep:string -> (Stdlib.Buffer.t -> 'a -> unit) -> Stdlib.Buffer.t -> 'a t -> - unit

Print into a buffer

val to_string : ?sep:string -> ('a -> string) -> 'a t -> string

Print into a string

Basic IO

Very basic interface to manipulate files as iterator of chunks/lines. The iterators take care of opening and closing files properly; every time one iterates over an iterator, the file is opened/closed again.

Example: copy a file "a" into file "b", removing blank lines:

Iterator.(IO.lines_of "a" |> filter (fun l-> l<> "") |> IO.write_lines "b");;

By chunks of 4096 bytes:

Iterator.IO.(chunks_of ~size:4096 "a" |> write_to "b");;

Read the lines of a file into a list:

Iterator.IO.lines "a" |> Iterator.to_list
  • since 0.5.1
module IO : sig ... end
\ No newline at end of file + unit

Print into a buffer

val to_string : ?sep:string -> ('a -> string) -> 'a t -> string

Print into a string

Basic IO

Very basic interface to manipulate files as iterator of chunks/lines. The iterators take care of opening and closing files properly; every time one iterates over an iterator, the file is opened/closed again.

Example: copy a file "a" into file "b", removing blank lines:

Iterator.(IO.lines_of "a" |> filter (fun l-> l<> "") |> IO.write_lines "b");;

By chunks of 4096 bytes:

Iterator.IO.(chunks_of ~size:4096 "a" |> write_to "b");;

Read the lines of a file into a list:

Iterator.IO.lines "a" |> Iterator.to_list
module IO : sig ... end
diff --git a/doc/iter/index.html b/doc/iter/index.html index 776984d..56afd84 100644 --- a/doc/iter/index.html +++ b/doc/iter/index.html @@ -1,2 +1,2 @@ -index (iter.index)

iter index

Library iter

This library exposes the following toplevel modules:

Library iter.bigarray

The entry point of this library is the module: IterBigarray.

\ No newline at end of file +index (iter.index)

iter index

Library iter

This library exposes the following toplevel modules:

Library iter.bigarray

The entry point of this library is the module: IterBigarray.

diff --git a/doc/odoc.support/fonts/fira-mono-v14-latin-500.woff2 b/doc/odoc.support/fonts/fira-mono-v14-latin-500.woff2 new file mode 100644 index 0000000..9d07a63 Binary files /dev/null and b/doc/odoc.support/fonts/fira-mono-v14-latin-500.woff2 differ diff --git a/doc/odoc.support/fonts/fira-mono-v14-latin-regular.woff2 b/doc/odoc.support/fonts/fira-mono-v14-latin-regular.woff2 new file mode 100644 index 0000000..edc71a8 Binary files /dev/null and b/doc/odoc.support/fonts/fira-mono-v14-latin-regular.woff2 differ diff --git a/doc/odoc.support/fonts/fira-sans-v17-latin-500.woff2 b/doc/odoc.support/fonts/fira-sans-v17-latin-500.woff2 new file mode 100644 index 0000000..24bb8f4 Binary files /dev/null and b/doc/odoc.support/fonts/fira-sans-v17-latin-500.woff2 differ diff --git a/doc/odoc.support/fonts/fira-sans-v17-latin-500italic.woff2 b/doc/odoc.support/fonts/fira-sans-v17-latin-500italic.woff2 new file mode 100644 index 0000000..1a8b72d Binary files /dev/null and b/doc/odoc.support/fonts/fira-sans-v17-latin-500italic.woff2 differ diff --git a/doc/odoc.support/fonts/fira-sans-v17-latin-700.woff2 b/doc/odoc.support/fonts/fira-sans-v17-latin-700.woff2 new file mode 100644 index 0000000..40b8a1c Binary files /dev/null and b/doc/odoc.support/fonts/fira-sans-v17-latin-700.woff2 differ diff --git a/doc/odoc.support/fonts/fira-sans-v17-latin-700italic.woff2 b/doc/odoc.support/fonts/fira-sans-v17-latin-700italic.woff2 new file mode 100644 index 0000000..bdf8f5f Binary files /dev/null and b/doc/odoc.support/fonts/fira-sans-v17-latin-700italic.woff2 differ diff --git a/doc/odoc.support/fonts/fira-sans-v17-latin-italic.woff2 b/doc/odoc.support/fonts/fira-sans-v17-latin-italic.woff2 new file mode 100644 index 0000000..b9619dd Binary files /dev/null and b/doc/odoc.support/fonts/fira-sans-v17-latin-italic.woff2 differ diff --git a/doc/odoc.support/fonts/fira-sans-v17-latin-regular.woff2 b/doc/odoc.support/fonts/fira-sans-v17-latin-regular.woff2 new file mode 100644 index 0000000..d31eba8 Binary files /dev/null and b/doc/odoc.support/fonts/fira-sans-v17-latin-regular.woff2 differ diff --git a/doc/odoc.support/fonts/noticia-text-v15-latin-700.woff2 b/doc/odoc.support/fonts/noticia-text-v15-latin-700.woff2 new file mode 100644 index 0000000..536fbe1 Binary files /dev/null and b/doc/odoc.support/fonts/noticia-text-v15-latin-700.woff2 differ diff --git a/doc/odoc.support/fonts/noticia-text-v15-latin-italic.woff2 b/doc/odoc.support/fonts/noticia-text-v15-latin-italic.woff2 new file mode 100644 index 0000000..9b83b07 Binary files /dev/null and b/doc/odoc.support/fonts/noticia-text-v15-latin-italic.woff2 differ diff --git a/doc/odoc.support/fonts/noticia-text-v15-latin-regular.woff2 b/doc/odoc.support/fonts/noticia-text-v15-latin-regular.woff2 new file mode 100644 index 0000000..efff29f Binary files /dev/null and b/doc/odoc.support/fonts/noticia-text-v15-latin-regular.woff2 differ diff --git a/doc/odoc.support/highlight.pack.js b/doc/odoc.support/highlight.pack.js index a373159..7d1bcd0 100644 --- a/doc/odoc.support/highlight.pack.js +++ b/doc/odoc.support/highlight.pack.js @@ -302,7 +302,238 @@ e["after:highlightBlock"](Object.assign({block:t.el},t))})})(e),s.push(e)} },t.versionString="11.7.0",t.regex={concat:p,lookahead:d,either:f,optional:h, anyNumberOfTimes:u};for(const t in A)"object"==typeof A[t]&&e.exports(A[t]) ;return Object.assign(t,A),t})({});return te}() -;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `xml` grammar compiled for Highlight.js 11.7.0 */ +;"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=hljs);/*! `reasonml` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const n="~?[a-z$_][0-9a-zA-Z$_]*",a="`?[A-Z$_][0-9a-zA-Z$_]*",s="("+["||","++","**","+.","*","/","*.","/.","..."].map((e=>e.split("").map((e=>"\\"+e)).join(""))).join("|")+"|\\|>|&&|==|===)",i="\\s+"+s+"\\s+",r={ +keyword:"and as asr assert begin class constraint do done downto else end exception external for fun function functor if in include inherit initializer land lazy let lor lsl lsr lxor match method mod module mutable new nonrec object of open or private rec sig struct then to try type val virtual when while with", +built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ", +literal:"true false" +},l="\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",t={ +className:"number",relevance:0,variants:[{begin:l},{begin:"\\(-"+l+"\\)"}]},c={ +className:"operator",relevance:0,begin:s},o=[{className:"identifier", +relevance:0,begin:n},c,t],g=[e.QUOTE_STRING_MODE,c,{className:"module", +begin:"\\b"+a,returnBegin:!0,relevance:0,end:".",contains:[{ +className:"identifier",begin:a,relevance:0}]}],b=[{className:"module", +begin:"\\b"+a,returnBegin:!0,end:".",relevance:0,contains:[{ +className:"identifier",begin:a,relevance:0}]}],m={className:"function", +relevance:0,keywords:r,variants:[{begin:"\\s(\\(\\.?.*?\\)|"+n+")\\s*=>", +end:"\\s*=>",returnBegin:!0,relevance:0,contains:[{className:"params", +variants:[{begin:n},{ +begin:"~?[a-z$_][0-9a-zA-Z$_]*(\\s*:\\s*[a-z$_][0-9a-z$_]*(\\(\\s*('?[a-z$_][0-9a-z$_]*\\s*(,'?[a-z$_][0-9a-z$_]*\\s*)*)?\\))?){0,2}" +},{begin:/\(\s*\)/}]}]},{begin:"\\s\\(\\.?[^;\\|]*\\)\\s*=>",end:"\\s=>", +returnBegin:!0,relevance:0,contains:[{className:"params",relevance:0,variants:[{ +begin:n,end:"(,|\\n|\\))",relevance:0,contains:[c,{className:"typing",begin:":", +end:"(,|\\n)",returnBegin:!0,relevance:0,contains:b}]}]}]},{ +begin:"\\(\\.\\s"+n+"\\)\\s*=>"}]};g.push(m);const d={className:"constructor", +begin:a+"\\(",end:"\\)",illegal:"\\n",keywords:r, +contains:[e.QUOTE_STRING_MODE,c,{className:"params",begin:"\\b"+n}]},u={ +className:"pattern-match",begin:"\\|",returnBegin:!0,keywords:r,end:"=>", +relevance:0,contains:[d,c,{relevance:0,className:"constructor",begin:a}]},v={ +className:"module-access",keywords:r,returnBegin:!0,variants:[{ +begin:"\\b("+a+"\\.)+"+n},{begin:"\\b("+a+"\\.)+\\(",end:"\\)",returnBegin:!0, +contains:[m,{begin:"\\(",end:"\\)",relevance:0,skip:!0}].concat(g)},{ +begin:"\\b("+a+"\\.)+\\{",end:/\}/}],contains:g};return b.push(v),{ +name:"ReasonML",aliases:["re"],keywords:r,illegal:"(:-|:=|\\$\\{|\\+=)", +contains:[e.COMMENT("/\\*","\\*/",{illegal:"^(#,\\/\\/)"}),{ +className:"character",begin:"'(\\\\[^']+|[^'])'",illegal:"\\n",relevance:0 +},e.QUOTE_STRING_MODE,{className:"literal",begin:"\\(\\)",relevance:0},{ +className:"literal",begin:"\\[\\|",end:"\\|\\]",relevance:0,contains:o},{ +className:"literal",begin:"\\[",end:"\\]",relevance:0,contains:o},d,{ +className:"operator",begin:i,illegal:"--\x3e",relevance:0 +},t,e.C_LINE_COMMENT_MODE,u,m,{className:"module-def", +begin:"\\bmodule\\s+"+n+"\\s+"+a+"\\s+=\\s+\\{",end:/\}/,returnBegin:!0, +keywords:r,relevance:0,contains:[{className:"module",relevance:0,begin:a},{ +begin:/\{/,end:/\}/,relevance:0,skip:!0}].concat(g)},v]}}})() +;hljs.registerLanguage("reasonml",e)})();/*! `javascript` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict" +;const e="[A-Za-z$_][0-9A-Za-z$_]*",n=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends"],a=["true","false","null","undefined","NaN","Infinity"],t=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],s=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],r=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],c=["arguments","this","super","console","window","document","localStorage","module","global"],i=[].concat(r,t,s) +;return o=>{const l=o.regex,b=e,d={begin:/<[A-Za-z0-9\\._:-]+/, +end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(e,n)=>{ +const a=e[0].length+e.index,t=e.input[a] +;if("<"===t||","===t)return void n.ignoreMatch();let s +;">"===t&&(((e,{after:n})=>{const a="",M={ +match:[/const|var|let/,/\s+/,b,/\s*/,/=\s*/,/(async\s*)?/,l.lookahead(C)], +keywords:"async",className:{1:"keyword",3:"title.function"},contains:[S]} +;return{name:"Javascript",aliases:["js","jsx","mjs","cjs"],keywords:g,exports:{ +PARAMS_CONTAINS:p,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/, +contains:[o.SHEBANG({label:"shebang",binary:"node",relevance:5}),{ +label:"use_strict",className:"meta",relevance:10, +begin:/^\s*['"]use (strict|asm)['"]/ +},o.APOS_STRING_MODE,o.QUOTE_STRING_MODE,y,N,_,h,{match:/\$\d+/},E,R,{ +className:"attr",begin:b+l.lookahead(":"),relevance:0},M,{ +begin:"("+o.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*", +keywords:"return throw case",relevance:0,contains:[h,o.REGEXP_MODE,{ +className:"function",begin:C,returnBegin:!0,end:"\\s*=>",contains:[{ +className:"params",variants:[{begin:o.UNDERSCORE_IDENT_RE,relevance:0},{ +className:null,begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0, +excludeEnd:!0,keywords:g,contains:p}]}]},{begin:/,/,relevance:0},{match:/\s+/, +relevance:0},{variants:[{begin:"<>",end:""},{ +match:/<[A-Za-z0-9\\._:-]+\s*\/>/},{begin:d.begin, +"on:begin":d.isTrulyOpeningTag,end:d.end}],subLanguage:"xml",contains:[{ +begin:d.begin,end:d.end,skip:!0,contains:["self"]}]}]},O,{ +beginKeywords:"while if switch catch for"},{ +begin:"\\b(?!function)"+o.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{", +returnBegin:!0,label:"func.def",contains:[S,o.inherit(o.TITLE_MODE,{begin:b, +className:"title.function"})]},{match:/\.\.\./,relevance:0},x,{match:"\\$"+b, +relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"}, +contains:[S]},k,{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/, +className:"variable.constant"},w,T,{match:/\$[(.]/}]}}})() +;hljs.registerLanguage("javascript",e)})();/*! `sql` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const r=e.regex,t=e.COMMENT("--","$"),n=["true","false","unknown"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],i=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],s=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],o=i,c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year","add","asc","collation","desc","final","first","last","view"].filter((e=>!i.includes(e))),l={ +begin:r.concat(/\b/,r.either(...o),/\s*\(/),relevance:0,keywords:{built_in:o}} +;return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{ +$pattern:/\b[\w\.]+/,keyword:((e,{exceptions:r,when:t}={})=>{const n=t +;return r=r||[],e.map((e=>e.match(/\|\d+$/)||r.includes(e)?e:n(e)?e+"|0":e)) +})(c,{when:e=>e.length<3}),literal:n,type:a, +built_in:["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"] +},contains:[{begin:r.either(...s),relevance:0,keywords:{$pattern:/[\w\.]+/, +keyword:c.concat(s),literal:n,type:a}},{className:"type", +begin:r.either("double precision","large object","with timezone","without timezone") +},l,{className:"variable",begin:/@[a-z0-9]+/},{className:"string",variants:[{ +begin:/'/,end:/'/,contains:[{begin:/''/}]}]},{begin:/"/,end:/"/,contains:[{ +begin:/""/}]},e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,t,{className:"operator", +begin:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0}]}}})() +;hljs.registerLanguage("sql",e)})();/*! `bash` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const s=e.regex,t={},n={begin:/\$\{/, +end:/\}/,contains:["self",{begin:/:-/,contains:[t]}]};Object.assign(t,{ +className:"variable",variants:[{ +begin:s.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},n]});const a={ +className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i={ +begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/, +end:/(\w+)/,className:"string"})]}},c={className:"string",begin:/"/,end:/"/, +contains:[e.BACKSLASH_ESCAPE,t,a]};a.contains.push(c);const o={begin:/\$?\(\(/, +end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,t] +},r=e.SHEBANG({binary:"(fish|bash|zsh|sh|csh|ksh|tcsh|dash|scsh)",relevance:10 +}),l={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0, +contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0};return{ +name:"Bash",aliases:["sh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/, +keyword:["if","then","else","elif","fi","for","while","in","do","done","case","esac","function"], +literal:["true","false"], +built_in:["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset","alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","type","typeset","ulimit","unalias","set","shopt","autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp","chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"] +},contains:[r,e.SHEBANG(),l,o,e.HASH_COMMENT_MODE,i,{match:/(\/[a-z._-]+)+/},c,{ +className:"",begin:/\\"/},{className:"string",begin:/'/,end:/'/},t]}}})() +;hljs.registerLanguage("bash",e)})();/*! `shell` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var s=(()=>{"use strict";return s=>({name:"Shell Session", +aliases:["console","shellsession"],contains:[{className:"meta.prompt", +begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/, +subLanguage:"bash"}}]})})();hljs.registerLanguage("shell",s)})();/*! `plaintext` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var t=(()=>{"use strict";return t=>({name:"Plain text", +aliases:["text","txt"],disableAutodetect:!0})})() +;hljs.registerLanguage("plaintext",t)})();/*! `graphql` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const a=e.regex;return{name:"GraphQL", +aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{ +keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"], +literal:["true","false","null"]}, +contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{ +scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation", +begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/, +end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{ +scope:"symbol",begin:a.concat(/[_A-Za-z][_0-9A-Za-z]*/,a.lookahead(/\s*:/)), +relevance:0}],illegal:[/[;<']/,/BEGIN/]}}})();hljs.registerLanguage("graphql",e) +})();/*! `ocaml` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>({name:"OCaml",aliases:["ml"], +keywords:{$pattern:"[a-z_]\\w*!?", +keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value", +built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref", +literal:"true false"},illegal:/\/\/|>>/,contains:[{className:"literal", +begin:"\\[(\\|\\|)?\\]|\\(\\)",relevance:0},e.COMMENT("\\(\\*","\\*\\)",{ +contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{ +className:"type",begin:"`[A-Z][\\w']*"},{className:"type", +begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*",relevance:0 +},e.inherit(e.APOS_STRING_MODE,{className:"string",relevance:0 +}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"number", +begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)", +relevance:0},{begin:/->/}]})})();hljs.registerLanguage("ocaml",e)})();/*! `json` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const a=["true","false","null"],n={ +scope:"literal",beginKeywords:a.join(" ")};return{name:"JSON",keywords:{ +literal:a},contains:[{className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/, +relevance:1.01},{match:/[{}[\],:]/,className:"punctuation",relevance:0 +},e.QUOTE_STRING_MODE,n,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE], +illegal:"\\S"}}})();hljs.registerLanguage("json",e)})();/*! `python` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{ +const n=e.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={ +$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i, +built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"], +literal:["__debug__","Ellipsis","False","None","NotImplemented","True"], +type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"] +},t={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/, +end:/\}/,keywords:s,illegal:/#/},l={begin:/\{\{/,relevance:0},b={ +className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{ +begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/, +contains:[e.BACKSLASH_ESCAPE,t],relevance:10},{ +begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/, +contains:[e.BACKSLASH_ESCAPE,t],relevance:10},{ +begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/, +contains:[e.BACKSLASH_ESCAPE,t,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/, +end:/"""/,contains:[e.BACKSLASH_ESCAPE,t,l,r]},{begin:/([uU]|[rR])'/,end:/'/, +relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{ +begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/, +end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/, +contains:[e.BACKSLASH_ESCAPE,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/, +contains:[e.BACKSLASH_ESCAPE,l,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] +},o="[0-9](_?[0-9])*",c=`(\\b(${o}))?\\.(${o})|\\b(${o})\\.`,d="\\b|"+i.join("|"),g={ +className:"number",relevance:0,variants:[{ +begin:`(\\b(${o})|(${c}))[eE][+-]?(${o})[jJ]?(?=${d})`},{begin:`(${c})[jJ]?`},{ +begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{ +begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})` +},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${o})[jJ](?=${d})` +}]},p={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:s, +contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={ +className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/, +end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s, +contains:["self",t,g,b,e.HASH_COMMENT_MODE]}]};return r.contains=[b,g,t],{ +name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s, +illegal:/(<\/|->|\?)|=>/,contains:[t,g,{begin:/\bself\b/},{beginKeywords:"if", +relevance:0},b,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{ +1:"keyword",3:"title.function"},contains:[m]},{variants:[{ +match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}], +scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{ +className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,b]}]}}})() +;hljs.registerLanguage("python",e)})();/*! `xml` grammar compiled for Highlight.js 11.7.0 */ (()=>{var e=(()=>{"use strict";return e=>{ const a=e.regex,n=a.concat(/[\p{L}_]/u,a.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),s={ className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},t={begin:/\s/, @@ -360,102 +591,44 @@ contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},{ begin:"^[-\\*]{3,}",end:"$"},a,{begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{ className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{ className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]}]}}})() -;hljs.registerLanguage("markdown",e)})();/*! `plaintext` grammar compiled for Highlight.js 11.7.0 */ -(()=>{var t=(()=>{"use strict";return t=>({name:"Plain text", -aliases:["text","txt"],disableAutodetect:!0})})() -;hljs.registerLanguage("plaintext",t)})();/*! `ocaml` grammar compiled for Highlight.js 11.7.0 */ -(()=>{var e=(()=>{"use strict";return e=>({name:"OCaml",aliases:["ml"], -keywords:{$pattern:"[a-z_]\\w*!?", -keyword:"and as assert asr begin class constraint do done downto else end exception external for fun function functor if in include inherit! inherit initializer land lazy let lor lsl lsr lxor match method!|10 method mod module mutable new object of open! open or private rec sig struct then to try type val! val virtual when while with parser value", -built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 string unit in_channel out_channel ref", -literal:"true false"},illegal:/\/\/|>>/,contains:[{className:"literal", -begin:"\\[(\\|\\|)?\\]|\\(\\)",relevance:0},e.COMMENT("\\(\\*","\\*\\)",{ -contains:["self"]}),{className:"symbol",begin:"'[A-Za-z_](?!')[\\w']*"},{ -className:"type",begin:"`[A-Z][\\w']*"},{className:"type", -begin:"\\b[A-Z][\\w']*",relevance:0},{begin:"[a-z_]\\w*'[\\w']*",relevance:0 -},e.inherit(e.APOS_STRING_MODE,{className:"string",relevance:0 -}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null}),{className:"number", -begin:"\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)", -relevance:0},{begin:/->/}]})})();hljs.registerLanguage("ocaml",e)})();/*! `python` grammar compiled for Highlight.js 11.7.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n=e.regex,a=/[\p{XID_Start}_]\p{XID_Continue}*/u,i=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={ -$pattern:/[A-Za-z]\w+|__\w+__/,keyword:i, -built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"], -literal:["__debug__","Ellipsis","False","None","NotImplemented","True"], -type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"] -},t={className:"meta",begin:/^(>>>|\.\.\.) /},r={className:"subst",begin:/\{/, -end:/\}/,keywords:s,illegal:/#/},l={begin:/\{\{/,relevance:0},b={ -className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{ -begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/, -contains:[e.BACKSLASH_ESCAPE,t],relevance:10},{ -begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/, -contains:[e.BACKSLASH_ESCAPE,t],relevance:10},{ -begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/, -contains:[e.BACKSLASH_ESCAPE,t,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/, -end:/"""/,contains:[e.BACKSLASH_ESCAPE,t,l,r]},{begin:/([uU]|[rR])'/,end:/'/, -relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{ -begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/, -end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/, -contains:[e.BACKSLASH_ESCAPE,l,r]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/, -contains:[e.BACKSLASH_ESCAPE,l,r]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE] -},o="[0-9](_?[0-9])*",c=`(\\b(${o}))?\\.(${o})|\\b(${o})\\.`,d="\\b|"+i.join("|"),g={ -className:"number",relevance:0,variants:[{ -begin:`(\\b(${o})|(${c}))[eE][+-]?(${o})[jJ]?(?=${d})`},{begin:`(${c})[jJ]?`},{ -begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${d})`},{ -begin:`\\b0[bB](_?[01])+[lL]?(?=${d})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${d})` -},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${d})`},{begin:`\\b(${o})[jJ](?=${d})` -}]},p={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:s, -contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},m={ -className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/, -end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s, -contains:["self",t,g,b,e.HASH_COMMENT_MODE]}]};return r.contains=[b,g,t],{ -name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s, -illegal:/(<\/|->|\?)|=>/,contains:[t,g,{begin:/\bself\b/},{beginKeywords:"if", -relevance:0},b,p,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,a],scope:{ -1:"keyword",3:"title.function"},contains:[m]},{variants:[{ -match:[/\bclass/,/\s+/,a,/\s*/,/\(\s*/,a,/\s*\)/]},{match:[/\bclass/,/\s+/,a]}], -scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{ -className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,m,b]}]}}})() -;hljs.registerLanguage("python",e)})();/*! `reasonml` grammar compiled for Highlight.js 11.7.0 */ -(()=>{var e=(()=>{"use strict";return e=>{ -const n="~?[a-z$_][0-9a-zA-Z$_]*",a="`?[A-Z$_][0-9a-zA-Z$_]*",s="("+["||","++","**","+.","*","/","*.","/.","..."].map((e=>e.split("").map((e=>"\\"+e)).join(""))).join("|")+"|\\|>|&&|==|===)",i="\\s+"+s+"\\s+",r={ -keyword:"and as asr assert begin class constraint do done downto else end exception external for fun function functor if in include inherit initializer land lazy let lor lsl lsr lxor match method mod module mutable new nonrec object of open or private rec sig struct then to try type val virtual when while with", -built_in:"array bool bytes char exn|5 float int int32 int64 list lazy_t|5 nativeint|5 ref string unit ", -literal:"true false" -},l="\\b(0[xX][a-fA-F0-9_]+[Lln]?|0[oO][0-7_]+[Lln]?|0[bB][01_]+[Lln]?|[0-9][0-9_]*([Lln]|(\\.[0-9_]*)?([eE][-+]?[0-9_]+)?)?)",t={ -className:"number",relevance:0,variants:[{begin:l},{begin:"\\(-"+l+"\\)"}]},c={ -className:"operator",relevance:0,begin:s},o=[{className:"identifier", -relevance:0,begin:n},c,t],g=[e.QUOTE_STRING_MODE,c,{className:"module", -begin:"\\b"+a,returnBegin:!0,relevance:0,end:".",contains:[{ -className:"identifier",begin:a,relevance:0}]}],b=[{className:"module", -begin:"\\b"+a,returnBegin:!0,end:".",relevance:0,contains:[{ -className:"identifier",begin:a,relevance:0}]}],m={className:"function", -relevance:0,keywords:r,variants:[{begin:"\\s(\\(\\.?.*?\\)|"+n+")\\s*=>", -end:"\\s*=>",returnBegin:!0,relevance:0,contains:[{className:"params", -variants:[{begin:n},{ -begin:"~?[a-z$_][0-9a-zA-Z$_]*(\\s*:\\s*[a-z$_][0-9a-z$_]*(\\(\\s*('?[a-z$_][0-9a-z$_]*\\s*(,'?[a-z$_][0-9a-z$_]*\\s*)*)?\\))?){0,2}" -},{begin:/\(\s*\)/}]}]},{begin:"\\s\\(\\.?[^;\\|]*\\)\\s*=>",end:"\\s=>", -returnBegin:!0,relevance:0,contains:[{className:"params",relevance:0,variants:[{ -begin:n,end:"(,|\\n|\\))",relevance:0,contains:[c,{className:"typing",begin:":", -end:"(,|\\n)",returnBegin:!0,relevance:0,contains:b}]}]}]},{ -begin:"\\(\\.\\s"+n+"\\)\\s*=>"}]};g.push(m);const d={className:"constructor", -begin:a+"\\(",end:"\\)",illegal:"\\n",keywords:r, -contains:[e.QUOTE_STRING_MODE,c,{className:"params",begin:"\\b"+n}]},u={ -className:"pattern-match",begin:"\\|",returnBegin:!0,keywords:r,end:"=>", -relevance:0,contains:[d,c,{relevance:0,className:"constructor",begin:a}]},v={ -className:"module-access",keywords:r,returnBegin:!0,variants:[{ -begin:"\\b("+a+"\\.)+"+n},{begin:"\\b("+a+"\\.)+\\(",end:"\\)",returnBegin:!0, -contains:[m,{begin:"\\(",end:"\\)",relevance:0,skip:!0}].concat(g)},{ -begin:"\\b("+a+"\\.)+\\{",end:/\}/}],contains:g};return b.push(v),{ -name:"ReasonML",aliases:["re"],keywords:r,illegal:"(:-|:=|\\$\\{|\\+=)", -contains:[e.COMMENT("/\\*","\\*/",{illegal:"^(#,\\/\\/)"}),{ -className:"character",begin:"'(\\\\[^']+|[^'])'",illegal:"\\n",relevance:0 -},e.QUOTE_STRING_MODE,{className:"literal",begin:"\\(\\)",relevance:0},{ -className:"literal",begin:"\\[\\|",end:"\\|\\]",relevance:0,contains:o},{ -className:"literal",begin:"\\[",end:"\\]",relevance:0,contains:o},d,{ -className:"operator",begin:i,illegal:"--\x3e",relevance:0 -},t,e.C_LINE_COMMENT_MODE,u,m,{className:"module-def", -begin:"\\bmodule\\s+"+n+"\\s+"+a+"\\s+=\\s+\\{",end:/\}/,returnBegin:!0, -keywords:r,relevance:0,contains:[{className:"module",relevance:0,begin:a},{ -begin:/\{/,end:/\}/,relevance:0,skip:!0}].concat(g)},v]}}})() -;hljs.registerLanguage("reasonml",e)})(); \ No newline at end of file +;hljs.registerLanguage("markdown",e)})();/*! `c` grammar compiled for Highlight.js 11.7.0 */ +(()=>{var e=(()=>{"use strict";return e=>{const n=e.regex,t=e.COMMENT("//","$",{ +contains:[{begin:/\\\n/}] +}),s="[a-zA-Z_]\\w*::",a="(decltype\\(auto\\)|"+n.optional(s)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",r={ +className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{ +match:/\batomic_[a-z]{3,6}\b/}]},i={className:"string",variants:[{ +begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{ +begin:"(u8?|U|L)?'(\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)|.)", +end:"'",illegal:"."},e.END_SAME_AS_BEGIN({ +begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},l={ +className:"number",variants:[{begin:"\\b(0b[01']+)"},{ +begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)" +},{ +begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)" +}],relevance:0},o={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{ +keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include" +},contains:[{begin:/\\\n/,relevance:0},e.inherit(i,{className:"string"}),{ +className:"string",begin:/<.*?>/},t,e.C_BLOCK_COMMENT_MODE]},c={ +className:"title",begin:n.optional(s)+e.IDENT_RE,relevance:0 +},d=n.optional(s)+e.IDENT_RE+"\\s*\\(",u={ +keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"], +type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal128","const","static","complex","bool","imaginary"], +literal:"true false NULL", +built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr" +},g=[o,r,t,e.C_BLOCK_COMMENT_MODE,l,i],m={variants:[{begin:/=/,end:/;/},{ +begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}], +keywords:u,contains:g.concat([{begin:/\(/,end:/\)/,keywords:u, +contains:g.concat(["self"]),relevance:0}]),relevance:0},p={ +begin:"("+a+"[\\*&\\s]+)+"+d,returnBegin:!0,end:/[{;=]/,excludeEnd:!0, +keywords:u,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:"decltype\\(auto\\)", +keywords:u,relevance:0},{begin:d,returnBegin:!0,contains:[e.inherit(c,{ +className:"title.function"})],relevance:0},{relevance:0,match:/,/},{ +className:"params",begin:/\(/,end:/\)/,keywords:u,relevance:0, +contains:[t,e.C_BLOCK_COMMENT_MODE,i,l,r,{begin:/\(/,end:/\)/,keywords:u, +relevance:0,contains:["self",t,e.C_BLOCK_COMMENT_MODE,i,l,r]}] +},r,t,e.C_BLOCK_COMMENT_MODE,o]};return{name:"C",aliases:["h"],keywords:u, +disableAutodetect:!0,illegal:"=]/,contains:[{ +beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:o, +strings:i,keywords:u}}}})();hljs.registerLanguage("c",e)})(); diff --git a/doc/odoc.support/odoc.css b/doc/odoc.support/odoc.css index 8b0ed5a..15240b5 100644 --- a/doc/odoc.support/odoc.css +++ b/doc/odoc.support/odoc.css @@ -1,19 +1,108 @@ @charset "UTF-8"; /* Copyright (c) 2016 The odoc contributors. All rights reserved. Distributed under the ISC license, see terms at the end of the file. - odoc 2.2.0 */ + odoc 2.4.3 */ /* Fonts */ -@import url('https://fonts.googleapis.com/css?family=Fira+Mono:400,500'); -@import url('https://fonts.googleapis.com/css?family=Noticia+Text:400,400i,700'); -@import url('https://fonts.googleapis.com/css?family=Fira+Sans:400,400i,500,500i,600,600i,700,700i'); +/* noticia-text-regular - latin */ +@font-face { + font-family: 'Noticia Text'; + font-style: normal; + font-weight: 400; + src: url('fonts/noticia-text-v15-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* noticia-text-italic - latin */ +@font-face { + font-family: 'Noticia Text'; + font-style: italic; + font-weight: 400; + src: url('fonts/noticia-text-v15-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* noticia-text-700 - latin */ +@font-face { + font-family: 'Noticia Text'; + font-style: normal; + font-weight: 700; + src: url('fonts/noticia-text-v15-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-mono-regular - latin */ +@font-face { + font-family: 'Fira Mono'; + font-style: normal; + font-weight: 400; + src: url('fonts/fira-mono-v14-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-mono-500 - latin */ +@font-face { + font-family: 'Fira Mono'; + font-style: normal; + font-weight: 500; + src: url('fonts/fira-mono-v14-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-regular - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 400; + src: url('fonts/fira-sans-v17-latin-regular.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-italic - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: italic; + font-weight: 400; + src: url('fonts/fira-sans-v17-latin-italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-500 - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 500; + src: url('fonts/fira-sans-v17-latin-500.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-500italic - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: italic; + font-weight: 500; + src: url('fonts/fira-sans-v17-latin-500italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-700 - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: normal; + font-weight: 700; + src: url('fonts/fira-sans-v17-latin-700.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + +/* fira-sans-700italic - latin */ +@font-face { + font-family: 'Fira Sans'; + font-style: italic; + font-weight: 700; + src: url('fonts/fira-sans-v17-latin-700italic.woff2') format('woff2'); /* Chrome 36+, Opera 23+, Firefox 39+, Safari 12+, iOS 10+ */ +} + :root, .light:root { - --main-background: #FFFFFF; + + scroll-padding-top: calc(var(--search-bar-height) + var(--search-padding-top) + 1em); + + --main-background: #FFFFFF; --color: #333333; --link-color: #2C94BD; + --source-color: grey; --anchor-hover: #555; --anchor-color: #d5d5d5; --xref-shadow: #cc6666; @@ -30,13 +119,21 @@ --toc-color: #1F2D3D; --toc-before-color: #777; --toc-background: #f6f8fa; + --toc-background-emph: #ecf0f5; --toc-list-border: #ccc; --spec-summary-border-color: #5c9cf5; + --spec-label-color: green; --spec-summary-background: var(--code-background); --spec-summary-hover-background: #ebeff2; --spec-details-after-background: rgba(0, 4, 15, 0.05); --spec-details-after-shadow: rgba(204, 204, 204, 0.53); + + --search-results-border: #bbb; + --search-results-shadow: #bbb; + + --search-snake: #82aaff; + } .dark:root { @@ -64,6 +161,7 @@ --li-code-color: #999; --toc-color: #777; --toc-background: #252525; + --toc-background-emph: #2a2a2a; --hljs-link: #999; --hljs-keyword: #cda869; @@ -72,6 +170,12 @@ --hljs-type: #ac885b; --hljs-meta: #82aaff; --hljs-variable: #cf6a4c; + + --spec-label-color: lightgreen; + + --search-results-border: #505050; + --search-results-shadow: #404040; + } @media (prefers-color-scheme: dark) { @@ -106,6 +210,7 @@ --toc-color: #777; --toc-before-color: #777; --toc-background: #252525; + --toc-background-emph: #2a2a2a; --toc-list-border: #ccc; --spec-summary-hover-background: #ebeff2; --spec-details-after-background: rgba(0, 4, 15, 0.05); @@ -118,6 +223,12 @@ --hljs-type: #ac885b; --hljs-meta: #82aaff; --hljs-variable: #cf6a4c; + + --spec-label-color: lightgreen; + + --search-results-border: #505050; + --search-results-shadow: #404040; + } } @@ -142,6 +253,7 @@ table { html { font-size: 15px; + scroll-behavior: smooth; } body { @@ -149,24 +261,55 @@ body { background: #FFFFFF; color: var(--color); background-color: var(--main-background); + font-family: "Noticia Text", Georgia, serif; + line-height: 1.5; } body { - max-width: 100ex; - margin-left: calc(10vw + 20ex); - margin-right: 4ex; - margin-top: 20px; - margin-bottom: 50px; - font-family: "Noticia Text", Georgia, serif; - line-height: 1.5; + margin-left: auto; + margin-right: auto; + padding: 0 4ex; +} + +body.odoc { + max-width: 132ex; + display: grid; + grid-template-columns: min-content 1fr; + column-gap: 4ex; + row-gap: 2ex; +} + +body.odoc-src { + margin-right: calc(10vw + 20ex); +} + +.odoc-content { + grid-row: 4; + grid-column: 2; +} + +.odoc-preamble > *:first-child { + /* This make the first thing in the preamble align with the sidebar */ + padding-top: 0; + margin-top: 0; } header { margin-bottom: 30px; } +header.odoc-preamble { + grid-column: 2; + grid-row: 3; +} + nav { - font-family: "Fira Sans", Helvetica, Arial, sans-serif; + font-family: "Fira Sans", sans-serif; +} + +nav.odoc-nav { + grid-column: 2; + grid-row: 2; } /* Basic markup elements */ @@ -238,6 +381,10 @@ a { color: var(--link-color); } +.odoc-src pre a { + color: inherit; +} + a:hover { box-shadow: 0 1px 0 0 var(--link-color); } @@ -289,18 +436,30 @@ a.anchor { box-shadow: 0 1px 0 0 var(--xref-shadow); } +/* Source links float inside preformated text or headings. */ +a.source_link { + float: right; + color: var(--source-color); + font-family: "Fira Sans", sans-serif; + font-size: initial; +} + /* Section and document divisions. Until at least 4.03 many of the modules of the stdlib start at .h7, we restart the sequence there like h2 */ h1, h2, h3, h4, h5, h6, .h7, .h8, .h9, .h10 { - font-family: "Fira Sans", Helvetica, Arial, sans-serif; + font-family: "Fira Sans", sans-serif; font-weight: 400; padding-top: 0.1em; line-height: 1.2; overflow-wrap: break-word; } +.odoc-preamble h1 { + margin-top: 10px; +} + h1 { font-weight: 500; font-size: 2.441em; @@ -348,7 +507,7 @@ h4 { font-size: 1.12em; } -/* Comment delimiters, hidden but accessible to screen readers and +/* Comment delimiters, hidden but accessible to screen readers and selected for copy/pasting */ /* Taken from bootstrap */ @@ -368,36 +527,36 @@ h4 { /* Preformatted and code */ tt, code, pre { - font-family: "Fira Mono", courier; + font-family: "Fira Mono", monospace; font-weight: 400; } -pre { +.odoc pre { padding: 0.1em; border: 1px solid var(--pre-border-color); border-radius: 5px; overflow-x: auto; } -p code, -li code { +.odoc p code, +.odoc li code { background-color: var(--li-code-background); color: var(--li-code-color); border-radius: 3px; padding: 0 0.3ex; } -p a > code { +p a > code, li a > code { color: var(--link-color); } -code { +.odoc code { white-space: pre-wrap; } /* Code blocks (e.g. Examples) */ -pre code { +.odoc pre code { font-size: 0.893rem; } @@ -419,6 +578,10 @@ pre code { padding: 0.35em 0.5em; } +.spec .label, .spec .optlabel { + color: var(--spec-label-color); +} + li:not(:last-child) > .def-doc { margin-bottom: 15px; } @@ -434,10 +597,10 @@ div.odoc-spec,.odoc-include { .spec.type .variant, .spec.type .record { margin-left: 2ch; +} + +.spec.type li.variant, .spec.type li.record { list-style: none; - display: flex; - flex-wrap: wrap; - row-gap: 4px; } .spec.type .record > code, .spec.type .variant > code { @@ -454,9 +617,8 @@ div.odoc-spec,.odoc-include { padding: 0.25em 0.5em; margin-left: 10%; border-radius: 3px; - flex-grow:1; background: var(--main-background); - box-shadow: 2px 2px 4px lightgrey; + box-shadow: 1px 1px 2px lightgrey; } div.def { @@ -536,6 +698,12 @@ td.def-doc *:first-child { .at-tags li { padding-left: 3ex; text-indent: -3ex; } .at-tags .at-tag { text-transform: capitalize } +/* Alert emoji */ + +.alert::before, .deprecated::before { + content: '⚠️ '; +} + /* Lists of modules */ .modules { list-style-type: none; margin-left: -3ex; } @@ -618,19 +786,32 @@ td.def-doc *:first-child { line-height: 1.2; } +/* When a search bar is present, we need the sticky sidebar to be a bit lower, + so `top` is higher */ + +.odoc-search + * + .odoc-toc { + --toc-top: calc(var(--search-bar-height) + var(--search-padding-top) + 20px); + max-height: calc(100vh - 2 * var(--toc-top)); + top: var(--toc-top) +} + .odoc-toc { - position: fixed; - top: 0px; - bottom: 0px; - left: 0px; - max-width: 30ex; - min-width: 26ex; - width: 20%; + --toc-top: 20px; + width: 28ex; background: var(--toc-background); overflow: auto; color: var(--toc-color); padding-left: 2ex; padding-right: 2ex; + grid-row-start: 3; + grid-row-end: 5; + grid-column: 1; + height: fit-content; + border: solid 1px var(--border); + border-radius: 5px; + position:sticky; + max-height: calc(100vh - 2 * var(--toc-top)); + top: var(--toc-top) } .odoc-toc ul li a { @@ -638,15 +819,287 @@ td.def-doc *:first-child { font-size: 0.95em; color: var(--color); font-weight: 400; - line-height: 1.6em; + line-height: 1.2em; display: block; } -.odoc-toc ul li a:hover { +.odoc-sidebar ul li a:hover { box-shadow: none; text-decoration: underline; } +:root { + --search-bar-height: 25px; + --search-padding-top: 1rem; +} + +.odoc-search { + position: sticky; + top: 0; + background: var(--main-background); + /* This amounts to fit-content when the search is not active, but when you + have the search results displayed, you do not want the height of the search + container to change. */ + height: calc(var(--search-bar-height) + var(--search-padding-top)); + width: 100%; + padding-top: var(--search-padding-top); + z-index: 1; + grid-row: 1; + grid-column-start: 1; + grid-column-end: 3; +} + + +.odoc-search .search-inner { + width: 100%; + position: relative; + left: 0; + display: grid; + /* The second column is for the search snake, which has 0 width */ + grid-template-columns: 1fr 0fr; + grid-row-gap: 1rem; + /* The second row is for the search results. It has a width, but only */ + grid-template-rows: min-content 0px; + background: transparent; +} + +.odoc-search .search-bar { + position: relative; + z-index: 2; + font-size: 1em; + transition: font-size 0.3s; + box-shadow: 0px 0px 0.2rem 0.3em var(--main-background); + height: var(--search-bar-height); +} + +.odoc-search:focus-within .search-bar { + font-size: 1.1em; +} + +.odoc-search:not(:focus-within) .search-result { + display: none; +} + +.odoc-search .search-result:empty { + display: none; +} + +.odoc-search .search-result { + grid-row: 2; + background: var(--toc-background); + position: absolute; + left: 0; + right: 0; + border: solid; + border-color: var(--search-results-border); + border-width: 1px; + border-radius: 6px; + box-shadow: 0 3px 10px 2px var(--search-results-shadow), 0 0 3px 4px var(--main-background), 0px -1rem 0px 0px var(--main-background); + /* Works better on smallish screens with this */ + max-height: calc(min(40rem, 50vh)); + overflow-y: auto; +} + +.search-bar { + /* inputs are of fixed size by default, even if you display:block them */ + width: 100%; +} + + +.odoc-search .search-no-result { + color: var(--color); + border-bottom: var(--search-results-border) solid 1px; + background-color: inherit; + outline: 0; + padding: 10px; + padding-right: 0.5rem; +} + +.search-bar-container { + display: flex; + align-items: stretch; + border-bottom: 1rem solid var(--main-background); +} + +.search-snake { + grid-row: 1; + grid-column: 2; + display: flex; + align-items: center; + width: 0; + z-index: 2; + position: relative; + left: 0; + margin-top: 4px; + margin-bottom: 4px; + /* Otherwise the search snake flickers for very fast searches. */ + transition: opacity 0.2s; + opacity: 0; +} + +.search-snake.search-busy { + opacity: 1; +} + +.search-snake:before { + content: " "; + display: block; + aspect-ratio: 1 / 1; + height: 100%; + margin-right: 4px; + border-radius: 50%; + border: 3px solid #aaa; + border-color: var(--search-snake) transparent var(--search-snake) transparent; + animation: search-snake 1.2s linear infinite; + position: absolute; + right: 0; +} + +@keyframes search-snake { + 0% { + transform: rotate(0deg); + } + + 100% { + transform: rotate(360deg); + } +} + +:root { + --kind-font-size-factor: 0.8; +} + +.odoc-search .search-entry { + color: var(--color); + display: grid; + /* Possible kinds are the following : + "doc" "type" "mod" "exn" "class" "meth" "cons" "sig" "cons" "field" "val" + and "ext". + As the longest is 5 characters (and the font monospace), we give 5 + character size to the column. However the font used for kind is a little + smaller, so we adjust by this factor. + */ + grid-template-columns: [kinds] calc(var(--kind-font-size-factor) * 5ch) [titles] 1fr; + column-gap: 0.5rem; + border-bottom: var(--search-results-border) solid 1px; + background-color: inherit; + outline: 0; + padding: 0.4rem 0.4rem 0.7rem 0.7rem; +} +.odoc-search .search-entry p { + margin: 0; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; +} + +.odoc-search .search-entry:focus-visible { + box-shadow: none; + background-color: var(--target-background); +} + +.odoc-search .search-entry:hover { + box-shadow: none; + background-color: var(--toc-background-emph); +} + +.odoc-search .search-entry .entry-kind { + grid-row: 1/2; + grid-column: 1/2; + line-height: 1.4rem; + font-size: calc(var(--kind-font-size-factor) * 1em); + font-weight: bold; + text-align: right; + position: relative; + bottom: 0; +} + +.odoc-search .search-entry pre { + border: none; + margin: 0; +} + +.odoc-search .search-entry pre code { + font-size: 1em; + background-color: var(--li-code-background); + color: var(--li-code-color); + border-radius: 3px; + padding: 0 0.3ex; +} + +.odoc-search .search-entry .entry-title { + width: 100%; + display: block; + grid-column: 2/2; + grid-row: 1/2; + align-self: end; + line-height: 1.4rem; + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +.odoc-search .entry-name { + font-weight: bold; +} + +.odoc-search .prefix-name { + font-weight: bold; +} + +.odoc-search .search-entry .prefix-name { + opacity: 0.7; +} + +.odoc-search .entry-rhs { + white-space: nowrap; +} + +.odoc-search .search-entry .entry-content { + flex-grow: 1; + flex-shrink: 1; + min-width: 0; +} + +.odoc-search .search-entry .entry-comment { + max-height: 1.5em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + font-size: 0.95em; + grid-row: 2/2; + grid-column: 2/2; +} + +.odoc-search .search-entry .entry-comment ul { + white-space: nowrap; + display: inline; +} + +.odoc-search .search-entry .entry-comment li { + display: inline; + white-space: nowrap; +} + +.odoc-search .search-entry .entry-comment ul>li::before { + content: '•'; +} + +.odoc-search .search-entry .entry-comment div { + display: inline; + white-space: nowrap; +} + +.odoc-search .search-entry .entry-comment p { + display: inline; + white-space: nowrap; +} + +.odoc-search .search-entry .entry-comment code { + display: inline; + white-space: nowrap; +} + /* First level titles */ .odoc-toc>ul>li>a { @@ -655,6 +1108,7 @@ td.def-doc *:first-child { .odoc-toc li ul { margin: 0px; + padding-top: 0.25em; } .odoc-toc ul { @@ -662,8 +1116,9 @@ td.def-doc *:first-child { } .odoc-toc ul li { - margin: 0; + padding: 0.25em 0; } + .odoc-toc>ul>li { margin-bottom: 0.3em; } @@ -674,12 +1129,35 @@ td.def-doc *:first-child { padding-left: 12px; } +/* Tables */ + +.odoc-table { + margin: 1em; +} + +.odoc-table td, +.odoc-table th { + padding-left: 0.5em; + padding-right: 0.5em; + border: 1px solid black; +} + +.odoc-table th { + font-weight: bold; +} + /* Mobile adjustements. */ -@media only screen and (max-width: 95ex) { - body.odoc { +@media only screen and (max-width: 110ex) { + body { margin: 2em; + padding: 0; } + + body.odoc { + display: block; + } + .odoc-toc { position: static; width: auto; @@ -699,11 +1177,53 @@ td.def-doc *:first-child { color: black; background: white; } + body nav:first-child { visibility: hidden; } } +/* Source code. */ + +.source_container { + display: flex; +} + +.source_line_column { + padding-right: 0.5em; + text-align: right; + background: #eee8d5; +} + +.source_line { + padding: 0 1em; +} + +.source_code { + flex-grow: 1; + background: #fdf6e3; + padding: 0 0.3em; + color: #657b83; +} + +/* Source directories */ + +.odoc-directory::before { + content: "📁"; + margin: 0.3em; + font-size: 1.3em; +} + +.odoc-file::before { + content: "📄"; + margin: 0.3em; + font-size: 1.3em; +} + +.odoc-folder-list { + list-style: none; +} + /* Syntax highlighting (based on github-gist) */ .hljs { @@ -777,6 +1297,85 @@ td.def-doc *:first-child { text-decoration: underline; } +.VAL, +.TYPE, +.LET, +.REC, +.IN, +.OPEN, +.NONREC, +.MODULE, +.METHOD, +.LETOP, +.INHERIT, +.INCLUDE, +.FUNCTOR, +.EXTERNAL, +.CONSTRAINT, +.ASSERT, +.AND, +.END, +.CLASS, +.STRUCT, +.SIG { + color: #859900; + ; +} + +.WITH, +.WHILE, +.WHEN, +.VIRTUAL, +.TRY, +.TO, +.THEN, +.PRIVATE, +.OF, +.NEW, +.MUTABLE, +.MATCH, +.LAZY, +.IF, +.FUNCTION, +.FUN, +.FOR, +.EXCEPTION, +.ELSE, +.TO, +.DOWNTO, +.DO, +.DONE, +.BEGIN, +.AS { + color: #cb4b16; +} + +.TRUE, +.FALSE { + color: #b58900; +} + +.failwith, +.INT, +.SEMISEMI, +.LIDENT { + color: #2aa198; +} + +.STRING, +.CHAR, +.UIDENT { + color: #b58900; +} + +.DOCSTRING { + color: #268bd2; +} + +.COMMENT { + color: #93a1a1; +} + /*--------------------------------------------------------------------------- Copyright (c) 2016 The odoc contributors @@ -791,4 +1390,4 @@ td.def-doc *:first-child { WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ---------------------------------------------------------------------------*/ + ---------------------------------------------------------------------------*/ \ No newline at end of file diff --git a/doc/odoc.support/odoc_search.js b/doc/odoc.support/odoc_search.js new file mode 100644 index 0000000..0dc659d --- /dev/null +++ b/doc/odoc.support/odoc_search.js @@ -0,0 +1,66 @@ +/* The browsers interpretation of the CORS origin policy prevents to run + webworkers from javascript files fetched from the file:// protocol. This hack + is to workaround this restriction. */ +function createWebWorker() { + var searchs = search_urls.map((search_url) => { + let parts = document.location.href.split("/"); + parts[parts.length - 1] = search_url; + return '"' + parts.join("/") + '"'; + }); + blobContents = ["importScripts(" + searchs.join(",") + ");"]; + var blob = new Blob(blobContents, { type: "application/javascript" }); + var blobUrl = URL.createObjectURL(blob); + + var worker = new Worker(blobUrl); + URL.revokeObjectURL(blobUrl); + + return worker; +} + +var worker; +var waiting = 0; + +function wait() { + waiting = waiting + 1; + document.querySelector(".search-snake").classList.add("search-busy"); +} + +function stop_waiting() { + if (waiting > 0) waiting = waiting - 1; + else waiting = 0; + if (waiting == 0) { + document.querySelector(".search-snake").classList.remove("search-busy"); + } +} + +document.querySelector(".search-bar").addEventListener("focus", (ev) => { + if (typeof worker == "undefined") { + worker = createWebWorker(); + worker.onmessage = (e) => { + stop_waiting(); + let results = e.data; + let search_results = document.querySelector(".search-result"); + search_results.innerHTML = ""; + let f = (entry) => { + let search_result = document.createElement("a"); + search_result.classList.add("search-entry"); + search_result.href = base_url + entry.url; + search_result.innerHTML = entry.html; + search_results.appendChild(search_result); + }; + results.forEach(f); + let search_request = document.querySelector(".search-bar").value; + if (results.length == 0 && search_request != "") { + let no_result = document.createElement("div"); + no_result.classList.add("search-no-result"); + no_result.innerText = "No result..."; + search_results.appendChild(no_result); + } + }; + } +}); + +document.querySelector(".search-bar").addEventListener("input", (ev) => { + wait(); + worker.postMessage(ev.target.value); +});