From 51b06697fa28ec3a8a7063e221e64cf3bc0c82ef Mon Sep 17 00:00:00 2001 From: c-cube Date: Tue, 29 Aug 2023 18:39:53 +0000 Subject: [PATCH] deploy: 2800a3e0a63f35c02cc655d430f3f1480ffc6eb6 --- dev/moonpool/Moonpool/Chan/index.html | 2 +- dev/moonpool/Moonpool/Fork_join/index.html | 13 +- dev/moonpool/Moonpool/Fut/index.html | 2 +- dev/moonpool/Moonpool/Lock/index.html | 2 +- dev/moonpool/Moonpool/Suspend_/index.html | 2 +- .../Make/argument-1-S/Key/Map/index.html | 2 +- dev/ocaml/Backend_var/index.html | 2 +- dev/ocaml/Bigarray/index.html | 14 - dev/ocaml/Btype/TransientTypeMap/index.html | 2 +- dev/ocaml/Btype/TypeMap/index.html | 2 +- dev/ocaml/CamlinternalAtomic/index.html | 2 - dev/ocaml/CamlinternalLazy/index.html | 2 +- dev/ocaml/Clambda_primitives/index.html | 2 +- dev/ocaml/Clflags/index.html | 2 +- .../Closure_conversion_aux/Env/index.html | 2 +- dev/ocaml/Closure_element/Map/index.html | 2 +- dev/ocaml/Closure_element/Set/index.html | 2 +- dev/ocaml/Closure_id/Map/index.html | 2 +- dev/ocaml/Closure_id/Set/index.html | 2 +- dev/ocaml/Closure_origin/Map/index.html | 2 +- dev/ocaml/Closure_origin/Set/index.html | 2 +- dev/ocaml/Cmi_format/index.html | 2 +- dev/ocaml/Cmm/index.html | 2 +- dev/ocaml/Cmm_helpers/index.html | 2 +- dev/ocaml/Cmm_invariants/index.html | 2 +- dev/ocaml/Compilation_unit/Map/index.html | 2 +- dev/ocaml/Compilation_unit/Set/index.html | 2 +- dev/ocaml/Compmisc/index.html | 6 +- dev/ocaml/Condition/index.html | 8 - dev/ocaml/Config/index.html | 2 +- dev/ocaml/Config_boot/index.html | 2 + dev/ocaml/Config_main/index.html | 2 + .../argument-1-Module_name/Map/index.html | 2 +- .../argument-1-Module_name/Set/index.html | 2 +- dev/ocaml/Ctype/index.html | 4 +- dev/ocaml/Domainstate/index.html | 2 +- dev/ocaml/Emitaux/index.html | 6 +- dev/ocaml/Env/index.html | 2 +- dev/ocaml/Export_id/Map/index.html | 2 +- dev/ocaml/Export_id/Set/index.html | 2 +- .../Constant_defining_value/Map/index.html | 2 +- .../Constant_defining_value/Set/index.html | 2 +- dev/ocaml/Ident/Map/index.html | 2 +- dev/ocaml/Ident/Set/index.html | 2 +- dev/ocaml/Ident/index.html | 2 +- dev/ocaml/Identifiable/Make/Map/index.html | 2 +- dev/ocaml/Identifiable/Make/Set/index.html | 2 +- .../Identifiable/module-type-Map/index.html | 2 +- .../Identifiable/module-type-S/Map/index.html | 2 +- .../Identifiable/module-type-S/Set/index.html | 2 +- .../Identifiable/module-type-Set/index.html | 2 +- dev/ocaml/Includemod/FieldMap/index.html | 2 +- dev/ocaml/Instruct/index.html | 2 +- dev/ocaml/Lambda/index.html | 2 +- dev/ocaml/Linear/index.html | 2 +- dev/ocaml/Linkage_name/Map/index.html | 2 +- dev/ocaml/Linkage_name/Set/index.html | 2 +- dev/ocaml/Load_path/Dir/index.html | 2 +- dev/ocaml/Load_path/index.html | 5 +- dev/ocaml/Local_store/index.html | 2 +- dev/ocaml/Location/index.html | 2 +- dev/ocaml/Mach/index.html | 2 +- dev/ocaml/Main_args/Default/Main/index.html | 2 +- .../Main_args/Default/Odoc_args/index.html | 2 +- .../Main_args/Default/Optmain/index.html | 2 +- .../Main_args/Default/Opttopmain/index.html | 2 +- .../Main_args/Default/Topmain/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../argument-1-_/index.html | 2 +- .../module-type-Bytecomp_options/index.html | 2 +- .../module-type-Bytetop_options/index.html | 2 +- .../module-type-Common_options/index.html | 2 +- .../module-type-Compiler_options/index.html | 2 +- .../module-type-Core_options/index.html | 2 +- .../module-type-Ocamldoc_options/index.html | 2 +- .../module-type-Optcomp_options/index.html | 2 +- .../module-type-Opttop_options/index.html | 2 +- .../module-type-Toplevel_options/index.html | 2 +- dev/ocaml/Misc/Stdlib/String/Map/index.html | 2 +- dev/ocaml/Misc/Stdlib/String/Set/index.html | 2 +- dev/ocaml/Misc/Stdlib/String/index.html | 2 +- dev/ocaml/Mutable_variable/Map/index.html | 2 +- dev/ocaml/Mutable_variable/Set/index.html | 2 +- dev/ocaml/Mutex/index.html | 4 - dev/ocaml/Numbers/Float/Map/index.html | 2 +- dev/ocaml/Numbers/Float/Set/index.html | 2 +- dev/ocaml/Numbers/Int/Map/index.html | 2 +- dev/ocaml/Numbers/Int/Set/index.html | 2 +- dev/ocaml/Ocamlmktop_init/index.html | 2 + .../argument-1-_/class-html/index.html | 6 +- .../class-html/index.html | 6 +- .../argument-1-_/class-latex/index.html | 2 +- .../class-latex/index.html | 2 +- .../argument-1-_/class-man/index.html | 2 +- .../class-man/index.html | 2 +- .../argument-1-_/class-texi/index.html | 2 +- .../class-texi/index.html | 2 +- .../Odoc_html/Generator/class-html/index.html | 6 +- dev/ocaml/Odoc_html/class-info/index.html | 2 +- .../class-html/index.html | 6 +- dev/ocaml/Odoc_info/index.html | 4 +- .../Generator/class-latex/index.html | 2 +- .../class-latex/index.html | 2 +- .../Odoc_man/Generator/class-man/index.html | 2 +- dev/ocaml/Odoc_man/class-info/index.html | 2 +- .../class-man/index.html | 2 +- dev/ocaml/Odoc_messages/index.html | 2 +- dev/ocaml/Odoc_sig/index.html | 5 +- .../Odoc_texi/Generator/class-texi/index.html | 2 +- .../class-texi/index.html | 2 +- dev/ocaml/Odoc_to_text/class-info/index.html | 2 +- .../Odoc_to_text/class-to_text/index.html | 2 +- dev/ocaml/Odoc_types/index.html | 2 +- dev/ocaml/Opcodes/index.html | 2 +- dev/ocaml/Parameter/Map/index.html | 2 +- dev/ocaml/Parameter/Set/index.html | 2 +- dev/ocaml/Path/Map/index.html | 2 +- dev/ocaml/Path/Set/index.html | 2 +- dev/ocaml/Persistent_env/index.html | 2 +- dev/ocaml/Predef/index.html | 2 +- dev/ocaml/Projection/Map/index.html | 2 +- dev/ocaml/Projection/Set/index.html | 2 +- dev/ocaml/Reg/Map/index.html | 2 +- dev/ocaml/Reg/Set/index.html | 2 +- .../Reloadgen/class-reload_generic/index.html | 2 +- dev/ocaml/Runtime_events/Callbacks/index.html | 10 + dev/ocaml/Runtime_events/Timestamp/index.html | 2 + dev/ocaml/Runtime_events/index.html | 2 + dev/ocaml/Semaphore/Binary/index.html | 2 - dev/ocaml/Semaphore/Counting/index.html | 2 - dev/ocaml/Semaphore/index.html | 2 - dev/ocaml/Set_of_closures_id/Map/index.html | 2 +- dev/ocaml/Set_of_closures_id/Set/index.html | 2 +- .../Set_of_closures_origin/Map/index.html | 2 +- .../Set_of_closures_origin/Set/index.html | 2 +- dev/ocaml/Shape/Item/Map/index.html | 2 +- dev/ocaml/Shape/Uid/Map/index.html | 2 +- dev/ocaml/Shape/Uid/Set/index.html | 2 +- dev/ocaml/Static_exception/Map/index.html | 2 +- dev/ocaml/Static_exception/Set/index.html | 2 +- dev/ocaml/Stdlib/Arg/index.html | 2 +- dev/ocaml/Stdlib/Array/index.html | 15 +- dev/ocaml/Stdlib/ArrayLabels/index.html | 17 +- dev/ocaml/Stdlib/Atomic/index.html | 2 +- dev/ocaml/Stdlib/Bigarray/index.html | 14 +- dev/ocaml/Stdlib/Buffer/index.html | 2 +- dev/ocaml/Stdlib/Bytes/index.html | 13 +- dev/ocaml/Stdlib/BytesLabels/index.html | 13 +- dev/ocaml/Stdlib/Char/index.html | 2 +- dev/ocaml/Stdlib/Condition/index.html | 31 + dev/ocaml/Stdlib/Domain/DLS/index.html | 2 + dev/ocaml/Stdlib/Domain/index.html | 5 + dev/ocaml/Stdlib/Effect/Deep/index.html | 6 + dev/ocaml/Stdlib/Effect/Shallow/index.html | 7 + dev/ocaml/Stdlib/Effect/index.html | 2 + .../MakeSeeded/argument-1-H/index.html | 2 - .../GenHashTable/MakeSeeded/index.html | 2 - .../Stdlib/Ephemeron/GenHashTable/index.html | 2 - dev/ocaml/Stdlib/Ephemeron/K1/Make/index.html | 2 +- .../K1/MakeSeeded/argument-1-H/index.html | 2 +- .../Stdlib/Ephemeron/K1/MakeSeeded/index.html | 2 +- dev/ocaml/Stdlib/Ephemeron/K1/index.html | 2 +- dev/ocaml/Stdlib/Ephemeron/K2/Make/index.html | 2 +- .../K2/MakeSeeded/argument-1-H1/index.html | 2 +- .../K2/MakeSeeded/argument-2-H2/index.html | 2 +- .../Stdlib/Ephemeron/K2/MakeSeeded/index.html | 2 +- dev/ocaml/Stdlib/Ephemeron/K2/index.html | 2 +- dev/ocaml/Stdlib/Ephemeron/Kn/Make/index.html | 2 +- .../Kn/MakeSeeded/argument-1-H/index.html | 2 +- .../Stdlib/Ephemeron/Kn/MakeSeeded/index.html | 2 +- dev/ocaml/Stdlib/Ephemeron/Kn/index.html | 2 +- dev/ocaml/Stdlib/Ephemeron/index.html | 2 +- .../Stdlib/Ephemeron/module-type-S/index.html | 2 +- .../Ephemeron/module-type-SeededS/index.html | 2 +- dev/ocaml/Stdlib/Filename/index.html | 2 +- dev/ocaml/Stdlib/Float/Array/index.html | 13 +- dev/ocaml/Stdlib/Float/ArrayLabels/index.html | 13 +- dev/ocaml/Stdlib/Format/index.html | 57 +- dev/ocaml/Stdlib/Gc/index.html | 2 +- dev/ocaml/Stdlib/Genlex/index.html | 9 - .../MakeSeeded/argument-1-H/index.html | 2 +- .../Stdlib/Hashtbl/MakeSeeded/index.html | 2 +- dev/ocaml/Stdlib/Hashtbl/index.html | 4 +- .../module-type-SeededHashedType/index.html | 2 +- dev/ocaml/Stdlib/In_channel/index.html | 2 +- dev/ocaml/Stdlib/Int32/index.html | 2 +- dev/ocaml/Stdlib/Int64/index.html | 2 +- dev/ocaml/Stdlib/Lazy/index.html | 4 +- dev/ocaml/Stdlib/List/index.html | 2 +- dev/ocaml/Stdlib/ListLabels/index.html | 2 +- dev/ocaml/Stdlib/Map/Make/index.html | 2 +- dev/ocaml/Stdlib/Map/module-type-S/index.html | 2 +- .../MakeSeeded/argument-1-H/index.html | 2 +- .../MoreLabels/Hashtbl/MakeSeeded/index.html | 2 +- .../Stdlib/MoreLabels/Hashtbl/index.html | 6 +- .../module-type-SeededHashedType/index.html | 2 +- .../Stdlib/MoreLabels/Map/Make/index.html | 2 +- .../MoreLabels/Map/module-type-S/index.html | 2 +- .../Stdlib/MoreLabels/Set/Make/index.html | 2 +- .../MoreLabels/Set/module-type-S/index.html | 2 +- dev/ocaml/Stdlib/Mutex/index.html | 4 + dev/ocaml/Stdlib/Nativeint/index.html | 2 +- dev/ocaml/Stdlib/Obj/Ephemeron/index.html | 2 +- dev/ocaml/Stdlib/Obj/index.html | 2 +- dev/ocaml/Stdlib/Oo/index.html | 2 +- dev/ocaml/Stdlib/Option/index.html | 2 +- dev/ocaml/Stdlib/Pervasives/index.html | 11 - dev/ocaml/Stdlib/Printexc/index.html | 2 +- dev/ocaml/Stdlib/Printf/index.html | 2 +- dev/ocaml/Stdlib/Queue/index.html | 2 +- dev/ocaml/Stdlib/Random/State/index.html | 2 +- dev/ocaml/Stdlib/Random/index.html | 2 +- dev/ocaml/Stdlib/Scanf/Scanning/index.html | 2 +- dev/ocaml/Stdlib/Scanf/index.html | 13 +- dev/ocaml/Stdlib/Semaphore/Binary/index.html | 2 + .../Stdlib/Semaphore/Counting/index.html | 2 + dev/ocaml/Stdlib/Semaphore/index.html | 2 + dev/ocaml/Stdlib/Seq/index.html | 2 +- dev/ocaml/Stdlib/Set/Make/index.html | 2 +- dev/ocaml/Stdlib/Set/module-type-S/index.html | 2 +- dev/ocaml/Stdlib/Stack/index.html | 2 +- dev/ocaml/Stdlib/StdLabels/index.html | 2 +- dev/ocaml/Stdlib/Stream/index.html | 2 - dev/ocaml/Stdlib/String/index.html | 4 +- dev/ocaml/Stdlib/StringLabels/index.html | 6 +- dev/ocaml/Stdlib/Sys/index.html | 2 +- dev/ocaml/Stdlib/Weak/index.html | 2 +- dev/ocaml/Stdlib/index.html | 4 +- dev/ocaml/Stdlib__Condition/index.html | 2 + .../index.html | 2 +- .../index.html | 2 +- dev/ocaml/Stdlib__Mutex/index.html | 2 + dev/ocaml/Stdlib__Pervasives/index.html | 2 - dev/ocaml/Stdlib__Semaphore/index.html | 2 + .../Make/argument-1-Id/Map/index.html | 2 +- .../Make/argument-1-Id/Set/index.html | 2 +- .../module-type-S/Id/Map/index.html | 2 +- .../module-type-S/Id/Set/index.html | 2 +- dev/ocaml/Symbol/Map/index.html | 2 +- dev/ocaml/Symbol/Set/index.html | 2 +- dev/ocaml/Syntaxerr/index.html | 2 +- dev/ocaml/Tag/Map/index.html | 2 +- dev/ocaml/Tag/Set/index.html | 2 +- dev/ocaml/Targetint/index.html | 2 +- dev/ocaml/Thread/index.html | 4 +- dev/ocaml/ThreadUnix/index.html | 47 -- dev/ocaml/Toploop/index.html | 2 +- dev/ocaml/Typedtree/index.html | 2 +- dev/ocaml/Typemod/index.html | 1 - dev/ocaml/Types/MethSet/index.html | 2 +- dev/ocaml/Types/Meths/index.html | 2 +- dev/ocaml/Types/VarSet/index.html | 2 +- dev/ocaml/Types/Vars/index.html | 2 +- dev/ocaml/Unix/index.html | 6 +- dev/ocaml/UnixLabels/index.html | 6 +- dev/ocaml/Var_within_closure/Map/index.html | 2 +- dev/ocaml/Var_within_closure/Set/index.html | 2 +- dev/ocaml/Variable/Map/index.html | 2 +- dev/ocaml/Variable/Pair/Map/index.html | 2 +- dev/ocaml/Variable/Pair/Set/index.html | 2 +- dev/ocaml/Variable/Set/index.html | 2 +- dev/ocaml/Warnings/index.html | 2 +- dev/ocaml/X86_ast/index.html | 2 +- dev/ocaml/X86_dsl/D/index.html | 2 +- dev/ocaml/X86_dsl/index.html | 2 +- dev/ocaml/X86_proc/index.html | 2 +- dev/ocaml/_doc-dir/Changes | 648 +++++++++++++++--- dev/ocaml/_doc-dir/README.adoc | 40 +- dev/ocaml/_doc-dir/README.win32.adoc | 32 +- dev/ocaml/index.html | 2 +- 273 files changed, 1075 insertions(+), 537 deletions(-) delete mode 100644 dev/ocaml/Bigarray/index.html delete mode 100644 dev/ocaml/CamlinternalAtomic/index.html delete mode 100644 dev/ocaml/Condition/index.html create mode 100644 dev/ocaml/Config_boot/index.html create mode 100644 dev/ocaml/Config_main/index.html delete mode 100644 dev/ocaml/Mutex/index.html create mode 100644 dev/ocaml/Ocamlmktop_init/index.html create mode 100644 dev/ocaml/Runtime_events/Callbacks/index.html create mode 100644 dev/ocaml/Runtime_events/Timestamp/index.html create mode 100644 dev/ocaml/Runtime_events/index.html delete mode 100644 dev/ocaml/Semaphore/Binary/index.html delete mode 100644 dev/ocaml/Semaphore/Counting/index.html delete mode 100644 dev/ocaml/Semaphore/index.html create mode 100644 dev/ocaml/Stdlib/Condition/index.html create mode 100644 dev/ocaml/Stdlib/Domain/DLS/index.html create mode 100644 dev/ocaml/Stdlib/Domain/index.html create mode 100644 dev/ocaml/Stdlib/Effect/Deep/index.html create mode 100644 dev/ocaml/Stdlib/Effect/Shallow/index.html create mode 100644 dev/ocaml/Stdlib/Effect/index.html delete mode 100644 dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/argument-1-H/index.html delete mode 100644 dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/index.html delete mode 100644 dev/ocaml/Stdlib/Ephemeron/GenHashTable/index.html delete mode 100644 dev/ocaml/Stdlib/Genlex/index.html create mode 100644 dev/ocaml/Stdlib/Mutex/index.html delete mode 100644 dev/ocaml/Stdlib/Pervasives/index.html create mode 100644 dev/ocaml/Stdlib/Semaphore/Binary/index.html create mode 100644 dev/ocaml/Stdlib/Semaphore/Counting/index.html create mode 100644 dev/ocaml/Stdlib/Semaphore/index.html delete mode 100644 dev/ocaml/Stdlib/Stream/index.html create mode 100644 dev/ocaml/Stdlib__Condition/index.html rename dev/ocaml/{Stdlib__Genlex => Stdlib__Domain}/index.html (72%) rename dev/ocaml/{Stdlib__Stream => Stdlib__Effect}/index.html (72%) create mode 100644 dev/ocaml/Stdlib__Mutex/index.html delete mode 100644 dev/ocaml/Stdlib__Pervasives/index.html create mode 100644 dev/ocaml/Stdlib__Semaphore/index.html delete mode 100644 dev/ocaml/ThreadUnix/index.html diff --git a/dev/moonpool/Moonpool/Chan/index.html b/dev/moonpool/Moonpool/Chan/index.html index d59ef2bb..bf57d4b7 100644 --- a/dev/moonpool/Moonpool/Chan/index.html +++ b/dev/moonpool/Moonpool/Chan/index.html @@ -1,2 +1,2 @@ -Chan (moonpool.Moonpool.Chan)

Module Moonpool.Chan

Channels.

Channels are pipelines of values where threads can push into one end, and pull from the other end.

Unlike Moonpool.Blocking_queue, channels are designed so that pushing never blocks, and pop'ing values returns a future.

type 'a or_error = 'a Fut.or_error
type 'a t

Channel carrying values of type 'a.

val create : unit -> 'a t

Create a channel.

exception Closed
val push : 'a t -> 'a -> unit

push chan x pushes x into chan. This does not block.

  • raises Closed

    if the channel is closed.

val pop : 'a t -> 'a Fut.t

Pop an element. This returns a future that will be fulfilled when an element is available.

  • raises Closed

    if the channel is closed, or fails the future if the channel is closed before an element is available for it.

val try_pop : 'a t -> 'a option

try_pop chan pops and return an element if one is available immediately. Otherwise it returns None.

val pop_block_exn : 'a t -> 'a

Like pop, but blocks if an element is not available immediately. The precautions around blocking from inside a thread pool are the same as explained in Fut.wait_block.

val close : _ t -> unit

Close the channel. Further push and pop calls will fail. This is idempotent.

\ No newline at end of file +Chan (moonpool.Moonpool.Chan)

Module Moonpool.Chan

Channels.

Channels are pipelines of values where threads can push into one end, and pull from the other end.

Unlike Moonpool.Blocking_queue, channels are designed so that pushing never blocks, and pop'ing values returns a future.

type 'a or_error = 'a Fut.or_error
type 'a t

Channel carrying values of type 'a.

val create : unit -> 'a t

Create a channel.

exception Closed
val push : 'a t -> 'a -> unit

push chan x pushes x into chan. This does not block.

  • raises Closed

    if the channel is closed.

val pop : 'a t -> 'a Fut.t

Pop an element. This returns a future that will be fulfilled when an element is available.

  • raises Closed

    if the channel is closed, or fails the future if the channel is closed before an element is available for it.

val try_pop : 'a t -> 'a option

try_pop chan pops and return an element if one is available immediately. Otherwise it returns None.

val pop_block_exn : 'a t -> 'a

Like pop, but blocks if an element is not available immediately. The precautions around blocking from inside a thread pool are the same as explained in Fut.wait_block.

val close : _ t -> unit

Close the channel. Further push and pop calls will fail. This is idempotent.

val pop_await : 'a t -> 'a

Like pop but suspends the current thread until an element is available. See await for more details.

  • since 0.3
\ No newline at end of file diff --git a/dev/moonpool/Moonpool/Fork_join/index.html b/dev/moonpool/Moonpool/Fork_join/index.html index 796e0785..e788f15b 100644 --- a/dev/moonpool/Moonpool/Fork_join/index.html +++ b/dev/moonpool/Moonpool/Fork_join/index.html @@ -1,2 +1,13 @@ -Fork_join (moonpool.Moonpool.Fork_join)

Module Moonpool.Fork_join

Fork-join primitives.

NOTE These are only available on OCaml 5.0 and above.

\ No newline at end of file +Fork_join (moonpool.Moonpool.Fork_join)

Module Moonpool.Fork_join

Fork-join primitives.

NOTE These are only available on OCaml 5.0 and above.

val both : (unit -> 'a) -> (unit -> 'b) -> 'a * 'b

both f g runs f() and g(), potentially in parallel, and returns their result when both are done. If any of f() and g() fails, then the whole computation fails.

This must be run from within the pool: for example, inside Pool.run or inside a Fut.spawn computation. This is because it relies on an effect handler to be installed.

  • since 0.3

NOTE this is only available on OCaml 5.

val both_ignore : (unit -> _) -> (unit -> _) -> unit

Same as both f g |> ignore.

  • since 0.3

NOTE this is only available on OCaml 5.

val for_ : ?chunk_size:int -> int -> (int -> int -> unit) -> unit

for_ n f is the parallel version of for i=0 to n-1 do f i done.

f is called with parameters low and high and must use them like so:

for j = low to high do (* … actual work *) done 

. If chunk_size=1 then low=high and the loop is not actually needed.

  • parameter chunk_size

    controls the granularity of parallelism. The default chunk size is not specified. See all_array or all_list for more details.

    Example:

    let total_sum = Atomic.make 0
    +
    +let() = for_ ~chunk_size:5 100
    +  (fun low high ->
    +    (* iterate on the range sequentially. The range should have 5 items or less. *)
    +    let local_sum = ref 0 in
    +    for j=low to high do
    +      local_sum := !local_sum + j
    +    done;
    +    ignore (Atomic.fetch_and_add total_sum !local_sum : int)))
    +
    +let() = assert (Atomic.get total_sum = 4950)

    Note how we still compute a local sum sequentially in (fun low high -> …), before combining it wholesale into total_sum. When the chunk size is large, this can have a dramatic impact on the synchronization overhead.

    When chunk_size is not provided, the library will attempt to guess a value that keeps all cores busy but runs as few tasks as possible to reduce the synchronization overhead.

    Use ~chunk_size:1 if you explicitly want to run each iteration of the loop in its own task.

  • since 0.3

NOTE this is only available on OCaml 5.

val all_array : ?chunk_size:int -> (unit -> 'a) array -> 'a array

all_array fs runs all functions in fs in tasks, and waits for all the results.

  • parameter chunk_size

    if equal to n, groups items by n to be run in a single task. Default is 1.

  • since 0.3

NOTE this is only available on OCaml 5.

val all_list : ?chunk_size:int -> (unit -> 'a) list -> 'a list

all_list fs runs all functions in fs in tasks, and waits for all the results.

  • parameter chunk_size

    if equal to n, groups items by n to be run in a single task. Default is not specified. This parameter is available since 0.3.

  • since 0.3

NOTE this is only available on OCaml 5.

val all_init : ?chunk_size:int -> int -> (int -> 'a) -> 'a list

all_init n f runs functions f 0, f 1, … f (n-1) in tasks, and waits for all the results.

  • parameter chunk_size

    if equal to n, groups items by n to be run in a single task. Default is not specified. This parameter is available since 0.3.

  • since 0.3

NOTE this is only available on OCaml 5.

val map_array : ?chunk_size:int -> ('a -> 'b) -> 'a array -> 'b array

map_array f arr is like Array.map f arr, but runs in parallel.

  • since 0.3

NOTE this is only available on OCaml 5.

val map_list : ?chunk_size:int -> ('a -> 'b) -> 'a list -> 'b list

map_list f l is like List.map f l, but runs in parallel.

  • since 0.3

NOTE this is only available on OCaml 5.

\ No newline at end of file diff --git a/dev/moonpool/Moonpool/Fut/index.html b/dev/moonpool/Moonpool/Fut/index.html index 1161ed17..f439bc32 100644 --- a/dev/moonpool/Moonpool/Fut/index.html +++ b/dev/moonpool/Moonpool/Fut/index.html @@ -1,2 +1,2 @@ -Fut (moonpool.Moonpool.Fut)

Module Moonpool.Fut

Futures.

A future of type 'a t represents the result of a computation that will yield a value of type 'a.

Typically, the computation is running on a thread pool Runner.t and will proceed on some worker. Once set, a future cannot change. It either succeeds (storing a Ok x with x: 'a), or fail (storing a Error (exn, bt) with an exception and the corresponding backtrace).

Combinators such as map and join_array can be used to produce futures from other futures (in a monadic way). Some combinators take a on argument to specify a runner on which the intermediate computation takes place; for example map ~on:pool ~f fut maps the value in fut using function f, applicatively; the call to f happens on the runner pool (once fut resolves successfully with a value).

type 'a or_error = ('a, exn * Stdlib.Printexc.raw_backtrace) result
type 'a t

A future with a result of type 'a.

type 'a promise

A promise, which can be fulfilled exactly once to set the corresponding future

val make : unit -> 'a t * 'a promise

Make a new future with the associated promise

val on_result : 'a t -> ('a or_error -> unit) -> unit

on_result fut f registers f to be called in the future when fut is set ; or calls f immediately if fut is already set.

exception Already_fulfilled
val fulfill : 'a promise -> 'a or_error -> unit

Fullfill the promise, setting the future at the same time.

  • raises Already_fulfilled

    if the promise is already fulfilled.

val fulfill_idempotent : 'a promise -> 'a or_error -> unit

Fullfill the promise, setting the future at the same time. Does nothing if the promise is already fulfilled.

val return : 'a -> 'a t

Already settled future, with a result

val fail : exn -> Stdlib.Printexc.raw_backtrace -> _ t

Already settled future, with a failure

val of_result : 'a or_error -> 'a t
val is_resolved : _ t -> bool

is_resolved fut is true iff fut is resolved.

val peek : 'a t -> 'a or_error option

peek fut returns Some r if fut is currently resolved with r, and None if fut is not resolved yet.

exception Not_ready
  • since 0.2
val get_or_fail : 'a t -> 'a or_error

get_or_fail fut obtains the result from fut if it's fulfilled (i.e. if peek fut returns Some res, get_or_fail fut returns res).

  • raises Not_ready

    if the future is not ready.

  • since 0.2
val get_or_fail_exn : 'a t -> 'a

get_or_fail_exn fut obtains the result from fut if it's fulfilled, like get_or_fail. If the result is an Error _, the exception inside is re-raised.

  • raises Not_ready

    if the future is not ready.

  • since 0.2
val is_done : _ t -> bool

Is the future resolved? This is the same as peek fut |> Option.is_some.

  • since 0.2

Combinators

val spawn : on:Runner.t -> (unit -> 'a) -> 'a t

spaw ~on f runs f() on the given runner on, and return a future that will hold its result.

val reify_error : 'a t -> 'a or_error t

reify_error fut turns a failing future into a non-failing one that contain Error (exn, bt). A non-failing future returning x is turned into Ok x

  • since NEXT_RELEASE
val map : ?on:Runner.t -> f:('a -> 'b) -> 'a t -> 'b t

map ?on ~f fut returns a new future fut2 that resolves with f x if fut resolved with x; and fails with e if fut fails with e or f x raises e.

  • parameter on

    if provided, f runs on the given runner

val bind : ?on:Runner.t -> f:('a -> 'b t) -> 'a t -> 'b t

bind ?on ~f fut returns a new future fut2 that resolves like the future f x if fut resolved with x; and fails with e if fut fails with e or f x raises e.

  • parameter on

    if provided, f runs on the given runner

val bind_reify_error : ?on:Runner.t -> f:('a or_error -> 'b t) -> 'a t -> 'b t

bind_reify_error ?on ~f fut returns a new future fut2 that resolves like the future f (Ok x) if fut resolved with x; and resolves like the future f (Error (exn, bt)) if fut fails with exn and backtrace bt.

  • parameter on

    if provided, f runs on the given runner

  • since NEXT_RELEASE
val join : ?on:Runner.t -> 'a t t -> 'a t

join fut is fut >>= Fun.id. It joins the inner layer of the future.

  • since 0.2
val both : 'a t -> 'b t -> ('a * 'b) t

both a b succeeds with x, y if a succeeds with x and b succeeds with y, or fails if any of them fails.

val choose : 'a t -> 'b t -> ('a, 'b) Either.t t

choose a b succeeds Left x or Right y if a succeeds with x or b succeeds with y, or fails if both of them fails. If they both succeed, it is not specified which result is used.

val choose_same : 'a t -> 'a t -> 'a t

choose_same a b succeeds with the value of one of a or b if they succeed, or fails if both fail. If they both succeed, it is not specified which result is used.

val join_array : 'a t array -> 'a array t

Wait for all the futures in the array. Fails if any future fails.

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

Wait for all the futures in the list. Fails if any future fails.

val wait_array : _ t array -> unit t

wait_array arr waits for all futures in arr to resolve. It discards the individual results of futures in arr. It fails if any future fails.

val wait_list : _ t list -> unit t

wait_list l waits for all futures in l to resolve. It discards the individual results of futures in l. It fails if any future fails.

val for_ : on:Runner.t -> int -> (int -> unit) -> unit t

for_ ~on n f runs f 0, f 1, …, f (n-1) on the runner, and returns a future that resolves when all the tasks have resolved, or fails as soon as one task has failed.

val for_array : on:Runner.t -> 'a array -> (int -> 'a -> unit) -> unit t

for_array ~on arr f runs f 0 arr.(0), …, f (n-1) arr.(n-1) in the runner (where n = Array.length arr), and returns a future that resolves when all the tasks are done, or fails if any of them fails.

  • since 0.2
val for_list : on:Runner.t -> 'a list -> ('a -> unit) -> unit t

for_list ~on l f is like for_array ~on (Array.of_list l) f.

  • since 0.2

Await

NOTE This is only available on OCaml 5.

Blocking

val wait_block : 'a t -> 'a or_error

wait_block fut blocks the current thread until fut is resolved, and returns its value.

NOTE: A word of warning: this will monopolize the calling thread until the future resolves. This can also easily cause deadlocks, if enough threads in a pool call wait_block on futures running on the same pool or a pool depending on it.

A good rule to avoid deadlocks is to run this from outside of any pool, or to have an acyclic order between pools where wait_block is only called from a pool on futures evaluated in a pool that comes lower in the hierarchy. If this rule is broken, it is possible for all threads in a pool to wait for futures that can only make progress on these same threads, hence the deadlock.

val wait_block_exn : 'a t -> 'a

Same as wait_block but re-raises the exception if the future failed.

module type INFIX = sig ... end

Operators that run on the same thread as the first future.

include INFIX
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
module Infix (_ : sig ... end) : INFIX

Make infix combinators, with intermediate computations running on the given pool.

val infix : Runner.t -> (module INFIX)

infix runner makes a new infix module with intermediate computations running on the given runner..

  • since 0.2
\ No newline at end of file +Fut (moonpool.Moonpool.Fut)

Module Moonpool.Fut

Futures.

A future of type 'a t represents the result of a computation that will yield a value of type 'a.

Typically, the computation is running on a thread pool Runner.t and will proceed on some worker. Once set, a future cannot change. It either succeeds (storing a Ok x with x: 'a), or fail (storing a Error (exn, bt) with an exception and the corresponding backtrace).

Combinators such as map and join_array can be used to produce futures from other futures (in a monadic way). Some combinators take a on argument to specify a runner on which the intermediate computation takes place; for example map ~on:pool ~f fut maps the value in fut using function f, applicatively; the call to f happens on the runner pool (once fut resolves successfully with a value).

type 'a or_error = ('a, exn * Stdlib.Printexc.raw_backtrace) result
type 'a t

A future with a result of type 'a.

type 'a promise

A promise, which can be fulfilled exactly once to set the corresponding future

val make : unit -> 'a t * 'a promise

Make a new future with the associated promise

val on_result : 'a t -> ('a or_error -> unit) -> unit

on_result fut f registers f to be called in the future when fut is set ; or calls f immediately if fut is already set.

exception Already_fulfilled
val fulfill : 'a promise -> 'a or_error -> unit

Fullfill the promise, setting the future at the same time.

  • raises Already_fulfilled

    if the promise is already fulfilled.

val fulfill_idempotent : 'a promise -> 'a or_error -> unit

Fullfill the promise, setting the future at the same time. Does nothing if the promise is already fulfilled.

val return : 'a -> 'a t

Already settled future, with a result

val fail : exn -> Stdlib.Printexc.raw_backtrace -> _ t

Already settled future, with a failure

val of_result : 'a or_error -> 'a t
val is_resolved : _ t -> bool

is_resolved fut is true iff fut is resolved.

val peek : 'a t -> 'a or_error option

peek fut returns Some r if fut is currently resolved with r, and None if fut is not resolved yet.

exception Not_ready
  • since 0.2
val get_or_fail : 'a t -> 'a or_error

get_or_fail fut obtains the result from fut if it's fulfilled (i.e. if peek fut returns Some res, get_or_fail fut returns res).

  • raises Not_ready

    if the future is not ready.

  • since 0.2
val get_or_fail_exn : 'a t -> 'a

get_or_fail_exn fut obtains the result from fut if it's fulfilled, like get_or_fail. If the result is an Error _, the exception inside is re-raised.

  • raises Not_ready

    if the future is not ready.

  • since 0.2
val is_done : _ t -> bool

Is the future resolved? This is the same as peek fut |> Option.is_some.

  • since 0.2

Combinators

val spawn : on:Runner.t -> (unit -> 'a) -> 'a t

spaw ~on f runs f() on the given runner on, and return a future that will hold its result.

val reify_error : 'a t -> 'a or_error t

reify_error fut turns a failing future into a non-failing one that contain Error (exn, bt). A non-failing future returning x is turned into Ok x

  • since NEXT_RELEASE
val map : ?on:Runner.t -> f:('a -> 'b) -> 'a t -> 'b t

map ?on ~f fut returns a new future fut2 that resolves with f x if fut resolved with x; and fails with e if fut fails with e or f x raises e.

  • parameter on

    if provided, f runs on the given runner

val bind : ?on:Runner.t -> f:('a -> 'b t) -> 'a t -> 'b t

bind ?on ~f fut returns a new future fut2 that resolves like the future f x if fut resolved with x; and fails with e if fut fails with e or f x raises e.

  • parameter on

    if provided, f runs on the given runner

val bind_reify_error : ?on:Runner.t -> f:('a or_error -> 'b t) -> 'a t -> 'b t

bind_reify_error ?on ~f fut returns a new future fut2 that resolves like the future f (Ok x) if fut resolved with x; and resolves like the future f (Error (exn, bt)) if fut fails with exn and backtrace bt.

  • parameter on

    if provided, f runs on the given runner

  • since NEXT_RELEASE
val join : ?on:Runner.t -> 'a t t -> 'a t

join fut is fut >>= Fun.id. It joins the inner layer of the future.

  • since 0.2
val both : 'a t -> 'b t -> ('a * 'b) t

both a b succeeds with x, y if a succeeds with x and b succeeds with y, or fails if any of them fails.

val choose : 'a t -> 'b t -> ('a, 'b) Either.t t

choose a b succeeds Left x or Right y if a succeeds with x or b succeeds with y, or fails if both of them fails. If they both succeed, it is not specified which result is used.

val choose_same : 'a t -> 'a t -> 'a t

choose_same a b succeeds with the value of one of a or b if they succeed, or fails if both fail. If they both succeed, it is not specified which result is used.

val join_array : 'a t array -> 'a array t

Wait for all the futures in the array. Fails if any future fails.

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

Wait for all the futures in the list. Fails if any future fails.

val wait_array : _ t array -> unit t

wait_array arr waits for all futures in arr to resolve. It discards the individual results of futures in arr. It fails if any future fails.

val wait_list : _ t list -> unit t

wait_list l waits for all futures in l to resolve. It discards the individual results of futures in l. It fails if any future fails.

val for_ : on:Runner.t -> int -> (int -> unit) -> unit t

for_ ~on n f runs f 0, f 1, …, f (n-1) on the runner, and returns a future that resolves when all the tasks have resolved, or fails as soon as one task has failed.

val for_array : on:Runner.t -> 'a array -> (int -> 'a -> unit) -> unit t

for_array ~on arr f runs f 0 arr.(0), …, f (n-1) arr.(n-1) in the runner (where n = Array.length arr), and returns a future that resolves when all the tasks are done, or fails if any of them fails.

  • since 0.2
val for_list : on:Runner.t -> 'a list -> ('a -> unit) -> unit t

for_list ~on l f is like for_array ~on (Array.of_list l) f.

  • since 0.2

Await

NOTE This is only available on OCaml 5.

val await : 'a t -> 'a

await fut suspends the current tasks until fut is fulfilled, then resumes the task on this same runner.

  • since 0.3

This must only be run from inside the runner itself. The runner must support Suspend_. NOTE: only on OCaml 5.x

Blocking

val wait_block : 'a t -> 'a or_error

wait_block fut blocks the current thread until fut is resolved, and returns its value.

NOTE: A word of warning: this will monopolize the calling thread until the future resolves. This can also easily cause deadlocks, if enough threads in a pool call wait_block on futures running on the same pool or a pool depending on it.

A good rule to avoid deadlocks is to run this from outside of any pool, or to have an acyclic order between pools where wait_block is only called from a pool on futures evaluated in a pool that comes lower in the hierarchy. If this rule is broken, it is possible for all threads in a pool to wait for futures that can only make progress on these same threads, hence the deadlock.

val wait_block_exn : 'a t -> 'a

Same as wait_block but re-raises the exception if the future failed.

module type INFIX = sig ... end

Operators that run on the same thread as the first future.

include INFIX
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val let+ : 'a t -> ('a -> 'b) -> 'b t
val and+ : 'a t -> 'b t -> ('a * 'b) t
val let* : 'a t -> ('a -> 'b t) -> 'b t
val and* : 'a t -> 'b t -> ('a * 'b) t
module Infix (_ : sig ... end) : INFIX

Make infix combinators, with intermediate computations running on the given pool.

val infix : Runner.t -> (module INFIX)

infix runner makes a new infix module with intermediate computations running on the given runner..

  • since 0.2
\ No newline at end of file diff --git a/dev/moonpool/Moonpool/Lock/index.html b/dev/moonpool/Moonpool/Lock/index.html index 321bc56d..aac3f90e 100644 --- a/dev/moonpool/Moonpool/Lock/index.html +++ b/dev/moonpool/Moonpool/Lock/index.html @@ -1,2 +1,2 @@ -Lock (moonpool.Moonpool.Lock)

Module Moonpool.Lock

Mutex-protected resource.

type 'a t

A value protected by a mutex

val create : 'a -> 'a t

Create a new protected value.

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

with_ l f runs f x where x is the value protected with the lock l, in a critical section. If f x fails, with_lock l f fails too but the lock is released.

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

update l f replaces the content x of l with f x, while protected by the mutex.

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

update_map l f computes x', y = f (get l), then puts x' in l and returns y, while protected by the mutex.

val mutex : _ t -> Mutex.t

Underlying mutex.

val get : 'a t -> 'a

Atomically get the value in the lock. The value that is returned isn't protected!

val set : 'a t -> 'a -> unit

Atomically set the value.

NOTE caution: using get and set as if this were a ref is an anti pattern and will not protect data against some race conditions.

\ No newline at end of file +Lock (moonpool.Moonpool.Lock)

Module Moonpool.Lock

Mutex-protected resource.

type 'a t

A value protected by a mutex

val create : 'a -> 'a t

Create a new protected value.

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

with_ l f runs f x where x is the value protected with the lock l, in a critical section. If f x fails, with_lock l f fails too but the lock is released.

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

update l f replaces the content x of l with f x, while protected by the mutex.

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

update_map l f computes x', y = f (get l), then puts x' in l and returns y, while protected by the mutex.

val mutex : _ t -> Stdlib.Mutex.t

Underlying mutex.

val get : 'a t -> 'a

Atomically get the value in the lock. The value that is returned isn't protected!

val set : 'a t -> 'a -> unit

Atomically set the value.

NOTE caution: using get and set as if this were a ref is an anti pattern and will not protect data against some race conditions.

\ No newline at end of file diff --git a/dev/moonpool/Moonpool/Suspend_/index.html b/dev/moonpool/Moonpool/Suspend_/index.html index e35e55d8..687205d1 100644 --- a/dev/moonpool/Moonpool/Suspend_/index.html +++ b/dev/moonpool/Moonpool/Suspend_/index.html @@ -1,5 +1,5 @@ -Suspend_ (moonpool.Moonpool.Suspend_)

Module Moonpool.Suspend_

Suspensions.

This is only going to work on OCaml 5.x.

NOTE: this is not stable for now.

(Private) suspending tasks using Effects.

This module is an implementation detail of Moonpool and should not be used outside of it, except by experts to implement Runner.

type suspension = (unit, exn * Stdlib.Printexc.raw_backtrace) result -> unit

A suspended computation

type task = unit -> unit
type suspension_handler = {
  1. handle : run:(with_handler:bool -> task -> unit) -> suspension -> unit;
}

The handler that knows what to do with the suspended computation.

The handler is given two things:

  • the suspended computation (which can be resumed with a result eventually);
  • a run function that can be used to start tasks to perform some computation.

This means that a fork-join primitive, for example, can use a single call to suspend to:

  • suspend the caller until the fork-join is done
  • use run to start all the tasks. Typically run is called multiple times, which is where the "fork" part comes from. Each call to run potentially runs in parallel with the other calls. The calls must coordinate so that, once they are all done, the suspended caller is resumed with the aggregated result of the computation.
val with_suspend : +Suspend_ (moonpool.Moonpool.Suspend_)

Module Moonpool.Suspend_

Suspensions.

This is only going to work on OCaml 5.x.

NOTE: this is not stable for now.

  • alert unstable this module is an implementation detail of moonpool for now

(Private) suspending tasks using Effects.

This module is an implementation detail of Moonpool and should not be used outside of it, except by experts to implement Runner.

type suspension = (unit, exn * Stdlib.Printexc.raw_backtrace) result -> unit

A suspended computation

type task = unit -> unit
type suspension_handler = {
  1. handle : run:(with_handler:bool -> task -> unit) -> suspension -> unit;
}

The handler that knows what to do with the suspended computation.

The handler is given two things:

  • the suspended computation (which can be resumed with a result eventually);
  • a run function that can be used to start tasks to perform some computation.

This means that a fork-join primitive, for example, can use a single call to suspend to:

  • suspend the caller until the fork-join is done
  • use run to start all the tasks. Typically run is called multiple times, which is where the "fork" part comes from. Each call to run potentially runs in parallel with the other calls. The calls must coordinate so that, once they are all done, the suspended caller is resumed with the aggregated result of the computation.
type Stdlib.Effect.t +=
  1. | Suspend : suspension_handler -> unit Stdlib.Effect.t
    (*

    The effect used to suspend the current thread and pass it, suspended, to the handler. The handler will ensure that the suspension is resumed later once some computation has been done.

    *)
val suspend : suspension_handler -> unit

suspend h jumps back to the nearest with_suspend and calls h.handle with the current continuation k and a task runner function.

val with_suspend : run:(with_handler:bool -> task -> unit) -> (unit -> unit) -> unit

with_suspend ~run f runs f() in an environment where suspend will work. If f() suspends with suspension handler h, this calls h ~run k where k is the suspension.

This will not do anything on OCaml 4.x.

\ No newline at end of file diff --git a/dev/ocaml/Arg_helper/Make/argument-1-S/Key/Map/index.html b/dev/ocaml/Arg_helper/Make/argument-1-S/Key/Map/index.html index 3d3fffe8..113a9884 100644 --- a/dev/ocaml/Arg_helper/Make/argument-1-S/Key/Map/index.html +++ b/dev/ocaml/Arg_helper/Make/argument-1-S/Key/Map/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12.0
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
\ No newline at end of file + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
\ No newline at end of file diff --git a/dev/ocaml/Backend_var/index.html b/dev/ocaml/Backend_var/index.html index 5a79cb3a..69ced3b4 100644 --- a/dev/ocaml/Backend_var/index.html +++ b/dev/ocaml/Backend_var/index.html @@ -1,2 +1,2 @@ -Backend_var (ocaml.Backend_var)

Module Backend_var

Variables used in the backend, optionally equipped with "provenance" information, used for the emission of debugging information.

include module type of struct include Ident end
type t = Ident.t
include Identifiable.S with type t := t
module T = Ident.T
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set = Ident.Set
module Map = Ident.Map
module Tbl = Ident.Tbl
val print_with_scope : Stdlib.Format.formatter -> t -> unit

Same as print except that it will also add a "n" suffix if the scope of the argument is n.

val create_scoped : scope:int -> string -> t
val create_local : string -> t
val create_persistent : string -> t
val create_predef : string -> t
val rename : t -> t

Creates an identifier with the same name as the input, a fresh stamp, and no scope.

  • raises [Fatal_error]

    if called on a persistent / predef ident.

val name : t -> string
val unique_name : t -> string
val unique_toplevel_name : t -> string
val persistent : t -> bool
val same : t -> t -> bool

Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

val compare : t -> t -> int
val global : t -> bool
val is_predef : t -> bool
val scope : t -> int
val lowest_scope : int
val highest_scope : int
val reinit : unit -> unit
type 'a tbl = 'a Ident.tbl
val empty : 'a tbl
val add : t -> 'a -> 'a tbl -> 'a tbl
val find_same : t -> 'a tbl -> 'a
val find_name : string -> 'a tbl -> t * 'a
val find_all : string -> 'a tbl -> (t * 'a) list
val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val iter : (t -> 'a -> unit) -> 'a tbl -> unit
val remove : t -> 'a tbl -> 'a tbl
val make_key_generator : unit -> t -> t
type backend_var = t
module Provenance : sig ... end
module With_provenance : sig ... end
\ No newline at end of file +Backend_var (ocaml.Backend_var)

Module Backend_var

Variables used in the backend, optionally equipped with "provenance" information, used for the emission of debugging information.

include module type of struct include Ident end
type t = Ident.t
include Identifiable.S with type t := t
module T = Ident.T
include Identifiable.Thing with type t := T.t
include Hashtbl.HashedType with type t := T.t
val equal : T.t -> T.t -> bool

The equality predicate used to compare keys.

val hash : T.t -> int

A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

  • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
  • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
  • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
include Map.OrderedType with type t := T.t
val output : out_channel -> T.t -> unit
val print : Stdlib.Format.formatter -> T.t -> unit
module Set = Ident.Set
module Map = Ident.Map
module Tbl = Ident.Tbl
val print_with_scope : Stdlib.Format.formatter -> t -> unit

Same as print except that it will also add a "n" suffix if the scope of the argument is n.

val create_scoped : scope:int -> string -> t
val create_local : string -> t
val create_persistent : string -> t
val create_predef : string -> t
val rename : t -> t

Creates an identifier with the same name as the input, a fresh stamp, and no scope.

  • raises [Fatal_error]

    if called on a persistent / predef ident.

val name : t -> string
val unique_name : t -> string
val unique_toplevel_name : t -> string
val persistent : t -> bool
val same : t -> t -> bool

Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

val compare : t -> t -> int
val global : t -> bool
val is_predef : t -> bool
val scope : t -> int
val lowest_scope : int
val highest_scope : int
val reinit : unit -> unit
type 'a tbl = 'a Ident.tbl

'a tbl represents association tables from identifiers to values of type 'a.

'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

find_all returns the bindings for all idents of a given name, most recently introduced first.

In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

val empty : 'a tbl
val add : t -> 'a -> 'a tbl -> 'a tbl
val find_same : t -> 'a tbl -> 'a
val find_name : string -> 'a tbl -> t * 'a
val find_all : string -> 'a tbl -> (t * 'a) list
val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
val iter : (t -> 'a -> unit) -> 'a tbl -> unit
val remove : t -> 'a tbl -> 'a tbl
val make_key_generator : unit -> t -> t
type backend_var = t
module Provenance : sig ... end
module With_provenance : sig ... end
\ No newline at end of file diff --git a/dev/ocaml/Bigarray/index.html b/dev/ocaml/Bigarray/index.html deleted file mode 100644 index 0fcda6f1..00000000 --- a/dev/ocaml/Bigarray/index.html +++ /dev/null @@ -1,14 +0,0 @@ - -Bigarray (ocaml.Bigarray)

Module Bigarray

include module type of struct include Stdlib.Bigarray end

Element kinds

Bigarrays can contain elements of the following kinds:

Each element kind is represented at the type level by one of the *_elt types defined below (defined with a single constructor instead of abstract types for technical injectivity reasons).

  • since 4.07.0 Moved from otherlibs to stdlib.
type float32_elt = Stdlib.Bigarray.float32_elt =
  1. | Float32_elt
type float64_elt = Stdlib.Bigarray.float64_elt =
  1. | Float64_elt
type int8_signed_elt = Stdlib.Bigarray.int8_signed_elt =
  1. | Int8_signed_elt
type int8_unsigned_elt = Stdlib.Bigarray.int8_unsigned_elt =
  1. | Int8_unsigned_elt
type int16_signed_elt = Stdlib.Bigarray.int16_signed_elt =
  1. | Int16_signed_elt
type int16_unsigned_elt = Stdlib.Bigarray.int16_unsigned_elt =
  1. | Int16_unsigned_elt
type int32_elt = Stdlib.Bigarray.int32_elt =
  1. | Int32_elt
type int64_elt = Stdlib.Bigarray.int64_elt =
  1. | Int64_elt
type int_elt = Stdlib.Bigarray.int_elt =
  1. | Int_elt
type nativeint_elt = Stdlib.Bigarray.nativeint_elt =
  1. | Nativeint_elt
type complex32_elt = Stdlib.Bigarray.complex32_elt =
  1. | Complex32_elt
type complex64_elt = Stdlib.Bigarray.complex64_elt =
  1. | Complex64_elt
type ('a, 'b) kind = ('a, 'b) Stdlib.Bigarray.kind =
  1. | Float32 : (float, float32_elt) kind
  2. | Float64 : (float, float64_elt) kind
  3. | Int8_signed : (int, int8_signed_elt) kind
  4. | Int8_unsigned : (int, int8_unsigned_elt) kind
  5. | Int16_signed : (int, int16_signed_elt) kind
  6. | Int16_unsigned : (int, int16_unsigned_elt) kind
  7. | Int32 : (int32, int32_elt) kind
  8. | Int64 : (int64, int64_elt) kind
  9. | Int : (int, int_elt) kind
  10. | Nativeint : (nativeint, nativeint_elt) kind
  11. | Complex32 : (Stdlib.Complex.t, complex32_elt) kind
  12. | Complex64 : (Stdlib.Complex.t, complex64_elt) kind
  13. | Char : (char, int8_unsigned_elt) kind

To each element kind is associated an OCaml type, which is the type of OCaml values that can be stored in the Bigarray or read back from it. This type is not necessarily the same as the type of the array elements proper: for instance, a Bigarray whose elements are of kind float32_elt contains 32-bit single precision floats, but reading or writing one of its elements from OCaml uses the OCaml type float, which is 64-bit double precision floats.

The GADT type ('a, 'b) kind captures this association of an OCaml type 'a for values read or written in the Bigarray, and of an element kind 'b which represents the actual contents of the Bigarray. Its constructors list all possible associations of OCaml types with element kinds, and are re-exported below for backward-compatibility reasons.

Using a generalized algebraic datatype (GADT) here allows writing well-typed polymorphic functions whose return type depend on the argument type, such as:

let zero : type a b. (a, b) kind -> a = function
-  | Float32 -> 0.0 | Complex32 -> Complex.zero
-  | Float64 -> 0.0 | Complex64 -> Complex.zero
-  | Int8_signed -> 0 | Int8_unsigned -> 0
-  | Int16_signed -> 0 | Int16_unsigned -> 0
-  | Int32 -> 0l | Int64 -> 0L
-  | Int -> 0 | Nativeint -> 0n
-  | Char -> '\000'
val float32 : (float, float32_elt) kind
val float64 : (float, float64_elt) kind
val int8_signed : (int, int8_signed_elt) kind
val int8_unsigned : (int, int8_unsigned_elt) kind
val int16_signed : (int, int16_signed_elt) kind
val int16_unsigned : (int, int16_unsigned_elt) kind
val int : (int, int_elt) kind
val int32 : (int32, int32_elt) kind
val int64 : (int64, int64_elt) kind
val nativeint : (nativeint, nativeint_elt) kind
val char : (char, int8_unsigned_elt) kind

As shown by the types of the values above, Bigarrays of kind float32_elt and float64_elt are accessed using the OCaml type float. Bigarrays of complex kinds complex32_elt, complex64_elt are accessed with the OCaml type Complex.t. Bigarrays of integer kinds are accessed using the smallest OCaml integer type large enough to represent the array elements: int for 8- and 16-bit integer Bigarrays, as well as OCaml-integer Bigarrays; int32 for 32-bit integer Bigarrays; int64 for 64-bit integer Bigarrays; and nativeint for platform-native integer Bigarrays. Finally, Bigarrays of kind int8_unsigned_elt can also be accessed as arrays of characters instead of arrays of small integers, by using the kind value char instead of int8_unsigned.

val kind_size_in_bytes : ('a, 'b) kind -> int

kind_size_in_bytes k is the number of bytes used to store an element of type k.

  • since 4.03.0

Array layouts

type c_layout = Stdlib.Bigarray.c_layout =
  1. | C_layout_typ
type fortran_layout = Stdlib.Bigarray.fortran_layout =
  1. | Fortran_layout_typ

To facilitate interoperability with existing C and Fortran code, this library supports two different memory layouts for Bigarrays, one compatible with the C conventions, the other compatible with the Fortran conventions.

In the C-style layout, array indices start at 0, and multi-dimensional arrays are laid out in row-major format. That is, for a two-dimensional array, all elements of row 0 are contiguous in memory, followed by all elements of row 1, etc. In other terms, the array elements at (x,y) and (x, y+1) are adjacent in memory.

In the Fortran-style layout, array indices start at 1, and multi-dimensional arrays are laid out in column-major format. That is, for a two-dimensional array, all elements of column 0 are contiguous in memory, followed by all elements of column 1, etc. In other terms, the array elements at (x,y) and (x+1, y) are adjacent in memory.

Each layout style is identified at the type level by the phantom types Bigarray.c_layout and Bigarray.fortran_layout respectively.

Supported layouts

The GADT type 'a layout represents one of the two supported memory layouts: C-style or Fortran-style. Its constructors are re-exported as values below for backward-compatibility reasons.

type 'a layout = 'a Stdlib.Bigarray.layout =
  1. | C_layout : c_layout layout
  2. | Fortran_layout : fortran_layout layout
val c_layout : c_layout layout
val fortran_layout : fortran_layout layout

Generic arrays (of arbitrarily many dimensions)

module Genarray = Stdlib.Bigarray.Genarray

Zero-dimensional arrays

module Array0 = Stdlib.Bigarray.Array0

Zero-dimensional arrays. The Array0 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of zero-dimensional arrays that only contain a single scalar value. Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

One-dimensional arrays

module Array1 = Stdlib.Bigarray.Array1

One-dimensional arrays. The Array1 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of one-dimensional arrays. (The Array2 and Array3 structures below provide operations specialized for two- and three-dimensional arrays.) Statically knowing the number of dimensions of the array allows faster operations, and more precise static type-checking.

Two-dimensional arrays

module Array2 = Stdlib.Bigarray.Array2

Two-dimensional arrays. The Array2 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of two-dimensional arrays.

Three-dimensional arrays

module Array3 = Stdlib.Bigarray.Array3

Three-dimensional arrays. The Array3 structure provides operations similar to those of Bigarray.Genarray, but specialized to the case of three-dimensional arrays.

Coercions between generic Bigarrays and fixed-dimension Bigarrays

val genarray_of_array0 : ('a, 'b, 'c) Array0.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given zero-dimensional Bigarray.

  • since 4.05.0
val genarray_of_array1 : ('a, 'b, 'c) Array1.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given one-dimensional Bigarray.

val genarray_of_array2 : ('a, 'b, 'c) Array2.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given two-dimensional Bigarray.

val genarray_of_array3 : ('a, 'b, 'c) Array3.t -> ('a, 'b, 'c) Genarray.t

Return the generic Bigarray corresponding to the given three-dimensional Bigarray.

val array0_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

Return the zero-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly zero dimension.

  • since 4.05.0
val array1_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array1.t

Return the one-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly one dimension.

val array2_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array2.t

Return the two-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly two dimensions.

val array3_of_genarray : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array3.t

Return the three-dimensional Bigarray corresponding to the given generic Bigarray.

  • raises Invalid_argument

    if the generic Bigarray does not have exactly three dimensions.

Re-shaping Bigarrays

val reshape : ('a, 'b, 'c) Genarray.t -> int array -> ('a, 'b, 'c) Genarray.t

reshape b [|d1;...;dN|] converts the Bigarray b to a N-dimensional array of dimensions d1...dN. The returned array and the original array b share their data and have the same layout. For instance, assuming that b is a one-dimensional array of dimension 12, reshape b [|3;4|] returns a two-dimensional array b' of dimensions 3 and 4. If b has C layout, the element (x,y) of b' corresponds to the element x * 3 + y of b. If b has Fortran layout, the element (x,y) of b' corresponds to the element x + (y - 1) * 4 of b. The returned Bigarray must have exactly the same number of elements as the original Bigarray b. That is, the product of the dimensions of b must be equal to i1 * ... * iN. Otherwise, Invalid_argument is raised.

val reshape_0 : ('a, 'b, 'c) Genarray.t -> ('a, 'b, 'c) Array0.t

Specialized version of Bigarray.reshape for reshaping to zero-dimensional arrays.

  • since 4.05.0
val reshape_1 : ('a, 'b, 'c) Genarray.t -> int -> ('a, 'b, 'c) Array1.t

Specialized version of Bigarray.reshape for reshaping to one-dimensional arrays.

val reshape_2 : ('a, 'b, 'c) Genarray.t -> int -> int -> ('a, 'b, 'c) Array2.t

Specialized version of Bigarray.reshape for reshaping to two-dimensional arrays.

val reshape_3 : - ('a, 'b, 'c) Genarray.t -> - int -> - int -> - int -> - ('a, 'b, 'c) Array3.t

Specialized version of Bigarray.reshape for reshaping to three-dimensional arrays.

\ No newline at end of file diff --git a/dev/ocaml/Btype/TransientTypeMap/index.html b/dev/ocaml/Btype/TransientTypeMap/index.html index e689a81a..681119a9 100644 --- a/dev/ocaml/Btype/TransientTypeMap/index.html +++ b/dev/ocaml/Btype/TransientTypeMap/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
\ No newline at end of file + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
\ No newline at end of file diff --git a/dev/ocaml/Btype/TypeMap/index.html b/dev/ocaml/Btype/TypeMap/index.html index e9aa698d..de062817 100644 --- a/dev/ocaml/Btype/TypeMap/index.html +++ b/dev/ocaml/Btype/TypeMap/index.html @@ -7,4 +7,4 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val add : Types.type_expr -> 'a -> 'a t -> 'a t
val find : Types.type_expr -> 'a t -> 'a
val singleton : Types.type_expr -> 'a -> 'a t
val fold : (Types.type_expr -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
\ No newline at end of file + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val add : Types.type_expr -> 'a -> 'a t -> 'a t
val find : Types.type_expr -> 'a t -> 'a
val singleton : Types.type_expr -> 'a -> 'a t
val fold : (Types.type_expr -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
\ No newline at end of file diff --git a/dev/ocaml/CamlinternalAtomic/index.html b/dev/ocaml/CamlinternalAtomic/index.html deleted file mode 100644 index 5876eaa5..00000000 --- a/dev/ocaml/CamlinternalAtomic/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -CamlinternalAtomic (ocaml.CamlinternalAtomic)

Module CamlinternalAtomic

type !'a t
val make : 'a -> 'a t
val get : 'a t -> 'a
val set : 'a t -> 'a -> unit
val exchange : 'a t -> 'a -> 'a
val compare_and_set : 'a t -> 'a -> 'a -> bool
val fetch_and_add : int t -> int -> int
val incr : int t -> unit
val decr : int t -> unit
\ No newline at end of file diff --git a/dev/ocaml/CamlinternalLazy/index.html b/dev/ocaml/CamlinternalLazy/index.html index d77cefe5..683ac1f1 100644 --- a/dev/ocaml/CamlinternalLazy/index.html +++ b/dev/ocaml/CamlinternalLazy/index.html @@ -1,2 +1,2 @@ -CamlinternalLazy (ocaml.CamlinternalLazy)

Module CamlinternalLazy

Run-time support for lazy values. All functions in this module are for system use only, not for the casual user.

exception Undefined
type 'a t = 'a lazy_t
val force_lazy_block : 'a lazy_t -> 'a
val force_val_lazy_block : 'a lazy_t -> 'a
val force : 'a lazy_t -> 'a
val force_val : 'a lazy_t -> 'a
\ No newline at end of file +CamlinternalLazy (ocaml.CamlinternalLazy)

Module CamlinternalLazy

Run-time support for lazy values. All functions in this module are for system use only, not for the casual user.

type 'a t = 'a lazy_t
exception Undefined
val force_lazy_block : 'a lazy_t -> 'a
val force_gen : only_val:bool -> 'a lazy_t -> 'a
\ No newline at end of file diff --git a/dev/ocaml/Clambda_primitives/index.html b/dev/ocaml/Clambda_primitives/index.html index 175fcd65..9549b859 100644 --- a/dev/ocaml/Clambda_primitives/index.html +++ b/dev/ocaml/Clambda_primitives/index.html @@ -1,2 +1,2 @@ -Clambda_primitives (ocaml.Clambda_primitives)

Module Clambda_primitives

type mutable_flag = Asttypes.mutable_flag
type immediate_or_pointer = Lambda.immediate_or_pointer
type initialization_or_assignment = Lambda.initialization_or_assignment
type is_safe = Lambda.is_safe
type boxed =
  1. | Boxed
  2. | Unboxed
type memory_access_size =
  1. | Sixteen
  2. | Thirty_two
  3. | Sixty_four
type primitive =
  1. | Pread_symbol of string
  2. | Pmakeblock of int * mutable_flag * block_shape
  3. | Pfield of int
  4. | Pfield_computed
  5. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
  6. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
  7. | Pfloatfield of int
  8. | Psetfloatfield of int * initialization_or_assignment
  9. | Pduprecord of Types.record_representation * int
  10. | Pccall of Primitive.description
  11. | Praise of raise_kind
  12. | Psequand
  13. | Psequor
  14. | Pnot
  15. | Pnegint
  16. | Paddint
  17. | Psubint
  18. | Pmulint
  19. | Pdivint of is_safe
  20. | Pmodint of is_safe
  21. | Pandint
  22. | Porint
  23. | Pxorint
  24. | Plslint
  25. | Plsrint
  26. | Pasrint
  27. | Pintcomp of integer_comparison
  28. | Pcompare_ints
  29. | Pcompare_floats
  30. | Pcompare_bints of boxed_integer
  31. | Poffsetint of int
  32. | Poffsetref of int
  33. | Pintoffloat
  34. | Pfloatofint
  35. | Pnegfloat
  36. | Pabsfloat
  37. | Paddfloat
  38. | Psubfloat
  39. | Pmulfloat
  40. | Pdivfloat
  41. | Pfloatcomp of float_comparison
  42. | Pstringlength
  43. | Pstringrefu
  44. | Pstringrefs
  45. | Pbyteslength
  46. | Pbytesrefu
  47. | Pbytessetu
  48. | Pbytesrefs
  49. | Pbytessets
  50. | Pmakearray of array_kind * mutable_flag
    (*

    For Pmakearray, the list of arguments must not be empty. The empty array should be represented by a distinguished constant in the middle end.

    *)
  51. | Pduparray of array_kind * mutable_flag
    (*

    For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

    *)
  52. | Parraylength of array_kind
  53. | Parrayrefu of array_kind
  54. | Parraysetu of array_kind
  55. | Parrayrefs of array_kind
  56. | Parraysets of array_kind
  57. | Pisint
  58. | Pisout
  59. | Pbintofint of boxed_integer
  60. | Pintofbint of boxed_integer
  61. | Pcvtbint of boxed_integer * boxed_integer
  62. | Pnegbint of boxed_integer
  63. | Paddbint of boxed_integer
  64. | Psubbint of boxed_integer
  65. | Pmulbint of boxed_integer
  66. | Pdivbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  67. | Pmodbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  68. | Pandbint of boxed_integer
  69. | Porbint of boxed_integer
  70. | Pxorbint of boxed_integer
  71. | Plslbint of boxed_integer
  72. | Plsrbint of boxed_integer
  73. | Pasrbint of boxed_integer
  74. | Pbintcomp of boxed_integer * integer_comparison
  75. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
  76. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
  77. | Pbigarraydim of int
  78. | Pstring_load of memory_access_size * is_safe
  79. | Pbytes_load of memory_access_size * is_safe
  80. | Pbytes_set of memory_access_size * is_safe
  81. | Pbigstring_load of memory_access_size * is_safe
  82. | Pbigstring_set of memory_access_size * is_safe
  83. | Pbswap16
  84. | Pbbswap of boxed_integer
  85. | Pint_as_pointer
  86. | Popaque
and integer_comparison = Lambda.integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
and float_comparison = Lambda.float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
and array_kind = Lambda.array_kind =
  1. | Pgenarray
  2. | Paddrarray
  3. | Pintarray
  4. | Pfloatarray
and value_kind = Lambda.value_kind =
  1. | Pgenval
  2. | Pfloatval
  3. | Pboxedintval of boxed_integer
  4. | Pintval
and block_shape = Lambda.block_shape
and boxed_integer = Primitive.boxed_integer =
  1. | Pnativeint
  2. | Pint32
  3. | Pint64
and bigarray_kind = Lambda.bigarray_kind =
  1. | Pbigarray_unknown
  2. | Pbigarray_float32
  3. | Pbigarray_float64
  4. | Pbigarray_sint8
  5. | Pbigarray_uint8
  6. | Pbigarray_sint16
  7. | Pbigarray_uint16
  8. | Pbigarray_int32
  9. | Pbigarray_int64
  10. | Pbigarray_caml_int
  11. | Pbigarray_native_int
  12. | Pbigarray_complex32
  13. | Pbigarray_complex64
and bigarray_layout = Lambda.bigarray_layout =
  1. | Pbigarray_unknown_layout
  2. | Pbigarray_c_layout
  3. | Pbigarray_fortran_layout
and raise_kind = Lambda.raise_kind =
  1. | Raise_regular
  2. | Raise_reraise
  3. | Raise_notrace
val equal : primitive -> primitive -> bool
\ No newline at end of file +Clambda_primitives (ocaml.Clambda_primitives)

Module Clambda_primitives

type mutable_flag = Asttypes.mutable_flag
type immediate_or_pointer = Lambda.immediate_or_pointer
type initialization_or_assignment = Lambda.initialization_or_assignment
type is_safe = Lambda.is_safe
type boxed =
  1. | Boxed
  2. | Unboxed
type memory_access_size =
  1. | Sixteen
  2. | Thirty_two
  3. | Sixty_four
type primitive =
  1. | Pread_symbol of string
  2. | Pmakeblock of int * mutable_flag * block_shape
  3. | Pfield of int * immediate_or_pointer * mutable_flag
  4. | Pfield_computed
  5. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
  6. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
  7. | Pfloatfield of int
  8. | Psetfloatfield of int * initialization_or_assignment
  9. | Pduprecord of Types.record_representation * int
  10. | Prunstack
  11. | Pperform
  12. | Presume
  13. | Preperform
  14. | Pccall of Primitive.description
  15. | Praise of raise_kind
  16. | Psequand
  17. | Psequor
  18. | Pnot
  19. | Pnegint
  20. | Paddint
  21. | Psubint
  22. | Pmulint
  23. | Pdivint of is_safe
  24. | Pmodint of is_safe
  25. | Pandint
  26. | Porint
  27. | Pxorint
  28. | Plslint
  29. | Plsrint
  30. | Pasrint
  31. | Pintcomp of integer_comparison
  32. | Pcompare_ints
  33. | Pcompare_floats
  34. | Pcompare_bints of boxed_integer
  35. | Poffsetint of int
  36. | Poffsetref of int
  37. | Pintoffloat
  38. | Pfloatofint
  39. | Pnegfloat
  40. | Pabsfloat
  41. | Paddfloat
  42. | Psubfloat
  43. | Pmulfloat
  44. | Pdivfloat
  45. | Pfloatcomp of float_comparison
  46. | Pstringlength
  47. | Pstringrefu
  48. | Pstringrefs
  49. | Pbyteslength
  50. | Pbytesrefu
  51. | Pbytessetu
  52. | Pbytesrefs
  53. | Pbytessets
  54. | Pmakearray of array_kind * mutable_flag
    (*

    For Pmakearray, the list of arguments must not be empty. The empty array should be represented by a distinguished constant in the middle end.

    *)
  55. | Pduparray of array_kind * mutable_flag
    (*

    For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

    *)
  56. | Parraylength of array_kind
  57. | Parrayrefu of array_kind
  58. | Parraysetu of array_kind
  59. | Parrayrefs of array_kind
  60. | Parraysets of array_kind
  61. | Pisint
  62. | Pisout
  63. | Pbintofint of boxed_integer
  64. | Pintofbint of boxed_integer
  65. | Pcvtbint of boxed_integer * boxed_integer
  66. | Pnegbint of boxed_integer
  67. | Paddbint of boxed_integer
  68. | Psubbint of boxed_integer
  69. | Pmulbint of boxed_integer
  70. | Pdivbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  71. | Pmodbint of {
    1. size : boxed_integer;
    2. is_safe : is_safe;
    }
  72. | Pandbint of boxed_integer
  73. | Porbint of boxed_integer
  74. | Pxorbint of boxed_integer
  75. | Plslbint of boxed_integer
  76. | Plsrbint of boxed_integer
  77. | Pasrbint of boxed_integer
  78. | Pbintcomp of boxed_integer * integer_comparison
  79. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
  80. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
  81. | Pbigarraydim of int
  82. | Pstring_load of memory_access_size * is_safe
  83. | Pbytes_load of memory_access_size * is_safe
  84. | Pbytes_set of memory_access_size * is_safe
  85. | Pbigstring_load of memory_access_size * is_safe
  86. | Pbigstring_set of memory_access_size * is_safe
  87. | Pbswap16
  88. | Pbbswap of boxed_integer
  89. | Pint_as_pointer
  90. | Patomic_load of {
    1. immediate_or_pointer : immediate_or_pointer;
    }
  91. | Patomic_exchange
  92. | Patomic_cas
  93. | Patomic_fetch_add
  94. | Popaque
  95. | Pdls_get
and integer_comparison = Lambda.integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
and float_comparison = Lambda.float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
and array_kind = Lambda.array_kind =
  1. | Pgenarray
  2. | Paddrarray
  3. | Pintarray
  4. | Pfloatarray
and value_kind = Lambda.value_kind =
  1. | Pgenval
  2. | Pfloatval
  3. | Pboxedintval of boxed_integer
  4. | Pintval
and block_shape = Lambda.block_shape
and boxed_integer = Primitive.boxed_integer =
  1. | Pnativeint
  2. | Pint32
  3. | Pint64
and bigarray_kind = Lambda.bigarray_kind =
  1. | Pbigarray_unknown
  2. | Pbigarray_float32
  3. | Pbigarray_float64
  4. | Pbigarray_sint8
  5. | Pbigarray_uint8
  6. | Pbigarray_sint16
  7. | Pbigarray_uint16
  8. | Pbigarray_int32
  9. | Pbigarray_int64
  10. | Pbigarray_caml_int
  11. | Pbigarray_native_int
  12. | Pbigarray_complex32
  13. | Pbigarray_complex64
and bigarray_layout = Lambda.bigarray_layout =
  1. | Pbigarray_unknown_layout
  2. | Pbigarray_c_layout
  3. | Pbigarray_fortran_layout
and raise_kind = Lambda.raise_kind =
  1. | Raise_regular
  2. | Raise_reraise
  3. | Raise_notrace
val equal : primitive -> primitive -> bool
\ No newline at end of file diff --git a/dev/ocaml/Clflags/index.html b/dev/ocaml/Clflags/index.html index 2e9bf772..12e958b4 100644 --- a/dev/ocaml/Clflags/index.html +++ b/dev/ocaml/Clflags/index.html @@ -1,2 +1,2 @@ -Clflags (ocaml.Clflags)

Module Clflags

Command line flags

module Int_arg_helper : sig ... end

Optimization parameters represented as ints indexed by round number.

module Float_arg_helper : sig ... end

Optimization parameters represented as floats indexed by round number.

type inlining_arguments = {
  1. inline_call_cost : int option;
  2. inline_alloc_cost : int option;
  3. inline_prim_cost : int option;
  4. inline_branch_cost : int option;
  5. inline_indirect_cost : int option;
  6. inline_lifting_benefit : int option;
  7. inline_branch_factor : float option;
  8. inline_max_depth : int option;
  9. inline_max_unroll : int option;
  10. inline_threshold : float option;
  11. inline_toplevel_threshold : int option;
}
val classic_arguments : inlining_arguments
val o1_arguments : inlining_arguments
val o2_arguments : inlining_arguments
val o3_arguments : inlining_arguments
val use_inlining_arguments_set : ?round:int -> inlining_arguments -> unit

Set all the inlining arguments for a round. The default is set if no round is provided.

val objfiles : string list ref
val ccobjs : string list ref
val dllibs : string list ref
val compile_only : bool ref
val output_name : string option ref
val include_dirs : string list ref
val no_std_include : bool ref
val print_types : bool ref
val make_archive : bool ref
val debug : bool ref
val debug_full : bool ref
val unsafe : bool ref
val use_linscan : bool ref
val custom_runtime : bool ref
val no_check_prims : bool ref
val bytecode_compatible_32 : bool ref
val output_c_object : bool ref
val output_complete_object : bool ref
val output_complete_executable : bool ref
val all_ccopts : string list ref
val classic : bool ref
val nopervasives : bool ref
val match_context_rows : int ref
val open_modules : string list ref
val preprocessor : string option ref
val all_ppx : string list ref
val absname : bool ref
val annotations : bool ref
val binary_annotations : bool ref
val use_threads : bool ref
val noassert : bool ref
val verbose : bool ref
val noprompt : bool ref
val nopromptcont : bool ref
val init_file : string option ref
val noinit : bool ref
val noversion : bool ref
val use_prims : string ref
val use_runtime : string ref
val plugin : bool ref
val principal : bool ref
val real_paths : bool ref
val recursive_types : bool ref
val strict_sequence : bool ref
val strict_formats : bool ref
val applicative_functors : bool ref
val make_runtime : bool ref
val c_compiler : string option ref
val dllpaths : string list ref
val make_package : bool ref
val for_package : string option ref
val error_size : int ref
val float_const_prop : bool ref
val transparent_modules : bool ref
val unique_ids : bool ref
val locations : bool ref
val dump_source : bool ref
val dump_parsetree : bool ref
val dump_typedtree : bool ref
val dump_shape : bool ref
val dump_rawlambda : bool ref
val dump_lambda : bool ref
val dump_rawclambda : bool ref
val dump_clambda : bool ref
val dump_rawflambda : bool ref
val dump_flambda : bool ref
val dump_flambda_let : int option ref
val dump_instr : bool ref
val keep_camlprimc_file : bool ref
val keep_asm_file : bool ref
val optimize_for_speed : bool ref
val dump_cmm : bool ref
val dump_selection : bool ref
val dump_cse : bool ref
val dump_live : bool ref
val dump_spill : bool ref
val dump_split : bool ref
val dump_interf : bool ref
val dump_prefer : bool ref
val dump_regalloc : bool ref
val dump_reload : bool ref
val dump_scheduling : bool ref
val dump_linear : bool ref
val dump_interval : bool ref
val keep_startup_file : bool ref
val dump_combine : bool ref
val native_code : bool ref
val default_inline_threshold : float
val inline_threshold : Float_arg_helper.parsed ref
val inlining_report : bool ref
val simplify_rounds : int option ref
val default_simplify_rounds : int ref
val rounds : unit -> int
val default_inline_max_unroll : int
val inline_max_unroll : Int_arg_helper.parsed ref
val default_inline_toplevel_threshold : int
val inline_toplevel_threshold : Int_arg_helper.parsed ref
val default_inline_call_cost : int
val default_inline_alloc_cost : int
val default_inline_prim_cost : int
val default_inline_branch_cost : int
val default_inline_indirect_cost : int
val default_inline_lifting_benefit : int
val inline_call_cost : Int_arg_helper.parsed ref
val inline_alloc_cost : Int_arg_helper.parsed ref
val inline_prim_cost : Int_arg_helper.parsed ref
val inline_branch_cost : Int_arg_helper.parsed ref
val inline_indirect_cost : Int_arg_helper.parsed ref
val inline_lifting_benefit : Int_arg_helper.parsed ref
val default_inline_branch_factor : float
val inline_branch_factor : Float_arg_helper.parsed ref
val dont_write_files : bool ref
val std_include_flag : string -> string
val std_include_dir : unit -> string list
val shared : bool ref
val dlcode : bool ref
val pic_code : bool ref
val runtime_variant : string ref
val with_runtime : bool ref
val force_slash : bool ref
val keep_docs : bool ref
val keep_locs : bool ref
val unsafe_string : bool ref
val opaque : bool ref
val profile_columns : Profile.column list ref
val flambda_invariant_checks : bool ref
val unbox_closures : bool ref
val unbox_closures_factor : int ref
val default_unbox_closures_factor : int
val unbox_free_vars_of_closures : bool ref
val unbox_specialised_args : bool ref
val clambda_checks : bool ref
val cmm_invariants : bool ref
val default_inline_max_depth : int
val inline_max_depth : Int_arg_helper.parsed ref
val remove_unused_arguments : bool ref
val dump_flambda_verbose : bool ref
val classic_inlining : bool ref
val afl_instrument : bool ref
val afl_inst_ratio : int ref
val function_sections : bool ref
val all_passes : string list ref
val dumped_pass : string -> bool
val set_dumped_pass : string -> bool -> unit
val dump_into_file : bool ref
val dump_dir : string option ref
type 'a env_reader = {
  1. parse : string -> 'a option;
  2. print : 'a -> string;
  3. usage : string;
  4. env_var : string;
}
val color : Misc.Color.setting option ref
val color_reader : Misc.Color.setting env_reader
val error_style : Misc.Error_style.setting option ref
val error_style_reader : Misc.Error_style.setting env_reader
val unboxed_types : bool ref
val insn_sched : bool ref
val insn_sched_default : bool
module Compiler_pass : sig ... end
val stop_after : Compiler_pass.t option ref
val should_stop_after : Compiler_pass.t -> bool
val set_save_ir_after : Compiler_pass.t -> bool -> unit
val should_save_ir_after : Compiler_pass.t -> bool
val arg_spec : (string * Stdlib.Arg.spec * string) list ref
val add_arguments : string -> (string * Stdlib.Arg.spec * string) list -> unit
val create_usage_msg : string -> string
val print_arguments : string -> unit
val reset_arguments : unit -> unit
\ No newline at end of file +Clflags (ocaml.Clflags)

Module Clflags

Command line flags

module Int_arg_helper : sig ... end

Optimization parameters represented as ints indexed by round number.

module Float_arg_helper : sig ... end

Optimization parameters represented as floats indexed by round number.

type inlining_arguments = {
  1. inline_call_cost : int option;
  2. inline_alloc_cost : int option;
  3. inline_prim_cost : int option;
  4. inline_branch_cost : int option;
  5. inline_indirect_cost : int option;
  6. inline_lifting_benefit : int option;
  7. inline_branch_factor : float option;
  8. inline_max_depth : int option;
  9. inline_max_unroll : int option;
  10. inline_threshold : float option;
  11. inline_toplevel_threshold : int option;
}
val classic_arguments : inlining_arguments
val o1_arguments : inlining_arguments
val o2_arguments : inlining_arguments
val o3_arguments : inlining_arguments
val use_inlining_arguments_set : ?round:int -> inlining_arguments -> unit

Set all the inlining arguments for a round. The default is set if no round is provided.

val objfiles : string list ref
val ccobjs : string list ref
val dllibs : string list ref
val cmi_file : string option ref
val compile_only : bool ref
val output_name : string option ref
val include_dirs : string list ref
val no_std_include : bool ref
val no_cwd : bool ref
val print_types : bool ref
val make_archive : bool ref
val debug : bool ref
val debug_full : bool ref
val unsafe : bool ref
val use_linscan : bool ref
val custom_runtime : bool ref
val no_check_prims : bool ref
val bytecode_compatible_32 : bool ref
val output_c_object : bool ref
val output_complete_object : bool ref
val output_complete_executable : bool ref
val all_ccopts : string list ref
val classic : bool ref
val nopervasives : bool ref
val match_context_rows : int ref
val open_modules : string list ref
val preprocessor : string option ref
val all_ppx : string list ref
val absname : bool ref
val annotations : bool ref
val binary_annotations : bool ref
val use_threads : bool ref
val noassert : bool ref
val verbose : bool ref
val noprompt : bool ref
val nopromptcont : bool ref
val init_file : string option ref
val noinit : bool ref
val noversion : bool ref
val use_prims : string ref
val use_runtime : string ref
val plugin : bool ref
val principal : bool ref
val real_paths : bool ref
val recursive_types : bool ref
val strict_sequence : bool ref
val strict_formats : bool ref
val applicative_functors : bool ref
val make_runtime : bool ref
val c_compiler : string option ref
val dllpaths : string list ref
val make_package : bool ref
val for_package : string option ref
val error_size : int ref
val float_const_prop : bool ref
val transparent_modules : bool ref
val unique_ids : bool ref
val locations : bool ref
val dump_source : bool ref
val dump_parsetree : bool ref
val dump_typedtree : bool ref
val dump_shape : bool ref
val dump_rawlambda : bool ref
val dump_lambda : bool ref
val dump_rawclambda : bool ref
val dump_clambda : bool ref
val dump_rawflambda : bool ref
val dump_flambda : bool ref
val dump_flambda_let : int option ref
val dump_instr : bool ref
val keep_camlprimc_file : bool ref
val keep_asm_file : bool ref
val optimize_for_speed : bool ref
val dump_cmm : bool ref
val dump_selection : bool ref
val dump_cse : bool ref
val dump_live : bool ref
val dump_spill : bool ref
val dump_split : bool ref
val dump_interf : bool ref
val dump_prefer : bool ref
val dump_regalloc : bool ref
val dump_reload : bool ref
val dump_scheduling : bool ref
val dump_linear : bool ref
val dump_interval : bool ref
val keep_startup_file : bool ref
val dump_combine : bool ref
val native_code : bool ref
val default_inline_threshold : float
val inline_threshold : Float_arg_helper.parsed ref
val inlining_report : bool ref
val simplify_rounds : int option ref
val default_simplify_rounds : int ref
val rounds : unit -> int
val default_inline_max_unroll : int
val inline_max_unroll : Int_arg_helper.parsed ref
val default_inline_toplevel_threshold : int
val inline_toplevel_threshold : Int_arg_helper.parsed ref
val default_inline_call_cost : int
val default_inline_alloc_cost : int
val default_inline_prim_cost : int
val default_inline_branch_cost : int
val default_inline_indirect_cost : int
val default_inline_lifting_benefit : int
val inline_call_cost : Int_arg_helper.parsed ref
val inline_alloc_cost : Int_arg_helper.parsed ref
val inline_prim_cost : Int_arg_helper.parsed ref
val inline_branch_cost : Int_arg_helper.parsed ref
val inline_indirect_cost : Int_arg_helper.parsed ref
val inline_lifting_benefit : Int_arg_helper.parsed ref
val default_inline_branch_factor : float
val inline_branch_factor : Float_arg_helper.parsed ref
val dont_write_files : bool ref
val std_include_flag : string -> string
val std_include_dir : unit -> string list
val shared : bool ref
val dlcode : bool ref
val pic_code : bool ref
val runtime_variant : string ref
val with_runtime : bool ref
val force_slash : bool ref
val keep_docs : bool ref
val keep_locs : bool ref
val opaque : bool ref
val profile_columns : Profile.column list ref
val flambda_invariant_checks : bool ref
val unbox_closures : bool ref
val unbox_closures_factor : int ref
val default_unbox_closures_factor : int
val unbox_free_vars_of_closures : bool ref
val unbox_specialised_args : bool ref
val clambda_checks : bool ref
val cmm_invariants : bool ref
val default_inline_max_depth : int
val inline_max_depth : Int_arg_helper.parsed ref
val remove_unused_arguments : bool ref
val dump_flambda_verbose : bool ref
val classic_inlining : bool ref
val afl_instrument : bool ref
val afl_inst_ratio : int ref
val function_sections : bool ref
val all_passes : string list ref
val dumped_pass : string -> bool
val set_dumped_pass : string -> bool -> unit
val dump_into_file : bool ref
val dump_dir : string option ref
type 'a env_reader = {
  1. parse : string -> 'a option;
  2. print : 'a -> string;
  3. usage : string;
  4. env_var : string;
}
val color : Misc.Color.setting option ref
val color_reader : Misc.Color.setting env_reader
val error_style : Misc.Error_style.setting option ref
val error_style_reader : Misc.Error_style.setting env_reader
val unboxed_types : bool ref
val insn_sched : bool ref
val insn_sched_default : bool
module Compiler_pass : sig ... end
val stop_after : Compiler_pass.t option ref
val should_stop_after : Compiler_pass.t -> bool
val set_save_ir_after : Compiler_pass.t -> bool -> unit
val should_save_ir_after : Compiler_pass.t -> bool
val arg_spec : (string * Stdlib.Arg.spec * string) list ref
val add_arguments : string -> (string * Stdlib.Arg.spec * string) list -> unit
val create_usage_msg : string -> string
val print_arguments : string -> unit
val reset_arguments : unit -> unit
\ No newline at end of file diff --git a/dev/ocaml/Closure_conversion_aux/Env/index.html b/dev/ocaml/Closure_conversion_aux/Env/index.html index 87c328e9..b91af4bb 100644 --- a/dev/ocaml/Closure_conversion_aux/Env/index.html +++ b/dev/ocaml/Closure_conversion_aux/Env/index.html @@ -1,2 +1,2 @@ -Env (ocaml.Closure_conversion_aux.Env)

Module Closure_conversion_aux.Env

Used to remember which Variable.t values correspond to which Ident.t values during closure conversion, and similarly for static exception identifiers.

type t
val empty : t
val add_var : t -> Ident.t -> Variable.t -> t
val add_vars : t -> Ident.t list -> Variable.t list -> t
val find_var : t -> Ident.t -> Variable.t
val find_var_exn : t -> Ident.t -> Variable.t
val add_mutable_var : t -> Ident.t -> Mutable_variable.t -> t
val find_mutable_var_exn : t -> Ident.t -> Mutable_variable.t
val add_static_exception : t -> int -> Static_exception.t -> t
val find_static_exception : t -> int -> Static_exception.t
val add_global : t -> int -> Symbol.t -> t
val find_global : t -> int -> Symbol.t
val at_toplevel : t -> bool
val not_at_toplevel : t -> t
\ No newline at end of file +Env (ocaml.Closure_conversion_aux.Env)

Module Closure_conversion_aux.Env

Used to remember which Variable.t values correspond to which Ident.t values during closure conversion, and similarly for static exception identifiers.

type t
val empty : t
val add_var : t -> Ident.t -> Variable.t -> t
val add_vars : t -> Ident.t list -> Variable.t list -> t
val find_var : t -> Ident.t -> Variable.t
val find_var_exn : t -> Ident.t -> Variable.t
val add_mutable_var : t -> Ident.t -> Mutable_variable.t -> t
val find_mutable_var_exn : t -> Ident.t -> Mutable_variable.t
val add_static_exception : t -> int -> Static_exception.t -> t
val find_static_exception : t -> int -> Static_exception.t
val add_global : t -> int -> Symbol.t -> t
val find_global : t -> int -> Symbol.t
\ No newline at end of file diff --git a/dev/ocaml/Closure_element/Map/index.html b/dev/ocaml/Closure_element/Map/index.html index 7004a228..4ff255fa 100644 --- a/dev/ocaml/Closure_element/Map/index.html +++ b/dev/ocaml/Closure_element/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Closure_element/Set/index.html b/dev/ocaml/Closure_element/Set/index.html index 544b1388..9048fbd4 100644 --- a/dev/ocaml/Closure_element/Set/index.html +++ b/dev/ocaml/Closure_element/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Closure_element.Set)

Module Closure_element.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file +Set (ocaml.Closure_element.Set)

Module Closure_element.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file diff --git a/dev/ocaml/Closure_id/Map/index.html b/dev/ocaml/Closure_id/Map/index.html index 73f3ab78..720666a4 100644 --- a/dev/ocaml/Closure_id/Map/index.html +++ b/dev/ocaml/Closure_id/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12.0
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Closure_id/Set/index.html b/dev/ocaml/Closure_id/Set/index.html index 5c35c2ed..2888d5d1 100644 --- a/dev/ocaml/Closure_id/Set/index.html +++ b/dev/ocaml/Closure_id/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Closure_id.Set)

Module Closure_id.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file +Set (ocaml.Closure_id.Set)

Module Closure_id.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file diff --git a/dev/ocaml/Closure_origin/Map/index.html b/dev/ocaml/Closure_origin/Map/index.html index fed8cd26..80a2c5a4 100644 --- a/dev/ocaml/Closure_origin/Map/index.html +++ b/dev/ocaml/Closure_origin/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12.0
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Closure_origin/Set/index.html b/dev/ocaml/Closure_origin/Set/index.html index 3f585385..1be68850 100644 --- a/dev/ocaml/Closure_origin/Set/index.html +++ b/dev/ocaml/Closure_origin/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Closure_origin.Set)

Module Closure_origin.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file +Set (ocaml.Closure_origin.Set)

Module Closure_origin.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file diff --git a/dev/ocaml/Cmi_format/index.html b/dev/ocaml/Cmi_format/index.html index a73ce0cd..fbb87e31 100644 --- a/dev/ocaml/Cmi_format/index.html +++ b/dev/ocaml/Cmi_format/index.html @@ -1,2 +1,2 @@ -Cmi_format (ocaml.Cmi_format)

Module Cmi_format

type pers_flags =
  1. | Rectypes
  2. | Alerts of Misc.alerts
  3. | Opaque
  4. | Unsafe_string
type cmi_infos = {
  1. cmi_name : Misc.modname;
  2. cmi_sign : Types.signature_item list;
  3. cmi_crcs : Misc.crcs;
  4. cmi_flags : pers_flags list;
}
val output_cmi : string -> out_channel -> cmi_infos -> Stdlib.Digest.t
val input_cmi : in_channel -> cmi_infos
val read_cmi : string -> cmi_infos
type error =
  1. | Not_an_interface of Misc.filepath
  2. | Wrong_version_interface of Misc.filepath * string
  3. | Corrupted_interface of Misc.filepath
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
\ No newline at end of file +Cmi_format (ocaml.Cmi_format)

Module Cmi_format

type pers_flags =
  1. | Rectypes
  2. | Alerts of Misc.alerts
  3. | Opaque
type cmi_infos = {
  1. cmi_name : Misc.modname;
  2. cmi_sign : Types.signature_item list;
  3. cmi_crcs : Misc.crcs;
  4. cmi_flags : pers_flags list;
}
val output_cmi : string -> out_channel -> cmi_infos -> Stdlib.Digest.t
val input_cmi : in_channel -> cmi_infos
val read_cmi : string -> cmi_infos
type error =
  1. | Not_an_interface of Misc.filepath
  2. | Wrong_version_interface of Misc.filepath * string
  3. | Corrupted_interface of Misc.filepath
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
\ No newline at end of file diff --git a/dev/ocaml/Cmm/index.html b/dev/ocaml/Cmm/index.html index cc82cc66..3871ae94 100644 --- a/dev/ocaml/Cmm/index.html +++ b/dev/ocaml/Cmm/index.html @@ -2,7 +2,7 @@ Cmm (ocaml.Cmm)

Module Cmm

type machtype_component =
  1. | Val
  2. | Addr
  3. | Int
  4. | Float
type machtype = machtype_component array
val typ_void : machtype
val typ_val : machtype
val typ_addr : machtype
val typ_int : machtype
val typ_float : machtype

Least upper bound of two machtype_components.

val ge_component : machtype_component -> machtype_component -> bool

Returns true iff the first supplied machtype_component is greater than or equal to the second under the relation used by lub_component.

type exttype =
  1. | XInt
    (*

    r OCaml value, word-sized integer

    *)
  2. | XInt32
    (*

    r 32-bit integer

    *)
  3. | XInt64
    (*

    r 64-bit integer

    *)
  4. | XFloat
    (*

    r double-precision FP number

    *)

A variant of machtype used to describe arguments to external C functions

val machtype_of_exttype : exttype -> machtype
val machtype_of_exttype_list : exttype list -> machtype
type integer_comparison = Lambda.integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
val negate_integer_comparison : integer_comparison -> integer_comparison
val swap_integer_comparison : integer_comparison -> integer_comparison
type float_comparison = Lambda.float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
val negate_float_comparison : float_comparison -> float_comparison
val swap_float_comparison : float_comparison -> float_comparison
type label = int
val new_label : unit -> label
val set_label : label -> unit
val cur_label : unit -> label
type rec_flag =
  1. | Nonrecursive
  2. | Recursive
type phantom_defining_expr =
  1. | Cphantom_const_int of Targetint.t
    (*

    The phantom-let-bound variable is a constant integer. The argument must be the tagged representation of an integer within the range of type int on the target. (Analogously to Cconst_int.)

    *)
  2. | Cphantom_const_symbol of string
    (*

    The phantom-let-bound variable is an alias for a symbol.

    *)
  3. | Cphantom_var of Backend_var.t
    (*

    The phantom-let-bound variable is an alias for another variable. The aliased variable must not be a bound by a phantom let.

    *)
  4. | Cphantom_offset_var of {
    1. var : Backend_var.t;
    2. offset_in_words : int;
    }
    (*

    The phantom-let-bound-variable's value is defined by adding the given number of words to the pointer contained in the given identifier.

    *)
  5. | Cphantom_read_field of {
    1. var : Backend_var.t;
    2. field : int;
    }
    (*

    The phantom-let-bound-variable's value is found by adding the given number of words to the pointer contained in the given identifier, then dereferencing.

    *)
  6. | Cphantom_read_symbol_field of {
    1. sym : string;
    2. field : int;
    }
    (*

    As for Uphantom_read_var_field, but with the pointer specified by a symbol.

    *)
  7. | Cphantom_block of {
    1. tag : int;
    2. fields : Backend_var.t list;
    }
    (*

    The phantom-let-bound variable points at a block with the given structure.

    *)
type memory_chunk =
  1. | Byte_unsigned
  2. | Byte_signed
  3. | Sixteen_unsigned
  4. | Sixteen_signed
  5. | Thirtytwo_unsigned
  6. | Thirtytwo_signed
  7. | Word_int
  8. | Word_val
  9. | Single
  10. | Double
and operation =
  1. | Capply of machtype
  2. | Cextcall of string * machtype * exttype list * bool
    (*

    The machtype is the machine type of the result. The exttype list describes the unboxing types of the arguments. An empty list means "all arguments are machine words XInt".

    *)
  3. | Cload of memory_chunk * Asttypes.mutable_flag
  4. | Calloc
  5. | Cstore of memory_chunk * Lambda.initialization_or_assignment
  6. | Caddi
  7. | Csubi
  8. | Cmuli
  9. | Cmulhi
  10. | Cdivi
  11. | Cmodi
  12. | Cand
  13. | Cor
  14. | Cxor
  15. | Clsl
  16. | Clsr
  17. | Casr
  18. | Ccmpi of integer_comparison
  19. | Caddv
  20. | Cadda
  21. | Ccmpa of integer_comparison
  22. | Cnegf
  23. | Cabsf
  24. | Caddf
  25. | Csubf
  26. | Cmulf
  27. | Cdivf
  28. | Cfloatofint
  29. | Cintoffloat
  30. | Ccmpf of float_comparison
  31. | Craise of Lambda.raise_kind
  32. | Ccheckbound
  33. | Copaque
and expression =
  1. | Cconst_int of int * Debuginfo.t
  2. | Cconst_natint of nativeint * Debuginfo.t
  3. | Cconst_float of float * Debuginfo.t
  4. | Cconst_symbol of string * Debuginfo.t
  5. | Cvar of Backend_var.t
  6. | Clet of Backend_var.With_provenance.t * expression * expression
  7. | Clet_mut of Backend_var.With_provenance.t * machtype * expression * expression
  8. | Cphantom_let of Backend_var.With_provenance.t + machtype_component

Least upper bound of two machtype_components.

val ge_component : machtype_component -> machtype_component -> bool

Returns true iff the first supplied machtype_component is greater than or equal to the second under the relation used by lub_component.

type exttype =
  1. | XInt
    (*

    r OCaml value, word-sized integer

    *)
  2. | XInt32
    (*

    r 32-bit integer

    *)
  3. | XInt64
    (*

    r 64-bit integer

    *)
  4. | XFloat
    (*

    r double-precision FP number

    *)

A variant of machtype used to describe arguments to external C functions

val machtype_of_exttype : exttype -> machtype
val machtype_of_exttype_list : exttype list -> machtype
type integer_comparison = Lambda.integer_comparison =
  1. | Ceq
  2. | Cne
  3. | Clt
  4. | Cgt
  5. | Cle
  6. | Cge
val negate_integer_comparison : integer_comparison -> integer_comparison
val swap_integer_comparison : integer_comparison -> integer_comparison
type float_comparison = Lambda.float_comparison =
  1. | CFeq
  2. | CFneq
  3. | CFlt
  4. | CFnlt
  5. | CFgt
  6. | CFngt
  7. | CFle
  8. | CFnle
  9. | CFge
  10. | CFnge
val negate_float_comparison : float_comparison -> float_comparison
val swap_float_comparison : float_comparison -> float_comparison
type label = int
val new_label : unit -> label
val set_label : label -> unit
val cur_label : unit -> label
type rec_flag =
  1. | Nonrecursive
  2. | Recursive
type phantom_defining_expr =
  1. | Cphantom_const_int of Targetint.t
    (*

    The phantom-let-bound variable is a constant integer. The argument must be the tagged representation of an integer within the range of type int on the target. (Analogously to Cconst_int.)

    *)
  2. | Cphantom_const_symbol of string
    (*

    The phantom-let-bound variable is an alias for a symbol.

    *)
  3. | Cphantom_var of Backend_var.t
    (*

    The phantom-let-bound variable is an alias for another variable. The aliased variable must not be a bound by a phantom let.

    *)
  4. | Cphantom_offset_var of {
    1. var : Backend_var.t;
    2. offset_in_words : int;
    }
    (*

    The phantom-let-bound-variable's value is defined by adding the given number of words to the pointer contained in the given identifier.

    *)
  5. | Cphantom_read_field of {
    1. var : Backend_var.t;
    2. field : int;
    }
    (*

    The phantom-let-bound-variable's value is found by adding the given number of words to the pointer contained in the given identifier, then dereferencing.

    *)
  6. | Cphantom_read_symbol_field of {
    1. sym : string;
    2. field : int;
    }
    (*

    As for Uphantom_read_var_field, but with the pointer specified by a symbol.

    *)
  7. | Cphantom_block of {
    1. tag : int;
    2. fields : Backend_var.t list;
    }
    (*

    The phantom-let-bound variable points at a block with the given structure.

    *)
type memory_chunk =
  1. | Byte_unsigned
  2. | Byte_signed
  3. | Sixteen_unsigned
  4. | Sixteen_signed
  5. | Thirtytwo_unsigned
  6. | Thirtytwo_signed
  7. | Word_int
  8. | Word_val
  9. | Single
  10. | Double
and operation =
  1. | Capply of machtype
  2. | Cextcall of string * machtype * exttype list * bool
    (*

    The machtype is the machine type of the result. The exttype list describes the unboxing types of the arguments. An empty list means "all arguments are machine words XInt". The boolean indicates whether the function may allocate.

    *)
  3. | Cload of {
    1. memory_chunk : memory_chunk;
    2. mutability : Asttypes.mutable_flag;
    3. is_atomic : bool;
    }
  4. | Calloc
  5. | Cstore of memory_chunk * Lambda.initialization_or_assignment
  6. | Caddi
  7. | Csubi
  8. | Cmuli
  9. | Cmulhi
  10. | Cdivi
  11. | Cmodi
  12. | Cand
  13. | Cor
  14. | Cxor
  15. | Clsl
  16. | Clsr
  17. | Casr
  18. | Ccmpi of integer_comparison
  19. | Caddv
  20. | Cadda
  21. | Ccmpa of integer_comparison
  22. | Cnegf
  23. | Cabsf
  24. | Caddf
  25. | Csubf
  26. | Cmulf
  27. | Cdivf
  28. | Cfloatofint
  29. | Cintoffloat
  30. | Ccmpf of float_comparison
  31. | Craise of Lambda.raise_kind
  32. | Ccheckbound
  33. | Copaque
  34. | Cdls_get
and expression =
  1. | Cconst_int of int * Debuginfo.t
  2. | Cconst_natint of nativeint * Debuginfo.t
  3. | Cconst_float of float * Debuginfo.t
  4. | Cconst_symbol of string * Debuginfo.t
  5. | Cvar of Backend_var.t
  6. | Clet of Backend_var.With_provenance.t * expression * expression
  7. | Clet_mut of Backend_var.With_provenance.t * machtype * expression * expression
  8. | Cphantom_let of Backend_var.With_provenance.t * phantom_defining_expr option * expression
  9. | Cassign of Backend_var.t * expression
  10. | Ctuple of expression list
  11. | Cop of operation * expression list * Debuginfo.t
  12. | Csequence of expression * expression
  13. | Cifthenelse of expression * Debuginfo.t diff --git a/dev/ocaml/Cmm_helpers/index.html b/dev/ocaml/Cmm_helpers/index.html index 36d7078c..3480c4de 100644 --- a/dev/ocaml/Cmm_helpers/index.html +++ b/dev/ocaml/Cmm_helpers/index.html @@ -56,7 +56,7 @@ Debuginfo.t -> Cmm.expression -> Cmm.expression -> - Cmm.expression

Complex number creation and access

val return_unit : Debuginfo.t -> Cmm.expression -> Cmm.expression

Make the given expression return a unit value

val remove_unit : Cmm.expression -> Cmm.expression

Remove a trailing unit return if any

Blocks

val field_address : Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

field_address ptr n dbg returns an expression for the address of the nth field of the block pointed to by ptr

val get_field_gen : + Cmm.expression

Complex number creation and access

val return_unit : Debuginfo.t -> Cmm.expression -> Cmm.expression

Make the given expression return a unit value

val remove_unit : Cmm.expression -> Cmm.expression

Remove a trailing unit return if any

Blocks

val mk_load_mut : Cmm.memory_chunk -> Cmm.operation

Non-atomic load of a mutable field

val mk_load_atomic : Cmm.memory_chunk -> Cmm.operation

Atomic load. All atomic fields are mutable.

val field_address : Cmm.expression -> int -> Debuginfo.t -> Cmm.expression

field_address ptr n dbg returns an expression for the address of the nth field of the block pointed to by ptr

val get_field_gen : Asttypes.mutable_flag -> Cmm.expression -> int -> diff --git a/dev/ocaml/Cmm_invariants/index.html b/dev/ocaml/Cmm_invariants/index.html index 63d25d91..730fe1d5 100644 --- a/dev/ocaml/Cmm_invariants/index.html +++ b/dev/ocaml/Cmm_invariants/index.html @@ -1,2 +1,2 @@ -Cmm_invariants (ocaml.Cmm_invariants)

Module Cmm_invariants

run ppf fundecl analyses the given function, and returns whether any errors were encountered (with corresponding error messages printed on the given formatter).

\ No newline at end of file +Cmm_invariants (ocaml.Cmm_invariants)

Module Cmm_invariants

Check a number of continuation-related invariants

run ppf fundecl analyses the given function, and returns whether any errors were encountered (with corresponding error messages printed on the given formatter).

\ No newline at end of file diff --git a/dev/ocaml/Compilation_unit/Map/index.html b/dev/ocaml/Compilation_unit/Map/index.html index 04e073bc..4d6bd5e4 100644 --- a/dev/ocaml/Compilation_unit/Map/index.html +++ b/dev/ocaml/Compilation_unit/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12.0
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
val of_list : (key * 'a) list -> 'a t
val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Compilation_unit/Set/index.html b/dev/ocaml/Compilation_unit/Set/index.html index 19ad71ae..4c547f04 100644 --- a/dev/ocaml/Compilation_unit/Set/index.html +++ b/dev/ocaml/Compilation_unit/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Compilation_unit.Set)

Module Compilation_unit.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file +Set (ocaml.Compilation_unit.Set)

Module Compilation_unit.Set

include Set.S with type elt = T.t and type t = Set.Make(T).t
type elt = T.t

The type of the set elements.

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05

Iterators

val to_seq_from : elt -> t -> elt Stdlib.Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Stdlib.Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Stdlib.Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Stdlib.Seq.t -> t

Build a set from the given bindings

  • since 4.07
val output : out_channel -> t -> unit
val print : Stdlib.Format.formatter -> t -> unit
val to_string : t -> string
val of_list : elt list -> t
val map : (elt -> elt) -> t -> t
\ No newline at end of file diff --git a/dev/ocaml/Compmisc/index.html b/dev/ocaml/Compmisc/index.html index 954f6758..2714071c 100644 --- a/dev/ocaml/Compmisc/index.html +++ b/dev/ocaml/Compmisc/index.html @@ -1,2 +1,6 @@ -Compmisc (ocaml.Compmisc)

Module Compmisc

val init_path : ?dir:string -> unit -> unit
val initial_env : unit -> Env.t
val set_from_env : 'a option ref -> 'a Clflags.env_reader -> unit
val read_clflags_from_env : unit -> unit
val with_ppf_dump : file_prefix:string -> (Stdlib.Format.formatter -> 'a) -> 'a
\ No newline at end of file +Compmisc (ocaml.Compmisc)

Module Compmisc

val init_path : + ?auto_include:Load_path.auto_include_callback -> + ?dir:string -> + unit -> + unit
val initial_env : unit -> Env.t
val set_from_env : 'a option ref -> 'a Clflags.env_reader -> unit
val read_clflags_from_env : unit -> unit
val with_ppf_dump : file_prefix:string -> (Stdlib.Format.formatter -> 'a) -> 'a

auto_include find_in_dir fn is a callback function to be passed to Load_path.init and automatically adds -I +lib to the load path after displaying an alert.

\ No newline at end of file diff --git a/dev/ocaml/Condition/index.html b/dev/ocaml/Condition/index.html deleted file mode 100644 index 242ffff7..00000000 --- a/dev/ocaml/Condition/index.html +++ /dev/null @@ -1,8 +0,0 @@ - -Condition (ocaml.Condition)

Module Condition

Condition variables to synchronize between threads.

Condition variables are used when one thread wants to wait until another thread has finished doing something: the former thread 'waits' on the condition variable, the latter thread 'signals' the condition when it is done. Condition variables should always be protected by a mutex. The typical use is (if D is a shared data structure, m its mutex, and c is a condition variable):

Mutex.lock m;
-while (* some predicate P over D is not satisfied *) do
-  Condition.wait c m
-done;
-(* Modify D *)
-if (* the predicate P over D is now satisfied *) then Condition.signal c;
-Mutex.unlock m
type t

The type of condition variables.

val create : unit -> t

Return a new condition variable.

val wait : t -> Mutex.t -> unit

wait c m atomically unlocks the mutex m and suspends the calling process on the condition variable c. The process will restart after the condition variable c has been signalled. The mutex m is locked again before wait returns.

val signal : t -> unit

signal c restarts one of the processes waiting on the condition variable c.

val broadcast : t -> unit

broadcast c restarts all processes waiting on the condition variable c.

\ No newline at end of file diff --git a/dev/ocaml/Config/index.html b/dev/ocaml/Config/index.html index d5f8dfea..029d72ef 100644 --- a/dev/ocaml/Config/index.html +++ b/dev/ocaml/Config/index.html @@ -1,2 +1,2 @@ -Config (ocaml.Config)

Module Config

System configuration

Warning: this module is unstable and part of compiler-libs.

val version : string

The current version number of the system

val bindir : string

The directory containing the binary programs

val standard_library : string

The directory containing the standard libraries

val ccomp_type : string

The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

val c_compiler : string

The compiler to use for compiling C files

val c_output_obj : string

Name of the option of the C compiler for specifying the output file

val c_has_debug_prefix_map : bool

Whether the C compiler supports -fdebug-prefix-map

val as_has_debug_prefix_map : bool

Whether the assembler supports --debug-prefix-map

val ocamlc_cflags : string

The flags ocamlc should pass to the C compiler

val ocamlc_cppflags : string

The flags ocamlc should pass to the C preprocessor

val ocamlopt_cflags : string
  • deprecated

    ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

val ocamlopt_cppflags : string
  • deprecated

    ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

val bytecomp_c_libraries : string

The C libraries to link with custom runtimes

val native_c_libraries : string

The C libraries to link with native-code programs

val native_pack_linker : string

The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

val mkdll : string

The linker command line to build dynamic libraries.

val mkexe : string

The linker command line to build executables.

val mkmaindll : string

The linker command line to build main programs as dlls.

val default_rpath : string

Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

val mksharedlibrpath : string

Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

val ar : string

Name of the ar command, or "" if not needed (MSVC)

val interface_suffix : string ref

Suffix for interface file names

val exec_magic_number : string

Magic number for bytecode executable files

val cmi_magic_number : string

Magic number for compiled interface files

val cmo_magic_number : string

Magic number for object bytecode files

val cma_magic_number : string

Magic number for archive files

val cmx_magic_number : string

Magic number for compilation unit descriptions

val cmxa_magic_number : string

Magic number for libraries of compilation unit descriptions

val ast_intf_magic_number : string

Magic number for file holding an interface syntax tree

val ast_impl_magic_number : string

Magic number for file holding an implementation syntax tree

val cmxs_magic_number : string

Magic number for dynamically-loadable plugins

val cmt_magic_number : string

Magic number for compiled interface files

val linear_magic_number : string

Magic number for Linear internal representation files

val max_tag : int

Biggest tag that can be stored in the header of a regular block.

val lazy_tag : int

Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

val max_young_wosize : int

Maximal size of arrays that are directly allocated in the minor heap

val stack_threshold : int

Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

val stack_safety_margin : int

Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

val architecture : string

Name of processor type for the native-code compiler

val model : string

Name of processor submodel for the native-code compiler

val system : string

Name of operating system for the native-code compiler

val asm : string

The assembler (and flags) to use for assembling ocamlopt-generated code.

val asm_cfi_supported : bool

Whether assembler understands CFI directives

val with_frame_pointers : bool

Whether assembler should maintain frame pointers

val ext_obj : string

Extension for object files, e.g. .o under Unix.

val ext_asm : string

Extension for assembler files, e.g. .s under Unix.

val ext_lib : string

Extension for library files, e.g. .a under Unix.

val ext_dll : string

Extension for dynamically-loaded libraries, e.g. .so under Unix.

val ext_exe : string

Extension for executable programs, e.g. .exe under Windows.

  • since 4.12.0
val default_executable_name : string

Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

val systhread_supported : bool

Whether the system thread library is implemented

val flexdll_dirs : string list

Directories needed for the FlexDLL objects

val host : string

Whether the compiler is a cross-compiler

val target : string

Whether the compiler is a cross-compiler

val flambda : bool

Whether the compiler was configured for flambda

val with_flambda_invariants : bool

Whether the invariants checks for flambda are enabled

val with_cmm_invariants : bool

Whether the invariants checks for Cmm are enabled

val profinfo : bool

Whether the compiler was configured for profiling

val profinfo_width : int

How many bits are to be used in values' headers for profiling information

val safe_string : bool

Whether the compiler was configured with -force-safe-string; in that case, the -unsafe-string compile-time option is unavailable

  • since 4.05.0
val default_safe_string : bool

Whether the compiler was configured to use the -safe-string or -unsafe-string compile-time option by default.

  • since 4.06.0
val flat_float_array : bool

Whether the compiler and runtime automagically flatten float arrays

val function_sections : bool

Whether the compiler was configured to generate each function in a separate section

val windows_unicode : bool

Whether Windows Unicode runtime is enabled

val naked_pointers : bool

Whether the runtime supports naked pointers

  • since 4.14.0
val supports_shared_libraries : bool

Whether shared libraries are supported

  • since 4.08.0
val afl_instrument : bool

Whether afl-fuzz instrumentation is generated by default

val print_config : out_channel -> unit

Access to configuration values

val config_var : string -> string option

the configuration value of a variable, if it exists

\ No newline at end of file +Config (ocaml.Config)

Module Config

System configuration

Warning: this module is unstable and part of compiler-libs.

val version : string

The current version number of the system

val bindir : string

The directory containing the binary programs

val standard_library : string

The directory containing the standard libraries

val ccomp_type : string

The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

val c_compiler : string

The compiler to use for compiling C files

val c_output_obj : string

Name of the option of the C compiler for specifying the output file

val c_has_debug_prefix_map : bool

Whether the C compiler supports -fdebug-prefix-map

val as_has_debug_prefix_map : bool

Whether the assembler supports --debug-prefix-map

val ocamlc_cflags : string

The flags ocamlc should pass to the C compiler

val ocamlc_cppflags : string

The flags ocamlc should pass to the C preprocessor

val ocamlopt_cflags : string
  • deprecated

    ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

val ocamlopt_cppflags : string
  • deprecated

    ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

val bytecomp_c_libraries : string

The C libraries to link with custom runtimes

val native_c_libraries : string

The C libraries to link with native-code programs

val native_pack_linker : string

The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

val mkdll : string

The linker command line to build dynamic libraries.

val mkexe : string

The linker command line to build executables.

val mkmaindll : string

The linker command line to build main programs as dlls.

val default_rpath : string

Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

val mksharedlibrpath : string

Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

val ar : string

Name of the ar command, or "" if not needed (MSVC)

val interface_suffix : string ref

Suffix for interface file names

val exec_magic_number : string

Magic number for bytecode executable files

val cmi_magic_number : string

Magic number for compiled interface files

val cmo_magic_number : string

Magic number for object bytecode files

val cma_magic_number : string

Magic number for archive files

val cmx_magic_number : string

Magic number for compilation unit descriptions

val cmxa_magic_number : string

Magic number for libraries of compilation unit descriptions

val ast_intf_magic_number : string

Magic number for file holding an interface syntax tree

val ast_impl_magic_number : string

Magic number for file holding an implementation syntax tree

val cmxs_magic_number : string

Magic number for dynamically-loadable plugins

val cmt_magic_number : string

Magic number for compiled interface files

val linear_magic_number : string

Magic number for Linear internal representation files

val max_tag : int

Biggest tag that can be stored in the header of a regular block.

val lazy_tag : int

Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

val max_young_wosize : int

Maximal size of arrays that are directly allocated in the minor heap

val stack_threshold : int

Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

val stack_safety_margin : int

Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

val architecture : string

Name of processor type for the native-code compiler

val model : string

Name of processor submodel for the native-code compiler

val system : string

Name of operating system for the native-code compiler

val asm : string

The assembler (and flags) to use for assembling ocamlopt-generated code.

val asm_cfi_supported : bool

Whether assembler understands CFI directives

val with_frame_pointers : bool

Whether assembler should maintain frame pointers

val ext_obj : string

Extension for object files, e.g. .o under Unix.

val ext_asm : string

Extension for assembler files, e.g. .s under Unix.

val ext_lib : string

Extension for library files, e.g. .a under Unix.

val ext_dll : string

Extension for dynamically-loaded libraries, e.g. .so under Unix.

val ext_exe : string

Extension for executable programs, e.g. .exe under Windows.

  • since 4.12.0
val default_executable_name : string

Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

val systhread_supported : bool

Whether the system thread library is implemented

val flexdll_dirs : string list

Directories needed for the FlexDLL objects

val host : string

Whether the compiler is a cross-compiler

val target : string

Whether the compiler is a cross-compiler

val flambda : bool

Whether the compiler was configured for flambda

val with_flambda_invariants : bool

Whether the invariants checks for flambda are enabled

val with_cmm_invariants : bool

Whether the invariants checks for Cmm are enabled

val profinfo : bool

Whether the compiler was configured for profiling

val profinfo_width : int

How many bits are to be used in values' headers for profiling information

val flat_float_array : bool

Whether the compiler and runtime automagically flatten float arrays

val function_sections : bool

Whether the compiler was configured to generate each function in a separate section

val windows_unicode : bool

Whether Windows Unicode runtime is enabled

val naked_pointers : bool

Whether the runtime supports naked pointers

  • since 4.14.0
val supports_shared_libraries : bool

Whether shared libraries are supported

  • since 4.08.0
val afl_instrument : bool

Whether afl-fuzz instrumentation is generated by default

val print_config : out_channel -> unit

Access to configuration values

val config_var : string -> string option

the configuration value of a variable, if it exists

\ No newline at end of file diff --git a/dev/ocaml/Config_boot/index.html b/dev/ocaml/Config_boot/index.html new file mode 100644 index 00000000..c5437fc9 --- /dev/null +++ b/dev/ocaml/Config_boot/index.html @@ -0,0 +1,2 @@ + +Config_boot (ocaml.Config_boot)

Module Config_boot

System configuration

Warning: this module is unstable and part of compiler-libs.

val version : string

The current version number of the system

val bindir : string

The directory containing the binary programs

val standard_library : string

The directory containing the standard libraries

val ccomp_type : string

The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

val c_compiler : string

The compiler to use for compiling C files

val c_output_obj : string

Name of the option of the C compiler for specifying the output file

val c_has_debug_prefix_map : bool

Whether the C compiler supports -fdebug-prefix-map

val as_has_debug_prefix_map : bool

Whether the assembler supports --debug-prefix-map

val ocamlc_cflags : string

The flags ocamlc should pass to the C compiler

val ocamlc_cppflags : string

The flags ocamlc should pass to the C preprocessor

val ocamlopt_cflags : string
  • deprecated

    ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

val ocamlopt_cppflags : string
  • deprecated

    ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

val bytecomp_c_libraries : string

The C libraries to link with custom runtimes

val native_c_libraries : string

The C libraries to link with native-code programs

val native_pack_linker : string

The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

val mkdll : string

The linker command line to build dynamic libraries.

val mkexe : string

The linker command line to build executables.

val mkmaindll : string

The linker command line to build main programs as dlls.

val default_rpath : string

Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

val mksharedlibrpath : string

Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

val ar : string

Name of the ar command, or "" if not needed (MSVC)

val interface_suffix : string ref

Suffix for interface file names

val exec_magic_number : string

Magic number for bytecode executable files

val cmi_magic_number : string

Magic number for compiled interface files

val cmo_magic_number : string

Magic number for object bytecode files

val cma_magic_number : string

Magic number for archive files

val cmx_magic_number : string

Magic number for compilation unit descriptions

val cmxa_magic_number : string

Magic number for libraries of compilation unit descriptions

val ast_intf_magic_number : string

Magic number for file holding an interface syntax tree

val ast_impl_magic_number : string

Magic number for file holding an implementation syntax tree

val cmxs_magic_number : string

Magic number for dynamically-loadable plugins

val cmt_magic_number : string

Magic number for compiled interface files

val linear_magic_number : string

Magic number for Linear internal representation files

val max_tag : int

Biggest tag that can be stored in the header of a regular block.

val lazy_tag : int

Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

val max_young_wosize : int

Maximal size of arrays that are directly allocated in the minor heap

val stack_threshold : int

Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

val stack_safety_margin : int

Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

val architecture : string

Name of processor type for the native-code compiler

val model : string

Name of processor submodel for the native-code compiler

val system : string

Name of operating system for the native-code compiler

val asm : string

The assembler (and flags) to use for assembling ocamlopt-generated code.

val asm_cfi_supported : bool

Whether assembler understands CFI directives

val with_frame_pointers : bool

Whether assembler should maintain frame pointers

val ext_obj : string

Extension for object files, e.g. .o under Unix.

val ext_asm : string

Extension for assembler files, e.g. .s under Unix.

val ext_lib : string

Extension for library files, e.g. .a under Unix.

val ext_dll : string

Extension for dynamically-loaded libraries, e.g. .so under Unix.

val ext_exe : string

Extension for executable programs, e.g. .exe under Windows.

  • since 4.12.0
val default_executable_name : string

Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

val systhread_supported : bool

Whether the system thread library is implemented

val flexdll_dirs : string list

Directories needed for the FlexDLL objects

val host : string

Whether the compiler is a cross-compiler

val target : string

Whether the compiler is a cross-compiler

val flambda : bool

Whether the compiler was configured for flambda

val with_flambda_invariants : bool

Whether the invariants checks for flambda are enabled

val with_cmm_invariants : bool

Whether the invariants checks for Cmm are enabled

val profinfo : bool

Whether the compiler was configured for profiling

val profinfo_width : int

How many bits are to be used in values' headers for profiling information

val flat_float_array : bool

Whether the compiler and runtime automagically flatten float arrays

val function_sections : bool

Whether the compiler was configured to generate each function in a separate section

val windows_unicode : bool

Whether Windows Unicode runtime is enabled

val naked_pointers : bool

Whether the runtime supports naked pointers

  • since 4.14.0
val supports_shared_libraries : bool

Whether shared libraries are supported

  • since 4.08.0
val afl_instrument : bool

Whether afl-fuzz instrumentation is generated by default

val print_config : out_channel -> unit

Access to configuration values

val config_var : string -> string option

the configuration value of a variable, if it exists

\ No newline at end of file diff --git a/dev/ocaml/Config_main/index.html b/dev/ocaml/Config_main/index.html new file mode 100644 index 00000000..b973522b --- /dev/null +++ b/dev/ocaml/Config_main/index.html @@ -0,0 +1,2 @@ + +Config_main (ocaml.Config_main)

Module Config_main

System configuration

Warning: this module is unstable and part of compiler-libs.

val version : string

The current version number of the system

val bindir : string

The directory containing the binary programs

val standard_library : string

The directory containing the standard libraries

val ccomp_type : string

The "kind" of the C compiler, assembler and linker used: one of "cc" (for Unix-style C compilers) "msvc" (for Microsoft Visual C++ and MASM)

val c_compiler : string

The compiler to use for compiling C files

val c_output_obj : string

Name of the option of the C compiler for specifying the output file

val c_has_debug_prefix_map : bool

Whether the C compiler supports -fdebug-prefix-map

val as_has_debug_prefix_map : bool

Whether the assembler supports --debug-prefix-map

val ocamlc_cflags : string

The flags ocamlc should pass to the C compiler

val ocamlc_cppflags : string

The flags ocamlc should pass to the C preprocessor

val ocamlopt_cflags : string
  • deprecated

    ocamlc_cflags should be used instead. The flags ocamlopt should pass to the C compiler

val ocamlopt_cppflags : string
  • deprecated

    ocamlc_cppflags should be used instead. The flags ocamlopt should pass to the C preprocessor

val bytecomp_c_libraries : string

The C libraries to link with custom runtimes

val native_c_libraries : string

The C libraries to link with native-code programs

val native_pack_linker : string

The linker to use for packaging (ocamlopt -pack) and for partial links (ocamlopt -output-obj).

val mkdll : string

The linker command line to build dynamic libraries.

val mkexe : string

The linker command line to build executables.

val mkmaindll : string

The linker command line to build main programs as dlls.

val default_rpath : string

Option to add a directory to be searched for libraries at runtime (used by ocamlmklib)

val mksharedlibrpath : string

Option to add a directory to be searched for shared libraries at runtime (used by ocamlmklib)

val ar : string

Name of the ar command, or "" if not needed (MSVC)

val interface_suffix : string ref

Suffix for interface file names

val exec_magic_number : string

Magic number for bytecode executable files

val cmi_magic_number : string

Magic number for compiled interface files

val cmo_magic_number : string

Magic number for object bytecode files

val cma_magic_number : string

Magic number for archive files

val cmx_magic_number : string

Magic number for compilation unit descriptions

val cmxa_magic_number : string

Magic number for libraries of compilation unit descriptions

val ast_intf_magic_number : string

Magic number for file holding an interface syntax tree

val ast_impl_magic_number : string

Magic number for file holding an implementation syntax tree

val cmxs_magic_number : string

Magic number for dynamically-loadable plugins

val cmt_magic_number : string

Magic number for compiled interface files

val linear_magic_number : string

Magic number for Linear internal representation files

val max_tag : int

Biggest tag that can be stored in the header of a regular block.

val lazy_tag : int

Normally the same as Obj.lazy_tag. Separate definition because of technical reasons for bootstrapping.

val max_young_wosize : int

Maximal size of arrays that are directly allocated in the minor heap

val stack_threshold : int

Size in words of safe area at bottom of VM stack, see runtime/caml/config.h

val stack_safety_margin : int

Size in words of the safety margin between the bottom of the stack and the stack pointer. This margin can be used by intermediate computations of some instructions, or the event handler.

val architecture : string

Name of processor type for the native-code compiler

val model : string

Name of processor submodel for the native-code compiler

val system : string

Name of operating system for the native-code compiler

val asm : string

The assembler (and flags) to use for assembling ocamlopt-generated code.

val asm_cfi_supported : bool

Whether assembler understands CFI directives

val with_frame_pointers : bool

Whether assembler should maintain frame pointers

val ext_obj : string

Extension for object files, e.g. .o under Unix.

val ext_asm : string

Extension for assembler files, e.g. .s under Unix.

val ext_lib : string

Extension for library files, e.g. .a under Unix.

val ext_dll : string

Extension for dynamically-loaded libraries, e.g. .so under Unix.

val ext_exe : string

Extension for executable programs, e.g. .exe under Windows.

  • since 4.12.0
val default_executable_name : string

Name of executable produced by linking if none is given with -o, e.g. a.out under Unix.

val systhread_supported : bool

Whether the system thread library is implemented

val flexdll_dirs : string list

Directories needed for the FlexDLL objects

val host : string

Whether the compiler is a cross-compiler

val target : string

Whether the compiler is a cross-compiler

val flambda : bool

Whether the compiler was configured for flambda

val with_flambda_invariants : bool

Whether the invariants checks for flambda are enabled

val with_cmm_invariants : bool

Whether the invariants checks for Cmm are enabled

val profinfo : bool

Whether the compiler was configured for profiling

val profinfo_width : int

How many bits are to be used in values' headers for profiling information

val flat_float_array : bool

Whether the compiler and runtime automagically flatten float arrays

val function_sections : bool

Whether the compiler was configured to generate each function in a separate section

val windows_unicode : bool

Whether Windows Unicode runtime is enabled

val naked_pointers : bool

Whether the runtime supports naked pointers

  • since 4.14.0
val supports_shared_libraries : bool

Whether shared libraries are supported

  • since 4.08.0
val afl_instrument : bool

Whether afl-fuzz instrumentation is generated by default

val print_config : out_channel -> unit

Access to configuration values

val config_var : string -> string option

the configuration value of a variable, if it exists

\ No newline at end of file diff --git a/dev/ocaml/Consistbl/Make/argument-1-Module_name/Map/index.html b/dev/ocaml/Consistbl/Make/argument-1-Module_name/Map/index.html index 4b4c21b9..430c17d9 100644 --- a/dev/ocaml/Consistbl/Make/argument-1-Module_name/Map/index.html +++ b/dev/ocaml/Consistbl/Make/argument-1-Module_name/Map/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

  • since 3.12.0
val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

  • f' _key None None = None
  • f' _key (Some v) None = Some v
  • f' _key None (Some v) = Some v
  • f' key (Some v1) (Some v2) = f key v1 v2
  • since 4.03.0
val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

val for_all : (key -> 'a -> bool) -> 'a t -> bool

for_all f m checks if all the bindings of the map satisfy the predicate f.

  • since 3.12.0
val exists : (key -> 'a -> bool) -> 'a t -> bool

exists f m checks if at least one binding of the map satisfies the predicate f.

  • since 3.12.0
val filter : (key -> 'a -> bool) -> 'a t -> 'a t

filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

  • since 3.12.0
  • before 4.03

    Physical equality was not ensured.

val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

  • if f k v is None then k is not in the result,
  • if f k v is Some v' then the binding (k, v') is in the output map.

For example, the following function on maps whose values are lists

filter_map
   (fun _k li -> match li with [] -> None | _::tl -> Some tl)
-  m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

  • since 4.11.0
val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
\ No newline at end of file + m

drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

  • since 3.12.0
val cardinal : 'a t -> int

Return the number of bindings of a map.

  • since 3.12.0
val bindings : 'a t -> (key * 'a) list

Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

  • since 3.12.0
val min_binding : 'a t -> key * 'a

Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

  • since 3.12.0
val min_binding_opt : 'a t -> (key * 'a) option

Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

  • since 4.05
val max_binding : 'a t -> key * 'a

Same as min_binding, but returns the binding with the largest key in the given map.

  • since 3.12.0
val max_binding_opt : 'a t -> (key * 'a) option

Same as min_binding_opt, but returns the binding with the largest key in the given map.

  • since 4.05
val choose : 'a t -> key * 'a

Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 3.12.0
val choose_opt : 'a t -> (key * 'a) option

Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

  • since 4.05
val split : key -> 'a t -> 'a t * 'a option * 'a t

split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

  • since 3.12.0
val find : key -> 'a t -> 'a

find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

val find_opt : key -> 'a t -> 'a option

find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

  • since 4.05
val find_first : (key -> bool) -> 'a t -> key * 'a

find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

  • since 4.05
val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

  • since 4.05
val find_last : (key -> bool) -> 'a t -> key * 'a

find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

  • since 4.05
val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

Maps and Sequences

val to_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in ascending order of keys

  • since 4.07
val to_rev_seq : 'a t -> (key * 'a) Seq.t

Iterate on the whole map, in descending order of keys

  • since 4.12
val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

  • since 4.07
val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

Add the given bindings to the map, in order.

  • since 4.07
val of_seq : (key * 'a) Seq.t -> 'a t

Build a map from the given bindings

  • since 4.07
\ No newline at end of file diff --git a/dev/ocaml/Consistbl/Make/argument-1-Module_name/Set/index.html b/dev/ocaml/Consistbl/Make/argument-1-Module_name/Set/index.html index ec3a0060..cc260513 100644 --- a/dev/ocaml/Consistbl/Make/argument-1-Module_name/Set/index.html +++ b/dev/ocaml/Consistbl/Make/argument-1-Module_name/Set/index.html @@ -1,3 +1,3 @@ Set (ocaml.Consistbl.Make.Module_name.Set)

Module Module_name.Set

type elt = t

The type of the set elements.

type t

The type of sets.

val empty : t

The empty set.

val is_empty : t -> bool

Test whether a set is empty or not.

val mem : elt -> t -> bool

mem x s tests whether x belongs to the set s.

val add : elt -> t -> t

add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val singleton : elt -> t

singleton x returns the one-element set containing only x.

val remove : elt -> t -> t

remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val union : t -> t -> t

Set union.

val inter : t -> t -> t

Set intersection.

val disjoint : t -> t -> bool

Test if two sets are disjoint.

  • since 4.08.0
val diff : t -> t -> t

Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

val compare : t -> t -> int

Total ordering between sets. Can be used as the ordering function for doing sets of sets.

val equal : t -> t -> bool

equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

val subset : t -> t -> bool

subset s1 s2 tests whether the set s1 is a subset of the set s2.

val iter : (elt -> unit) -> t -> unit

iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

val map : (elt -> elt) -> t -> t

map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

  • since 4.04.0
val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02.0

Iterators

val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
\ No newline at end of file + aN, where a0,a1...aN are the elements of s.

The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

val for_all : (elt -> bool) -> t -> bool

for_all f s checks if all elements of the set satisfy the predicate f.

val exists : (elt -> bool) -> t -> bool

exists f s checks if at least one element of the set satisfies the predicate f.

val filter : (elt -> bool) -> t -> t

filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

  • before 4.03

    Physical equality was not ensured.

val filter_map : (elt -> elt option) -> t -> t

filter_map f s returns the set of all v such that f x = Some v for some element x of s.

For example,

filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

is the set of halves of the even elements of s.

If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

  • since 4.11.0
val partition : (elt -> bool) -> t -> t * t

partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

val cardinal : t -> int

Return the number of elements of a set.

val elements : t -> elt list

Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

val min_elt : t -> elt

Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

val min_elt_opt : t -> elt option

Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

  • since 4.05
val max_elt : t -> elt

Same as min_elt, but returns the largest element of the given set.

val max_elt_opt : t -> elt option

Same as min_elt_opt, but returns the largest element of the given set.

  • since 4.05
val choose : t -> elt

Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

val choose_opt : t -> elt option

Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

  • since 4.05
val split : elt -> t -> t * bool * t

split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

val find : elt -> t -> elt

find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

  • since 4.01.0
val find_opt : elt -> t -> elt option

find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

  • since 4.05
val find_first : (elt -> bool) -> t -> elt

find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

  • since 4.05
val find_first_opt : (elt -> bool) -> t -> elt option

find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

  • since 4.05
val find_last : (elt -> bool) -> t -> elt

find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

  • since 4.05
val find_last_opt : (elt -> bool) -> t -> elt option

find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

  • since 4.05
val of_list : elt list -> t

of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

  • since 4.02.0

Iterators

val to_seq_from : elt -> t -> elt Seq.t

to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

  • since 4.07
val to_seq : t -> elt Seq.t

Iterate on the whole set, in ascending order

  • since 4.07
val to_rev_seq : t -> elt Seq.t

Iterate on the whole set, in descending order

  • since 4.12
val add_seq : elt Seq.t -> t -> t

Add the given elements to the set, in order.

  • since 4.07
val of_seq : elt Seq.t -> t

Build a set from the given bindings

  • since 4.07
\ No newline at end of file diff --git a/dev/ocaml/Ctype/index.html b/dev/ocaml/Ctype/index.html index b6a1cac4..0b015878 100644 --- a/dev/ocaml/Ctype/index.html +++ b/dev/ocaml/Ctype/index.html @@ -35,8 +35,8 @@ Types.type_declaration
val existential_name : Types.constructor_description -> Types.type_expr -> - string
val instance_constructor : - ?in_pattern:(Env.t ref * int) -> + string
type existential_treatment =
  1. | Keep_existentials_flexible
  2. | Make_existentials_abstract of {
    1. env : Env.t ref;
    2. scope : int;
    }
val instance_parameterized_type : ?keep_names:bool -> diff --git a/dev/ocaml/Domainstate/index.html b/dev/ocaml/Domainstate/index.html index 8a7a2622..0788b3e5 100644 --- a/dev/ocaml/Domainstate/index.html +++ b/dev/ocaml/Domainstate/index.html @@ -1,2 +1,2 @@ -Domainstate (ocaml.Domainstate)

Module Domainstate

type t =
  1. | Domain_young_limit
  2. | Domain_young_ptr
  3. | Domain_exception_pointer
  4. | Domain_young_base
  5. | Domain_young_start
  6. | Domain_young_end
  7. | Domain_young_alloc_start
  8. | Domain_young_alloc_end
  9. | Domain_young_alloc_mid
  10. | Domain_young_trigger
  11. | Domain_minor_heap_wsz
  12. | Domain_in_minor_collection
  13. | Domain_extra_heap_resources_minor
  14. | Domain_ref_table
  15. | Domain_ephe_ref_table
  16. | Domain_custom_table
  17. | Domain_mark_stack
  18. | Domain_stack_low
  19. | Domain_stack_high
  20. | Domain_stack_threshold
  21. | Domain_extern_sp
  22. | Domain_trapsp
  23. | Domain_trap_barrier
  24. | Domain_external_raise
  25. | Domain_exn_bucket
  26. | Domain_top_of_stack
  27. | Domain_bottom_of_stack
  28. | Domain_last_return_address
  29. | Domain_gc_regs
  30. | Domain_backtrace_active
  31. | Domain_backtrace_pos
  32. | Domain_backtrace_buffer
  33. | Domain_backtrace_last_exn
  34. | Domain_compare_unordered
  35. | Domain_requested_major_slice
  36. | Domain_requested_minor_gc
  37. | Domain_local_roots
  38. | Domain_stat_minor_words
  39. | Domain_stat_promoted_words
  40. | Domain_stat_major_words
  41. | Domain_stat_minor_collections
  42. | Domain_stat_major_collections
  43. | Domain_stat_heap_wsz
  44. | Domain_stat_top_heap_wsz
  45. | Domain_stat_compactions
  46. | Domain_stat_forced_major_collections
  47. | Domain_stat_heap_chunks
  48. | Domain_eventlog_startup_timestamp
  49. | Domain_eventlog_startup_pid
  50. | Domain_eventlog_paused
  51. | Domain_eventlog_enabled
  52. | Domain_eventlog_out
  53. | Domain_extra_params
val idx_of_field : t -> int
\ No newline at end of file +Domainstate (ocaml.Domainstate)

Module Domainstate

val stack_ctx_words : int
type t =
  1. | Domain_young_limit
  2. | Domain_young_ptr
  3. | Domain_young_start
  4. | Domain_young_end
  5. | Domain_current_stack
  6. | Domain_exn_handler
  7. | Domain_action_pending
  8. | Domain_c_stack
  9. | Domain_stack_cache
  10. | Domain_gc_regs_buckets
  11. | Domain_gc_regs
  12. | Domain_minor_tables
  13. | Domain_mark_stack
  14. | Domain_marking_done
  15. | Domain_sweeping_done
  16. | Domain_allocated_words
  17. | Domain_swept_words
  18. | Domain_major_work_computed
  19. | Domain_major_work_todo
  20. | Domain_major_gc_clock
  21. | Domain_local_roots
  22. | Domain_ephe_info
  23. | Domain_final_info
  24. | Domain_backtrace_pos
  25. | Domain_backtrace_active
  26. | Domain_backtrace_buffer
  27. | Domain_backtrace_last_exn
  28. | Domain_compare_unordered
  29. | Domain_oo_next_id_local
  30. | Domain_requested_major_slice
  31. | Domain_requested_minor_gc
  32. | Domain_requested_external_interrupt
  33. | Domain_parser_trace
  34. | Domain_minor_heap_wsz
  35. | Domain_shared_heap
  36. | Domain_id
  37. | Domain_unique_id
  38. | Domain_pools_to_rescan
  39. | Domain_pools_to_rescan_len
  40. | Domain_pools_to_rescan_count
  41. | Domain_dls_root
  42. | Domain_extra_heap_resources
  43. | Domain_extra_heap_resources_minor
  44. | Domain_dependent_size
  45. | Domain_dependent_allocated
  46. | Domain_extern_state
  47. | Domain_intern_state
  48. | Domain_stat_minor_words
  49. | Domain_stat_promoted_words
  50. | Domain_stat_major_words
  51. | Domain_stat_minor_collections
  52. | Domain_stat_forced_major_collections
  53. | Domain_stat_blocks_marked
  54. | Domain_inside_stw_handler
  55. | Domain_trap_sp_off
  56. | Domain_trap_barrier_off
  57. | Domain_trap_barrier_block
  58. | Domain_external_raise
  59. | Domain_extra_params
val idx_of_field : t -> int
\ No newline at end of file diff --git a/dev/ocaml/Emitaux/index.html b/dev/ocaml/Emitaux/index.html index b6739dc7..92e0b0ea 100644 --- a/dev/ocaml/Emitaux/index.html +++ b/dev/ocaml/Emitaux/index.html @@ -8,4 +8,8 @@ frame_size:int -> live_offset:int list -> frame_debuginfo -> - unit
type emit_frame_actions = {
  1. efa_code_label : int -> unit;
  2. efa_data_label : int -> unit;
  3. efa_8 : int -> unit;
  4. efa_16 : int -> unit;
  5. efa_32 : int32 -> unit;
  6. efa_word : int -> unit;
  7. efa_align : int -> unit;
  8. efa_label_rel : int -> int32 -> unit;
  9. efa_def_label : int -> unit;
  10. efa_string : string -> unit;
}
val emit_frames : emit_frame_actions -> unit
val is_generic_function : string -> bool
val cfi_startproc : unit -> unit
val cfi_endproc : unit -> unit
val cfi_adjust_cfa_offset : int -> unit
val cfi_offset : reg:int -> offset:int -> unit
val binary_backend_available : bool ref

Is a binary backend available. If yes, we don't need to generate the textual assembly file (unless the user request it with -S).

val create_asm_file : bool ref

Are we actually generating the textual assembly file?

type error =
  1. | Stack_frame_too_large of int
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
\ No newline at end of file + unit
type emit_frame_actions = {
  1. efa_code_label : int -> unit;
  2. efa_data_label : int -> unit;
  3. efa_8 : int -> unit;
  4. efa_16 : int -> unit;
  5. efa_32 : int32 -> unit;
  6. efa_word : int -> unit;
  7. efa_align : int -> unit;
  8. efa_label_rel : int -> int32 -> unit;
  9. efa_def_label : int -> unit;
  10. efa_string : string -> unit;
}
val emit_frames : emit_frame_actions -> unit
val is_generic_function : string -> bool
val cfi_startproc : unit -> unit
val cfi_endproc : unit -> unit
val cfi_adjust_cfa_offset : int -> unit
val cfi_offset : reg:int -> offset:int -> unit
val cfi_def_cfa_offset : int -> unit
val cfi_remember_state : unit -> unit
val cfi_restore_state : unit -> unit
val cfi_def_cfa_register : reg:int -> unit
val binary_backend_available : bool ref

Is a binary backend available. If yes, we don't need to generate the textual assembly file (unless the user request it with -S).

val create_asm_file : bool ref

Are we actually generating the textual assembly file?

type error =
  1. | Stack_frame_too_large of int
exception Error of error
val report_error : Stdlib.Format.formatter -> error -> unit
type preproc_stack_check_result = {
  1. max_frame_size : int;
  2. contains_nontail_calls : bool;
}
val preproc_stack_check : + fun_body:Linear.instruction -> + frame_size:int -> + trap_size:int -> + preproc_stack_check_result
\ No newline at end of file diff --git a/dev/ocaml/Env/index.html b/dev/ocaml/Env/index.html index a115599c..426f0ac0 100644 --- a/dev/ocaml/Env/index.html +++ b/dev/ocaml/Env/index.html @@ -2,7 +2,7 @@ Env (ocaml.Env)

Module Env

val register_uid : Types.Uid.t -> Location.t -> unit
val get_uid_to_loc_tbl : unit -> Location.t Types.Uid.Tbl.t
type value_unbound_reason =
  1. | Val_unbound_instance_variable
  2. | Val_unbound_self
  3. | Val_unbound_ancestor
  4. | Val_unbound_ghost_recursive of Location.t
type module_unbound_reason =
  1. | Mod_unbound_illegal_recursion
type summary =
  1. | Env_empty
  2. | Env_value of summary * Ident.t * Types.value_description
  3. | Env_type of summary * Ident.t * Types.type_declaration
  4. | Env_extension of summary * Ident.t * Types.extension_constructor
  5. | Env_module of summary * Ident.t * Types.module_presence - * Types.module_declaration
  6. | Env_modtype of summary * Ident.t * Types.modtype_declaration
  7. | Env_class of summary * Ident.t * Types.class_declaration
  8. | Env_cltype of summary * Ident.t * Types.class_type_declaration
  9. | Env_open of summary * Path.t
    (*

    The string set argument of Env_open represents a list of module names to skip, i.e. that won't be imported in the toplevel namespace.

    *)
  10. | Env_functor_arg of summary * Ident.t
  11. | Env_constraints of summary * Types.type_declaration Path.Map.t
  12. | Env_copy_types of summary
  13. | Env_persistent of summary * Ident.t
  14. | Env_value_unbound of summary * string * value_unbound_reason
  15. | Env_module_unbound of summary * string * module_unbound_reason
type address =
  1. | Aident of Ident.t
  2. | Adot of address * int
type t
val empty : t
val initial_safe_string : t
val initial_unsafe_string : t
val diff : t -> t -> Ident.t list
type type_descr_kind = + * Types.module_declaration
  • | Env_modtype of summary * Ident.t * Types.modtype_declaration
  • | Env_class of summary * Ident.t * Types.class_declaration
  • | Env_cltype of summary * Ident.t * Types.class_type_declaration
  • | Env_open of summary * Path.t
    (*

    The string set argument of Env_open represents a list of module names to skip, i.e. that won't be imported in the toplevel namespace.

    *)
  • | Env_functor_arg of summary * Ident.t
  • | Env_constraints of summary * Types.type_declaration Path.Map.t
  • | Env_copy_types of summary
  • | Env_persistent of summary * Ident.t
  • | Env_value_unbound of summary * string * value_unbound_reason
  • | Env_module_unbound of summary * string * module_unbound_reason
  • type address =
    1. | Aident of Ident.t
    2. | Adot of address * int
    type t
    val empty : t
    val initial : t
    val diff : t -> t -> Ident.t list
    type type_descriptions = type_descr_kind
    type iter_cont
    val iter_types : (Path.t -> (Path.t * Types.type_declaration) -> unit) -> t -> diff --git a/dev/ocaml/Export_id/Map/index.html b/dev/ocaml/Export_id/Map/index.html index d796c7e6..df813e19 100644 --- a/dev/ocaml/Export_id/Map/index.html +++ b/dev/ocaml/Export_id/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Export_id/Set/index.html b/dev/ocaml/Export_id/Set/index.html index 5557a57a..ef863138 100644 --- a/dev/ocaml/Export_id/Set/index.html +++ b/dev/ocaml/Export_id/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Export_id.Set)

    Module Export_id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Export_id.Set)

    Module Export_id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Flambda/Constant_defining_value/Map/index.html b/dev/ocaml/Flambda/Constant_defining_value/Map/index.html index 8e9eb2d5..394be02f 100644 --- a/dev/ocaml/Flambda/Constant_defining_value/Map/index.html +++ b/dev/ocaml/Flambda/Constant_defining_value/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Flambda/Constant_defining_value/Set/index.html b/dev/ocaml/Flambda/Constant_defining_value/Set/index.html index 1f6793cb..3cde19c1 100644 --- a/dev/ocaml/Flambda/Constant_defining_value/Set/index.html +++ b/dev/ocaml/Flambda/Constant_defining_value/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Flambda.Constant_defining_value.Set)

    Module Constant_defining_value.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Flambda.Constant_defining_value.Set)

    Module Constant_defining_value.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Ident/Map/index.html b/dev/ocaml/Ident/Map/index.html index 30722ab1..9e94f80a 100644 --- a/dev/ocaml/Ident/Map/index.html +++ b/dev/ocaml/Ident/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Ident/Set/index.html b/dev/ocaml/Ident/Set/index.html index ec430bbe..2b181471 100644 --- a/dev/ocaml/Ident/Set/index.html +++ b/dev/ocaml/Ident/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Ident.Set)

    Module Ident.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Ident.Set)

    Module Ident.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Ident/index.html b/dev/ocaml/Ident/index.html index 9cccab81..9b3341fe 100644 --- a/dev/ocaml/Ident/index.html +++ b/dev/ocaml/Ident/index.html @@ -1,2 +1,2 @@ -Ident (ocaml.Ident)

    Module Ident

    type t
    include Identifiable.S with type t := t
    module T : Identifiable.Thing with type t = t
    include Identifiable.Thing with type t := T.t
    include Hashtbl.HashedType with type t := T.t
    val equal : T.t -> T.t -> bool

    The equality predicate used to compare keys.

    val hash : T.t -> int

    A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

    • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
    • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
    • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
    include Map.OrderedType with type t := T.t
    val output : out_channel -> T.t -> unit
    val print : Stdlib.Format.formatter -> T.t -> unit
    module Set : Identifiable.Set with module T := T
    module Map : Identifiable.Map with module T := T
    module Tbl : Identifiable.Tbl with module T := T
    val print_with_scope : Stdlib.Format.formatter -> t -> unit

    Same as print except that it will also add a "n" suffix if the scope of the argument is n.

    val create_scoped : scope:int -> string -> t
    val create_local : string -> t
    val create_persistent : string -> t
    val create_predef : string -> t
    val rename : t -> t

    Creates an identifier with the same name as the input, a fresh stamp, and no scope.

    • raises [Fatal_error]

      if called on a persistent / predef ident.

    val name : t -> string
    val unique_name : t -> string
    val unique_toplevel_name : t -> string
    val persistent : t -> bool
    val same : t -> t -> bool

    Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

    val compare : t -> t -> int
    val global : t -> bool
    val is_predef : t -> bool
    val scope : t -> int
    val lowest_scope : int
    val highest_scope : int
    val reinit : unit -> unit
    type 'a tbl
    val empty : 'a tbl
    val add : t -> 'a -> 'a tbl -> 'a tbl
    val find_same : t -> 'a tbl -> 'a
    val find_name : string -> 'a tbl -> t * 'a
    val find_all : string -> 'a tbl -> (t * 'a) list
    val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val iter : (t -> 'a -> unit) -> 'a tbl -> unit
    val remove : t -> 'a tbl -> 'a tbl
    val make_key_generator : unit -> t -> t
    \ No newline at end of file +Ident (ocaml.Ident)

    Module Ident

    type t
    include Identifiable.S with type t := t
    module T : Identifiable.Thing with type t = t
    include Identifiable.Thing with type t := T.t
    include Hashtbl.HashedType with type t := T.t
    val equal : T.t -> T.t -> bool

    The equality predicate used to compare keys.

    val hash : T.t -> int

    A hashing function on keys. It must be such that if two keys are equal according to equal, then they have identical hash values as computed by hash. Examples: suitable (equal, hash) pairs for arbitrary key types include

    • ((=), hash) for comparing objects by structure (provided objects do not contain floats)
    • ((fun x y -> compare x y = 0), hash) for comparing objects by structure and handling Stdlib.nan correctly
    • ((==), hash) for comparing objects by physical equality (e.g. for mutable or cyclic objects).
    include Map.OrderedType with type t := T.t
    val output : out_channel -> T.t -> unit
    val print : Stdlib.Format.formatter -> T.t -> unit
    module Set : Identifiable.Set with module T := T
    module Map : Identifiable.Map with module T := T
    module Tbl : Identifiable.Tbl with module T := T
    val print_with_scope : Stdlib.Format.formatter -> t -> unit

    Same as print except that it will also add a "n" suffix if the scope of the argument is n.

    val create_scoped : scope:int -> string -> t
    val create_local : string -> t
    val create_persistent : string -> t
    val create_predef : string -> t
    val rename : t -> t

    Creates an identifier with the same name as the input, a fresh stamp, and no scope.

    • raises [Fatal_error]

      if called on a persistent / predef ident.

    val name : t -> string
    val unique_name : t -> string
    val unique_toplevel_name : t -> string
    val persistent : t -> bool
    val same : t -> t -> bool

    Compare identifiers by binding location. Two identifiers are the same either if they are both non-persistent and have been created by the same call to create_*, or if they are both persistent and have the same name.

    val compare : t -> t -> int
    val global : t -> bool
    val is_predef : t -> bool
    val scope : t -> int
    val lowest_scope : int
    val highest_scope : int
    val reinit : unit -> unit
    type 'a tbl

    'a tbl represents association tables from identifiers to values of type 'a.

    'a tbl plays the role of map, but bindings can be looked up from either the full Ident using find_same, or just its user-visible name using find_name. In general the two lookups may not return the same result, as an identifier may have been shadowed in the environment by a distinct identifier with the same name.

    find_all returns the bindings for all idents of a given name, most recently introduced first.

    In other words, 'a tbl corresponds to (Ident.t * 'a) list Map.Make(String) and the implementation is very close to that representation.

    Note in particular that searching among idents of the same name takes linear time, and that add simply extends the list without checking for duplicates. So it is not a good idea to implement union by repeated add calls, which may result in many duplicated identifiers and poor find_same performance. It is even possible to build overly large same-name lists such that non-recursive functions like find_all or fold_all blow the stack.

    You should probably use Map.Make(Ident) instead, unless you really need to query bindings by user-visible name, not just by unique identifiers.

    val empty : 'a tbl
    val add : t -> 'a -> 'a tbl -> 'a tbl
    val find_same : t -> 'a tbl -> 'a
    val find_name : string -> 'a tbl -> t * 'a
    val find_all : string -> 'a tbl -> (t * 'a) list
    val fold_name : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val fold_all : (t -> 'a -> 'b -> 'b) -> 'a tbl -> 'b -> 'b
    val iter : (t -> 'a -> unit) -> 'a tbl -> unit
    val remove : t -> 'a tbl -> 'a tbl
    val make_key_generator : unit -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Identifiable/Make/Map/index.html b/dev/ocaml/Identifiable/Make/Map/index.html index 33510002..1d8a0271 100644 --- a/dev/ocaml/Identifiable/Make/Map/index.html +++ b/dev/ocaml/Identifiable/Make/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Identifiable/Make/Set/index.html b/dev/ocaml/Identifiable/Make/Set/index.html index d56c6b87..1773e2fa 100644 --- a/dev/ocaml/Identifiable/Make/Set/index.html +++ b/dev/ocaml/Identifiable/Make/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Identifiable.Make.Set)

    Module Make.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Identifiable.Make.Set)

    Module Make.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Identifiable/module-type-Map/index.html b/dev/ocaml/Identifiable/module-type-Map/index.html index 15776b88..e7058534 100644 --- a/dev/ocaml/Identifiable/module-type-Map/index.html +++ b/dev/ocaml/Identifiable/module-type-Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Identifiable/module-type-S/Map/index.html b/dev/ocaml/Identifiable/module-type-S/Map/index.html index dfa2b45b..24be461f 100644 --- a/dev/ocaml/Identifiable/module-type-S/Map/index.html +++ b/dev/ocaml/Identifiable/module-type-S/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Identifiable/module-type-S/Set/index.html b/dev/ocaml/Identifiable/module-type-S/Set/index.html index f8aa7096..b0c0084e 100644 --- a/dev/ocaml/Identifiable/module-type-S/Set/index.html +++ b/dev/ocaml/Identifiable/module-type-S/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Identifiable.S.Set)

    Module S.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Identifiable.S.Set)

    Module S.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Identifiable/module-type-Set/index.html b/dev/ocaml/Identifiable/module-type-Set/index.html index 5191eabf..c7c3a0ce 100644 --- a/dev/ocaml/Identifiable/module-type-Set/index.html +++ b/dev/ocaml/Identifiable/module-type-Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Identifiable.Set)

    Module type Identifiable.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Identifiable.Set)

    Module type Identifiable.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Includemod/FieldMap/index.html b/dev/ocaml/Includemod/FieldMap/index.html index 363aac83..defe58af 100644 --- a/dev/ocaml/Includemod/FieldMap/index.html +++ b/dev/ocaml/Includemod/FieldMap/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Instruct/index.html b/dev/ocaml/Instruct/index.html index cba65722..ea4975bc 100644 --- a/dev/ocaml/Instruct/index.html +++ b/dev/ocaml/Instruct/index.html @@ -1,2 +1,2 @@ -Instruct (ocaml.Instruct)

    Module Instruct

    type compilation_env = {
    1. ce_stack : int Ident.tbl;
    2. ce_heap : int Ident.tbl;
    3. ce_rec : int Ident.tbl;
    }
    type debug_event = {
    1. mutable ev_pos : int;
    2. ev_module : string;
    3. ev_loc : Location.t;
    4. ev_kind : debug_event_kind;
    5. ev_defname : string;
    6. ev_info : debug_event_info;
    7. ev_typenv : Env.summary;
    8. ev_typsubst : Subst.t;
    9. ev_compenv : compilation_env;
    10. ev_stacksize : int;
    11. ev_repr : debug_event_repr;
    }
    and debug_event_kind =
    1. | Event_before
    2. | Event_after of Types.type_expr
    3. | Event_pseudo
    and debug_event_info =
    1. | Event_function
    2. | Event_return of int
    3. | Event_other
    and debug_event_repr =
    1. | Event_none
    2. | Event_parent of int ref
    3. | Event_child of int ref
    type label = int
    type instruction =
    1. | Klabel of label
    2. | Kacc of int
    3. | Kenvacc of int
    4. | Kpush
    5. | Kpop of int
    6. | Kassign of int
    7. | Kpush_retaddr of label
    8. | Kapply of int
    9. | Kappterm of int * int
    10. | Kreturn of int
    11. | Krestart
    12. | Kgrab of int
    13. | Kclosure of label * int
    14. | Kclosurerec of label list * int
    15. | Koffsetclosure of int
    16. | Kgetglobal of Ident.t
    17. | Ksetglobal of Ident.t
    18. | Kconst of Lambda.structured_constant
    19. | Kmakeblock of int * int
    20. | Kmakefloatblock of int
    21. | Kgetfield of int
    22. | Ksetfield of int
    23. | Kgetfloatfield of int
    24. | Ksetfloatfield of int
    25. | Kvectlength
    26. | Kgetvectitem
    27. | Ksetvectitem
    28. | Kgetstringchar
    29. | Kgetbyteschar
    30. | Ksetbyteschar
    31. | Kbranch of label
    32. | Kbranchif of label
    33. | Kbranchifnot of label
    34. | Kstrictbranchif of label
    35. | Kstrictbranchifnot of label
    36. | Kswitch of label array * label array
    37. | Kboolnot
    38. | Kpushtrap of label
    39. | Kpoptrap
    40. | Kraise of Lambda.raise_kind
    41. | Kcheck_signals
    42. | Kccall of string * int
    43. | Knegint
    44. | Kaddint
    45. | Ksubint
    46. | Kmulint
    47. | Kdivint
    48. | Kmodint
    49. | Kandint
    50. | Korint
    51. | Kxorint
    52. | Klslint
    53. | Klsrint
    54. | Kasrint
    55. | Kintcomp of Lambda.integer_comparison
    56. | Koffsetint of int
    57. | Koffsetref of int
    58. | Kisint
    59. | Kisout
    60. | Kgetmethod
    61. | Kgetpubmet of int
    62. | Kgetdynmet
    63. | Kevent of debug_event
    64. | Kstop
    val immed_min : int
    val immed_max : int
    \ No newline at end of file +Instruct (ocaml.Instruct)

    Module Instruct

    type compilation_env = {
    1. ce_stack : int Ident.tbl;
    2. ce_heap : int Ident.tbl;
    3. ce_rec : int Ident.tbl;
    }
    type debug_event = {
    1. mutable ev_pos : int;
    2. ev_module : string;
    3. ev_loc : Location.t;
    4. ev_kind : debug_event_kind;
    5. ev_defname : string;
    6. ev_info : debug_event_info;
    7. ev_typenv : Env.summary;
    8. ev_typsubst : Subst.t;
    9. ev_compenv : compilation_env;
    10. ev_stacksize : int;
    11. ev_repr : debug_event_repr;
    }
    and debug_event_kind =
    1. | Event_before
    2. | Event_after of Types.type_expr
    3. | Event_pseudo
    and debug_event_info =
    1. | Event_function
    2. | Event_return of int
    3. | Event_other
    and debug_event_repr =
    1. | Event_none
    2. | Event_parent of int ref
    3. | Event_child of int ref
    type label = int
    type instruction =
    1. | Klabel of label
    2. | Kacc of int
    3. | Kenvacc of int
    4. | Kpush
    5. | Kpop of int
    6. | Kassign of int
    7. | Kpush_retaddr of label
    8. | Kapply of int
    9. | Kappterm of int * int
    10. | Kreturn of int
    11. | Krestart
    12. | Kgrab of int
    13. | Kclosure of label * int
    14. | Kclosurerec of label list * int
    15. | Koffsetclosure of int
    16. | Kgetglobal of Ident.t
    17. | Ksetglobal of Ident.t
    18. | Kconst of Lambda.structured_constant
    19. | Kmakeblock of int * int
    20. | Kmakefloatblock of int
    21. | Kgetfield of int
    22. | Ksetfield of int
    23. | Kgetfloatfield of int
    24. | Ksetfloatfield of int
    25. | Kvectlength
    26. | Kgetvectitem
    27. | Ksetvectitem
    28. | Kgetstringchar
    29. | Kgetbyteschar
    30. | Ksetbyteschar
    31. | Kbranch of label
    32. | Kbranchif of label
    33. | Kbranchifnot of label
    34. | Kstrictbranchif of label
    35. | Kstrictbranchifnot of label
    36. | Kswitch of label array * label array
    37. | Kboolnot
    38. | Kpushtrap of label
    39. | Kpoptrap
    40. | Kraise of Lambda.raise_kind
    41. | Kcheck_signals
    42. | Kccall of string * int
    43. | Knegint
    44. | Kaddint
    45. | Ksubint
    46. | Kmulint
    47. | Kdivint
    48. | Kmodint
    49. | Kandint
    50. | Korint
    51. | Kxorint
    52. | Klslint
    53. | Klsrint
    54. | Kasrint
    55. | Kintcomp of Lambda.integer_comparison
    56. | Koffsetint of int
    57. | Koffsetref of int
    58. | Kisint
    59. | Kisout
    60. | Kgetmethod
    61. | Kgetpubmet of int
    62. | Kgetdynmet
    63. | Kevent of debug_event
    64. | Kperform
    65. | Kresume
    66. | Kresumeterm of int
    67. | Kreperformterm of int
    68. | Kstop
    val immed_min : int
    val immed_max : int
    \ No newline at end of file diff --git a/dev/ocaml/Lambda/index.html b/dev/ocaml/Lambda/index.html index c1a73a09..811a652e 100644 --- a/dev/ocaml/Lambda/index.html +++ b/dev/ocaml/Lambda/index.html @@ -1,5 +1,5 @@ -Lambda (ocaml.Lambda)

    Module Lambda

    type compile_time_constant =
    1. | Big_endian
    2. | Word_size
    3. | Int_size
    4. | Max_wosize
    5. | Ostype_unix
    6. | Ostype_win32
    7. | Ostype_cygwin
    8. | Backend_type
    type immediate_or_pointer =
    1. | Immediate
    2. | Pointer
    type initialization_or_assignment =
    1. | Assignment
    2. | Heap_initialization
    3. | Root_initialization
    type is_safe =
    1. | Safe
    2. | Unsafe
    type primitive =
    1. | Pbytes_to_string
    2. | Pbytes_of_string
    3. | Pignore
    4. | Pgetglobal of Ident.t
    5. | Psetglobal of Ident.t
    6. | Pmakeblock of int * Asttypes.mutable_flag * block_shape
    7. | Pfield of int
    8. | Pfield_computed
    9. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
    10. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
    11. | Pfloatfield of int
    12. | Psetfloatfield of int * initialization_or_assignment
    13. | Pduprecord of Types.record_representation * int
    14. | Pccall of Primitive.description
    15. | Praise of raise_kind
    16. | Psequand
    17. | Psequor
    18. | Pnot
    19. | Pnegint
    20. | Paddint
    21. | Psubint
    22. | Pmulint
    23. | Pdivint of is_safe
    24. | Pmodint of is_safe
    25. | Pandint
    26. | Porint
    27. | Pxorint
    28. | Plslint
    29. | Plsrint
    30. | Pasrint
    31. | Pintcomp of integer_comparison
    32. | Pcompare_ints
    33. | Pcompare_floats
    34. | Pcompare_bints of boxed_integer
    35. | Poffsetint of int
    36. | Poffsetref of int
    37. | Pintoffloat
    38. | Pfloatofint
    39. | Pnegfloat
    40. | Pabsfloat
    41. | Paddfloat
    42. | Psubfloat
    43. | Pmulfloat
    44. | Pdivfloat
    45. | Pfloatcomp of float_comparison
    46. | Pstringlength
    47. | Pstringrefu
    48. | Pstringrefs
    49. | Pbyteslength
    50. | Pbytesrefu
    51. | Pbytessetu
    52. | Pbytesrefs
    53. | Pbytessets
    54. | Pmakearray of array_kind * Asttypes.mutable_flag
    55. | Pduparray of array_kind * Asttypes.mutable_flag
      (*

      For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

      *)
    56. | Parraylength of array_kind
    57. | Parrayrefu of array_kind
    58. | Parraysetu of array_kind
    59. | Parrayrefs of array_kind
    60. | Parraysets of array_kind
    61. | Pisint
    62. | Pisout
    63. | Pbintofint of boxed_integer
    64. | Pintofbint of boxed_integer
    65. | Pcvtbint of boxed_integer * boxed_integer
    66. | Pnegbint of boxed_integer
    67. | Paddbint of boxed_integer
    68. | Psubbint of boxed_integer
    69. | Pmulbint of boxed_integer
    70. | Pdivbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    71. | Pmodbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    72. | Pandbint of boxed_integer
    73. | Porbint of boxed_integer
    74. | Pxorbint of boxed_integer
    75. | Plslbint of boxed_integer
    76. | Plsrbint of boxed_integer
    77. | Pasrbint of boxed_integer
    78. | Pbintcomp of boxed_integer * integer_comparison
    79. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
    80. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
    81. | Pbigarraydim of int
    82. | Pstring_load_16 of bool
    83. | Pstring_load_32 of bool
    84. | Pstring_load_64 of bool
    85. | Pbytes_load_16 of bool
    86. | Pbytes_load_32 of bool
    87. | Pbytes_load_64 of bool
    88. | Pbytes_set_16 of bool
    89. | Pbytes_set_32 of bool
    90. | Pbytes_set_64 of bool
    91. | Pbigstring_load_16 of bool
    92. | Pbigstring_load_32 of bool
    93. | Pbigstring_load_64 of bool
    94. | Pbigstring_set_16 of bool
    95. | Pbigstring_set_32 of bool
    96. | Pbigstring_set_64 of bool
    97. | Pctconst of compile_time_constant
    98. | Pbswap16
    99. | Pbbswap of boxed_integer
    100. | Pint_as_pointer
    101. | Popaque
    and integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    and float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    and array_kind =
    1. | Pgenarray
    2. | Paddrarray
    3. | Pintarray
    4. | Pfloatarray
    and value_kind =
    1. | Pgenval
    2. | Pfloatval
    3. | Pboxedintval of boxed_integer
    4. | Pintval
    and block_shape = value_kind list option
    and boxed_integer = Primitive.boxed_integer =
    1. | Pnativeint
    2. | Pint32
    3. | Pint64
    and bigarray_kind =
    1. | Pbigarray_unknown
    2. | Pbigarray_float32
    3. | Pbigarray_float64
    4. | Pbigarray_sint8
    5. | Pbigarray_uint8
    6. | Pbigarray_sint16
    7. | Pbigarray_uint16
    8. | Pbigarray_int32
    9. | Pbigarray_int64
    10. | Pbigarray_caml_int
    11. | Pbigarray_native_int
    12. | Pbigarray_complex32
    13. | Pbigarray_complex64
    and bigarray_layout =
    1. | Pbigarray_unknown_layout
    2. | Pbigarray_c_layout
    3. | Pbigarray_fortran_layout
    and raise_kind =
    1. | Raise_regular
    2. | Raise_reraise
    3. | Raise_notrace
    val equal_primitive : primitive -> primitive -> bool
    val equal_value_kind : value_kind -> value_kind -> bool
    val equal_boxed_integer : boxed_integer -> boxed_integer -> bool
    type structured_constant =
    1. | Const_base of Asttypes.constant
    2. | Const_block of int * structured_constant list
    3. | Const_float_array of string list
    4. | Const_immstring of string
    type tailcall_attribute =
    1. | Tailcall_expectation of bool
    2. | Default_tailcall
    type inline_attribute =
    1. | Always_inline
    2. | Never_inline
    3. | Hint_inline
    4. | Unroll of int
    5. | Default_inline
    val equal_inline_attribute : inline_attribute -> inline_attribute -> bool
    type specialise_attribute =
    1. | Always_specialise
    2. | Never_specialise
    3. | Default_specialise
    val equal_specialise_attribute : +Lambda (ocaml.Lambda)

    Module Lambda

    type compile_time_constant =
    1. | Big_endian
    2. | Word_size
    3. | Int_size
    4. | Max_wosize
    5. | Ostype_unix
    6. | Ostype_win32
    7. | Ostype_cygwin
    8. | Backend_type
    type immediate_or_pointer =
    1. | Immediate
    2. | Pointer
    type initialization_or_assignment =
    1. | Assignment
    2. | Heap_initialization
    3. | Root_initialization
    type is_safe =
    1. | Safe
    2. | Unsafe
    type primitive =
    1. | Pbytes_to_string
    2. | Pbytes_of_string
    3. | Pignore
    4. | Pgetglobal of Ident.t
    5. | Psetglobal of Ident.t
    6. | Pmakeblock of int * Asttypes.mutable_flag * block_shape
    7. | Pfield of int * immediate_or_pointer * Asttypes.mutable_flag
    8. | Pfield_computed
    9. | Psetfield of int * immediate_or_pointer * initialization_or_assignment
    10. | Psetfield_computed of immediate_or_pointer * initialization_or_assignment
    11. | Pfloatfield of int
    12. | Psetfloatfield of int * initialization_or_assignment
    13. | Pduprecord of Types.record_representation * int
    14. | Prunstack
    15. | Pperform
    16. | Presume
    17. | Preperform
    18. | Pccall of Primitive.description
    19. | Praise of raise_kind
    20. | Psequand
    21. | Psequor
    22. | Pnot
    23. | Pnegint
    24. | Paddint
    25. | Psubint
    26. | Pmulint
    27. | Pdivint of is_safe
    28. | Pmodint of is_safe
    29. | Pandint
    30. | Porint
    31. | Pxorint
    32. | Plslint
    33. | Plsrint
    34. | Pasrint
    35. | Pintcomp of integer_comparison
    36. | Pcompare_ints
    37. | Pcompare_floats
    38. | Pcompare_bints of boxed_integer
    39. | Poffsetint of int
    40. | Poffsetref of int
    41. | Pintoffloat
    42. | Pfloatofint
    43. | Pnegfloat
    44. | Pabsfloat
    45. | Paddfloat
    46. | Psubfloat
    47. | Pmulfloat
    48. | Pdivfloat
    49. | Pfloatcomp of float_comparison
    50. | Pstringlength
    51. | Pstringrefu
    52. | Pstringrefs
    53. | Pbyteslength
    54. | Pbytesrefu
    55. | Pbytessetu
    56. | Pbytesrefs
    57. | Pbytessets
    58. | Pmakearray of array_kind * Asttypes.mutable_flag
    59. | Pduparray of array_kind * Asttypes.mutable_flag
      (*

      For Pduparray, the argument must be an immutable array. The arguments of Pduparray give the kind and mutability of the array being *produced* by the duplication.

      *)
    60. | Parraylength of array_kind
    61. | Parrayrefu of array_kind
    62. | Parraysetu of array_kind
    63. | Parrayrefs of array_kind
    64. | Parraysets of array_kind
    65. | Pisint
    66. | Pisout
    67. | Pbintofint of boxed_integer
    68. | Pintofbint of boxed_integer
    69. | Pcvtbint of boxed_integer * boxed_integer
    70. | Pnegbint of boxed_integer
    71. | Paddbint of boxed_integer
    72. | Psubbint of boxed_integer
    73. | Pmulbint of boxed_integer
    74. | Pdivbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    75. | Pmodbint of {
      1. size : boxed_integer;
      2. is_safe : is_safe;
      }
    76. | Pandbint of boxed_integer
    77. | Porbint of boxed_integer
    78. | Pxorbint of boxed_integer
    79. | Plslbint of boxed_integer
    80. | Plsrbint of boxed_integer
    81. | Pasrbint of boxed_integer
    82. | Pbintcomp of boxed_integer * integer_comparison
    83. | Pbigarrayref of bool * int * bigarray_kind * bigarray_layout
    84. | Pbigarrayset of bool * int * bigarray_kind * bigarray_layout
    85. | Pbigarraydim of int
    86. | Pstring_load_16 of bool
    87. | Pstring_load_32 of bool
    88. | Pstring_load_64 of bool
    89. | Pbytes_load_16 of bool
    90. | Pbytes_load_32 of bool
    91. | Pbytes_load_64 of bool
    92. | Pbytes_set_16 of bool
    93. | Pbytes_set_32 of bool
    94. | Pbytes_set_64 of bool
    95. | Pbigstring_load_16 of bool
    96. | Pbigstring_load_32 of bool
    97. | Pbigstring_load_64 of bool
    98. | Pbigstring_set_16 of bool
    99. | Pbigstring_set_32 of bool
    100. | Pbigstring_set_64 of bool
    101. | Pctconst of compile_time_constant
    102. | Pbswap16
    103. | Pbbswap of boxed_integer
    104. | Pint_as_pointer
    105. | Patomic_load of {
      1. immediate_or_pointer : immediate_or_pointer;
      }
    106. | Patomic_exchange
    107. | Patomic_cas
    108. | Patomic_fetch_add
    109. | Popaque
    110. | Pdls_get
    and integer_comparison =
    1. | Ceq
    2. | Cne
    3. | Clt
    4. | Cgt
    5. | Cle
    6. | Cge
    and float_comparison =
    1. | CFeq
    2. | CFneq
    3. | CFlt
    4. | CFnlt
    5. | CFgt
    6. | CFngt
    7. | CFle
    8. | CFnle
    9. | CFge
    10. | CFnge
    and array_kind =
    1. | Pgenarray
    2. | Paddrarray
    3. | Pintarray
    4. | Pfloatarray
    and value_kind =
    1. | Pgenval
    2. | Pfloatval
    3. | Pboxedintval of boxed_integer
    4. | Pintval
    and block_shape = value_kind list option
    and boxed_integer = Primitive.boxed_integer =
    1. | Pnativeint
    2. | Pint32
    3. | Pint64
    and bigarray_kind =
    1. | Pbigarray_unknown
    2. | Pbigarray_float32
    3. | Pbigarray_float64
    4. | Pbigarray_sint8
    5. | Pbigarray_uint8
    6. | Pbigarray_sint16
    7. | Pbigarray_uint16
    8. | Pbigarray_int32
    9. | Pbigarray_int64
    10. | Pbigarray_caml_int
    11. | Pbigarray_native_int
    12. | Pbigarray_complex32
    13. | Pbigarray_complex64
    and bigarray_layout =
    1. | Pbigarray_unknown_layout
    2. | Pbigarray_c_layout
    3. | Pbigarray_fortran_layout
    and raise_kind =
    1. | Raise_regular
    2. | Raise_reraise
    3. | Raise_notrace
    val equal_primitive : primitive -> primitive -> bool
    val equal_value_kind : value_kind -> value_kind -> bool
    val equal_boxed_integer : boxed_integer -> boxed_integer -> bool
    type structured_constant =
    1. | Const_base of Asttypes.constant
    2. | Const_block of int * structured_constant list
    3. | Const_float_array of string list
    4. | Const_immstring of string
    type tailcall_attribute =
    1. | Tailcall_expectation of bool
    2. | Default_tailcall
    type inline_attribute =
    1. | Always_inline
    2. | Never_inline
    3. | Hint_inline
    4. | Unroll of int
    5. | Default_inline
    val equal_inline_attribute : inline_attribute -> inline_attribute -> bool
    type specialise_attribute =
    1. | Always_specialise
    2. | Never_specialise
    3. | Default_specialise
    val equal_specialise_attribute : specialise_attribute -> specialise_attribute -> bool
    type local_attribute =
    1. | Always_local
    2. | Never_local
    3. | Default_local
    type poll_attribute =
    1. | Error_poll
    2. | Default_poll
    type function_kind =
    1. | Curried
    2. | Tupled
    type let_kind =
    1. | Strict
    2. | Alias
    3. | StrictOpt
    type meth_kind =
    1. | Self
    2. | Public
    3. | Cached
    val equal_meth_kind : meth_kind -> meth_kind -> bool
    type shared_code = (int * int) list
    type function_attribute = {
    1. inline : inline_attribute;
    2. specialise : specialise_attribute;
    3. local : local_attribute;
    4. poll : poll_attribute;
    5. is_a_functor : bool;
    6. stub : bool;
    7. tmc_candidate : bool;
    }
    type scoped_location = Debuginfo.Scoped_location.t
    type lambda =
    1. | Lvar of Ident.t
    2. | Lmutvar of Ident.t
    3. | Lconst of structured_constant
    4. | Lapply of lambda_apply
    5. | Lfunction of lfunction
    6. | Llet of let_kind * value_kind * Ident.t * lambda * lambda
    7. | Lmutlet of value_kind * Ident.t * lambda * lambda
    8. | Lletrec of (Ident.t * lambda) list * lambda
    9. | Lprim of primitive * lambda list * scoped_location
    10. | Lswitch of lambda * lambda_switch * scoped_location
    11. | Lstringswitch of lambda diff --git a/dev/ocaml/Linear/index.html b/dev/ocaml/Linear/index.html index 5f822967..dcc78f61 100644 --- a/dev/ocaml/Linear/index.html +++ b/dev/ocaml/Linear/index.html @@ -4,4 +4,4 @@ Reg.t array -> Reg.t array -> instruction -> - instruction
    val invert_test : Mach.test -> Mach.test
    type fundecl = {
    1. fun_name : string;
    2. fun_body : instruction;
    3. fun_fast : bool;
    4. fun_dbg : Debuginfo.t;
    5. fun_tailrec_entry_point_label : label;
    6. fun_contains_calls : bool;
    7. fun_num_stack_slots : int array;
    8. fun_frame_required : bool;
    9. fun_prologue_required : bool;
    }
    \ No newline at end of file + instruction
    val invert_test : Mach.test -> Mach.test
    type fundecl = {
    1. fun_name : string;
    2. fun_args : Reg.Set.t;
    3. fun_body : instruction;
    4. fun_fast : bool;
    5. fun_dbg : Debuginfo.t;
    6. fun_tailrec_entry_point_label : label;
    7. fun_contains_calls : bool;
    8. fun_num_stack_slots : int array;
    9. fun_frame_required : bool;
    10. fun_prologue_required : bool;
    }
    \ No newline at end of file diff --git a/dev/ocaml/Linkage_name/Map/index.html b/dev/ocaml/Linkage_name/Map/index.html index 40d8f946..14ce7259 100644 --- a/dev/ocaml/Linkage_name/Map/index.html +++ b/dev/ocaml/Linkage_name/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Linkage_name/Set/index.html b/dev/ocaml/Linkage_name/Set/index.html index 0f811ff9..09ae7461 100644 --- a/dev/ocaml/Linkage_name/Set/index.html +++ b/dev/ocaml/Linkage_name/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Linkage_name.Set)

    Module Linkage_name.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Linkage_name.Set)

    Module Linkage_name.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Load_path/Dir/index.html b/dev/ocaml/Load_path/Dir/index.html index 77c6179b..ed441d52 100644 --- a/dev/ocaml/Load_path/Dir/index.html +++ b/dev/ocaml/Load_path/Dir/index.html @@ -1,2 +1,2 @@ -Dir (ocaml.Load_path.Dir)

    Module Load_path.Dir

    type t

    Represent one directory in the load path.

    val create : string -> t
    val path : t -> string
    val files : t -> string list

    All the files in that directory. This doesn't include files in sub-directories of this directory.

    \ No newline at end of file +Dir (ocaml.Load_path.Dir)

    Module Load_path.Dir

    type t

    Represent one directory in the load path.

    val create : string -> t
    val path : t -> string
    val files : t -> string list

    All the files in that directory. This doesn't include files in sub-directories of this directory.

    val find : t -> string -> string option

    find dir fn returns the full path to fn in dir.

    val find_uncap : t -> string -> string option

    As find, but search also for uncapitalized name, i.e. if name is Foo.ml, either /path/Foo.ml or /path/foo.ml may be returned.

    \ No newline at end of file diff --git a/dev/ocaml/Load_path/index.html b/dev/ocaml/Load_path/index.html index d51aacd9..208960f5 100644 --- a/dev/ocaml/Load_path/index.html +++ b/dev/ocaml/Load_path/index.html @@ -1,2 +1,5 @@ -Load_path (ocaml.Load_path)

    Module Load_path

    Management of include directories.

    This module offers a high level interface to locating files in the load path, which is constructed from -I command line flags and a few other parameters.

    It makes the assumption that the contents of include directories doesn't change during the execution of the compiler.

    val add_dir : string -> unit

    Add a directory to the end of the load path (i.e. at lowest priority.)

    val remove_dir : string -> unit

    Remove a directory from the load path

    val reset : unit -> unit

    Remove all directories

    val init : string list -> unit

    init l is the same as reset (); List.iter add_dir (List.rev l)

    val get_paths : unit -> string list

    Return the list of directories passed to add_dir so far.

    val find : string -> string

    Locate a file in the load path. Raise Not_found if the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn't contain a directory separator.

    val find_uncap : string -> string

    Same as find, but search also for uncapitalized name, i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

    module Dir : sig ... end
    val add : Dir.t -> unit

    Old name for append_dir

    • deprecated
    val append_dir : Dir.t -> unit

    append_dir d adds d to the end of the load path (i.e. at lowest priority.

    val prepend_dir : Dir.t -> unit

    prepend_dir d adds d to the start of the load path (i.e. at highest priority.

    val get : unit -> Dir.t list

    Same as get_paths (), except that it returns a Dir.t list.

    \ No newline at end of file +Load_path (ocaml.Load_path)

    Module Load_path

    Management of include directories.

    This module offers a high level interface to locating files in the load path, which is constructed from -I command line flags and a few other parameters.

    It makes the assumption that the contents of include directories doesn't change during the execution of the compiler.

    val add_dir : string -> unit

    Add a directory to the end of the load path (i.e. at lowest priority.)

    val remove_dir : string -> unit

    Remove a directory from the load path

    val reset : unit -> unit

    Remove all directories

    module Dir : sig ... end
    type auto_include_callback = + (Dir.t -> string -> string option) -> + string -> + string

    The type of callback functions on for init ~auto_include

    val no_auto_include : auto_include_callback

    No automatic directory inclusion: misses in the load path raise Not_found as normal.

    val init : auto_include:auto_include_callback -> string list -> unit

    init l is the same as reset (); List.iter add_dir (List.rev l)

    val auto_include_otherlibs : (string -> unit) -> auto_include_callback

    auto_include_otherlibs alert is a callback function to be passed to Load_path.init and automatically adds -I +lib to the load path after calling alert lib.

    val get_paths : unit -> string list

    Return the list of directories passed to add_dir so far.

    val find : string -> string

    Locate a file in the load path. Raise Not_found if the file cannot be found. This function is optimized for the case where the filename is a basename, i.e. doesn't contain a directory separator.

    val find_uncap : string -> string

    Same as find, but search also for uncapitalized name, i.e. if name is Foo.ml, allow /path/Foo.ml and /path/foo.ml to match.

    val add : Dir.t -> unit

    Old name for append_dir

    • deprecated
    val append_dir : Dir.t -> unit

    append_dir d adds d to the end of the load path (i.e. at lowest priority.

    val prepend_dir : Dir.t -> unit

    prepend_dir d adds d to the start of the load path (i.e. at highest priority.

    val get : unit -> Dir.t list

    Same as get_paths (), except that it returns a Dir.t list.

    \ No newline at end of file diff --git a/dev/ocaml/Local_store/index.html b/dev/ocaml/Local_store/index.html index d1a64ce8..5c5705db 100644 --- a/dev/ocaml/Local_store/index.html +++ b/dev/ocaml/Local_store/index.html @@ -1,2 +1,2 @@ -Local_store (ocaml.Local_store)

    Module Local_store

    This module provides some facilities for creating references (and hash tables) which can easily be snapshoted and restored to an arbitrary version.

    It is used throughout the frontend (read: typechecker), to register all (well, hopefully) the global state. Thus making it easy for tools like Merlin to go back and forth typechecking different files.

    Creators

    val s_ref : 'a -> 'a ref

    Similar to ref, except the allocated reference is registered into the store.

    val s_table : ('a -> 'b) -> 'a -> 'b ref

    Used to register hash tables. Those also need to be placed into refs to be easily swapped out, but one can't just "snapshot" the initial value to create fresh instances, so instead an initializer is required.

    Use it like this:

    let my_table = s_table Hashtbl.create 42

    State management

    Note: all the following functions are currently unused inside the compiler codebase. Merlin is their only user at the moment.

    type store
    val fresh : unit -> store

    Returns a fresh instance of the store.

    The first time this function is called, it snapshots the value of all the registered references, later calls to fresh will return instances initialized to those values.

    val with_store : store -> (unit -> 'a) -> 'a

    with_store s f resets all the registered references to the value they have in s for the run of f. If f updates any of the registered refs, s is updated to remember those changes.

    val reset : unit -> unit

    Resets all the references to the initial snapshot (i.e. to the same values that new instances start with).

    val is_bound : unit -> bool

    Returns true when a store is active (i.e. when called from the callback passed to with_store), false otherwise.

    \ No newline at end of file +Local_store (ocaml.Local_store)

    Module Local_store

    This module provides some facilities for creating references (and hash tables) which can easily be snapshoted and restored to an arbitrary version.

    It is used throughout the frontend (read: typechecker), to register all (well, hopefully) the global state. Thus making it easy for tools like Merlin to go back and forth typechecking different files.

    Creators

    val s_ref : 'a -> 'a ref

    Similar to Stdlib.ref, except the allocated reference is registered into the store.

    val s_table : ('a -> 'b) -> 'a -> 'b ref

    Used to register hash tables. Those also need to be placed into refs to be easily swapped out, but one can't just "snapshot" the initial value to create fresh instances, so instead an initializer is required.

    Use it like this:

    let my_table = s_table Hashtbl.create 42

    State management

    Note: all the following functions are currently unused inside the compiler codebase. Merlin is their only user at the moment.

    type store
    val fresh : unit -> store

    Returns a fresh instance of the store.

    The first time this function is called, it snapshots the value of all the registered references, later calls to fresh will return instances initialized to those values.

    val with_store : store -> (unit -> 'a) -> 'a

    with_store s f resets all the registered references to the value they have in s for the run of f. If f updates any of the registered refs, s is updated to remember those changes.

    val reset : unit -> unit

    Resets all the references to the initial snapshot (i.e. to the same values that new instances start with).

    val is_bound : unit -> bool

    Returns true when a store is active (i.e. when called from the callback passed to with_store), false otherwise.

    \ No newline at end of file diff --git a/dev/ocaml/Location/index.html b/dev/ocaml/Location/index.html index cc6be7a6..ba2fc08f 100644 --- a/dev/ocaml/Location/index.html +++ b/dev/ocaml/Location/index.html @@ -23,7 +23,7 @@ report -> Stdlib.Format.formatter -> (Stdlib.Format.formatter -> unit) -> - unit;
    }

    A printer for reports, defined using open-recursion. The goal is to make it easy to define new printers by re-using code from existing ones.

    Report printers used in the compiler

    val batch_mode_printer : report_printer
    val terminfo_toplevel_printer : Stdlib.Lexing.lexbuf -> report_printer
    val best_toplevel_printer : unit -> report_printer

    Detects the terminal capabilities and selects an adequate printer

    Printing a report

    val print_report : Stdlib.Format.formatter -> report -> unit

    Display an error or warning report.

    val report_printer : (unit -> report_printer) ref

    Hook for redefining the printer of reports.

    The hook is a unit -> report_printer and not simply a report_printer: this is useful so that it can detect the type of the output (a file, a terminal, ...) and select a printer accordingly.

    val default_report_printer : unit -> report_printer

    Original report printer for use in hooks.

    Reporting warnings

    Converting a Warnings.t into a report

    val report_warning : t -> Warnings.t -> report option

    report_warning loc w produces a report for the given warning w, or None if the warning is not to be printed.

    val warning_reporter : (t -> Warnings.t -> report option) ref

    Hook for intercepting warnings.

    val default_warning_reporter : t -> Warnings.t -> report option

    Original warning reporter for use in hooks.

    Printing warnings

    val formatter_for_warnings : Stdlib.Format.formatter ref
    val print_warning : t -> Stdlib.Format.formatter -> Warnings.t -> unit

    Prints a warning. This is simply the composition of report_warning and print_report.

    val prerr_warning : t -> Warnings.t -> unit

    Same as print_warning, but uses !formatter_for_warnings as output formatter.

    Reporting alerts

    Converting an Alert.t into a report

    val report_alert : t -> Warnings.alert -> report option

    report_alert loc w produces a report for the given alert w, or None if the alert is not to be printed.

    val alert_reporter : (t -> Warnings.alert -> report option) ref

    Hook for intercepting alerts.

    val default_alert_reporter : t -> Warnings.alert -> report option

    Original alert reporter for use in hooks.

    Printing alerts

    val print_alert : t -> Stdlib.Format.formatter -> Warnings.alert -> unit

    Prints an alert. This is simply the composition of report_alert and print_report.

    val prerr_alert : t -> Warnings.alert -> unit

    Same as print_alert, but uses !formatter_for_warnings as output formatter.

    val deprecated : ?def:t -> ?use:t -> t -> string -> unit

    Prints a deprecation alert.

    val alert : ?def:t -> ?use:t -> kind:string -> t -> string -> unit

    Prints an arbitrary alert.

    Reporting errors

    type error = report

    An error is a report which report_kind must be Report_error.

    val error : ?loc:t -> ?sub:msg list -> string -> error
    val errorf : + unit;}

    A printer for reports, defined using open-recursion. The goal is to make it easy to define new printers by re-using code from existing ones.

    Report printers used in the compiler

    val batch_mode_printer : report_printer
    val terminfo_toplevel_printer : Stdlib.Lexing.lexbuf -> report_printer
    val best_toplevel_printer : unit -> report_printer

    Detects the terminal capabilities and selects an adequate printer

    Printing a report

    val print_report : Stdlib.Format.formatter -> report -> unit

    Display an error or warning report.

    val report_printer : (unit -> report_printer) ref

    Hook for redefining the printer of reports.

    The hook is a unit -> report_printer and not simply a report_printer: this is useful so that it can detect the type of the output (a file, a terminal, ...) and select a printer accordingly.

    val default_report_printer : unit -> report_printer

    Original report printer for use in hooks.

    Reporting warnings

    Converting a Warnings.t into a report

    val report_warning : t -> Warnings.t -> report option

    report_warning loc w produces a report for the given warning w, or None if the warning is not to be printed.

    val warning_reporter : (t -> Warnings.t -> report option) ref

    Hook for intercepting warnings.

    val default_warning_reporter : t -> Warnings.t -> report option

    Original warning reporter for use in hooks.

    Printing warnings

    val formatter_for_warnings : Stdlib.Format.formatter ref
    val print_warning : t -> Stdlib.Format.formatter -> Warnings.t -> unit

    Prints a warning. This is simply the composition of report_warning and print_report.

    val prerr_warning : t -> Warnings.t -> unit

    Same as print_warning, but uses !formatter_for_warnings as output formatter.

    Reporting alerts

    Converting an Alert.t into a report

    val report_alert : t -> Warnings.alert -> report option

    report_alert loc w produces a report for the given alert w, or None if the alert is not to be printed.

    val alert_reporter : (t -> Warnings.alert -> report option) ref

    Hook for intercepting alerts.

    val default_alert_reporter : t -> Warnings.alert -> report option

    Original alert reporter for use in hooks.

    Printing alerts

    val print_alert : t -> Stdlib.Format.formatter -> Warnings.alert -> unit

    Prints an alert. This is simply the composition of report_alert and print_report.

    val prerr_alert : t -> Warnings.alert -> unit

    Same as print_alert, but uses !formatter_for_warnings as output formatter.

    val deprecated : ?def:t -> ?use:t -> t -> string -> unit

    Prints a deprecation alert.

    val alert : ?def:t -> ?use:t -> kind:string -> t -> string -> unit

    Prints an arbitrary alert.

    val auto_include_alert : string -> unit

    Prints an alert that -I +lib has been automatically added to the load path

    val deprecated_script_alert : string -> unit

    deprecated_script_alert command prints an alert that command foo has been deprecated in favour of command ./foo

    Reporting errors

    type error = report

    An error is a report which report_kind must be Report_error.

    val error : ?loc:t -> ?sub:msg list -> string -> error
    val errorf : ?loc:t -> ?sub:msg list -> ('a, Stdlib.Format.formatter, unit, error) format4 -> diff --git a/dev/ocaml/Mach/index.html b/dev/ocaml/Mach/index.html index 6edaa79f..d9b1fb5a 100644 --- a/dev/ocaml/Mach/index.html +++ b/dev/ocaml/Mach/index.html @@ -1,5 +1,5 @@ -Mach (ocaml.Mach)

    Module Mach

    type integer_comparison =
    1. | Isigned of Cmm.integer_comparison
    2. | Iunsigned of Cmm.integer_comparison
    type integer_operation =
    1. | Iadd
    2. | Isub
    3. | Imul
    4. | Imulh
    5. | Idiv
    6. | Imod
    7. | Iand
    8. | Ior
    9. | Ixor
    10. | Ilsl
    11. | Ilsr
    12. | Iasr
    13. | Icomp of integer_comparison
    14. | Icheckbound
    type float_comparison = Cmm.float_comparison
    type test =
    1. | Itruetest
    2. | Ifalsetest
    3. | Iinttest of integer_comparison
    4. | Iinttest_imm of integer_comparison * int
    5. | Ifloattest of float_comparison
    6. | Ioddtest
    7. | Ieventest
    type operation =
    1. | Imove
    2. | Ispill
    3. | Ireload
    4. | Iconst_int of nativeint
    5. | Iconst_float of int64
    6. | Iconst_symbol of string
    7. | Icall_ind
    8. | Icall_imm of {
      1. func : string;
      }
    9. | Itailcall_ind
    10. | Itailcall_imm of {
      1. func : string;
      }
    11. | Iextcall of {
      1. func : string;
      2. ty_res : Cmm.machtype;
      3. ty_args : Cmm.exttype list;
      4. alloc : bool;
      }
    12. | Istackoffset of int
    13. | Iload of Cmm.memory_chunk * Arch.addressing_mode * Asttypes.mutable_flag
    14. | Istore of Cmm.memory_chunk * Arch.addressing_mode * bool
    15. | Ialloc of {
      1. bytes : int;
      2. dbginfo : Debuginfo.alloc_dbginfo;
      }
    16. | Iintop of integer_operation
    17. | Iintop_imm of integer_operation * int
    18. | Inegf
    19. | Iabsf
    20. | Iaddf
    21. | Isubf
    22. | Imulf
    23. | Idivf
    24. | Ifloatofint
    25. | Iintoffloat
    26. | Iopaque
    27. | Ispecific of Arch.specific_operation
    28. | Ipoll of {
      1. return_label : Cmm.label option;
      }
    type instruction = {
    1. desc : instruction_desc;
    2. next : instruction;
    3. arg : Reg.t array;
    4. res : Reg.t array;
    5. dbg : Debuginfo.t;
    6. mutable live : Reg.Set.t;
    }
    and instruction_desc =
    1. | Iend
    2. | Iop of operation
    3. | Ireturn
    4. | Iifthenelse of test * instruction * instruction
    5. | Iswitch of int array * instruction array
    6. | Icatch of Cmm.rec_flag * (int * instruction) list * instruction
    7. | Iexit of int
    8. | Itrywith of instruction * instruction
    9. | Iraise of Lambda.raise_kind
    type fundecl = {
    1. fun_name : string;
    2. fun_args : Reg.t array;
    3. fun_body : instruction;
    4. fun_codegen_options : Cmm.codegen_option list;
    5. fun_dbg : Debuginfo.t;
    6. fun_poll : Lambda.poll_attribute;
    7. fun_num_stack_slots : int array;
    8. fun_contains_calls : bool;
    }
    val dummy_instr : instruction
    val end_instr : unit -> instruction
    val instr_cons : +Mach (ocaml.Mach)

    Module Mach

    type integer_comparison =
    1. | Isigned of Cmm.integer_comparison
    2. | Iunsigned of Cmm.integer_comparison
    type integer_operation =
    1. | Iadd
    2. | Isub
    3. | Imul
    4. | Imulh
    5. | Idiv
    6. | Imod
    7. | Iand
    8. | Ior
    9. | Ixor
    10. | Ilsl
    11. | Ilsr
    12. | Iasr
    13. | Icomp of integer_comparison
    14. | Icheckbound
    type float_comparison = Cmm.float_comparison
    type test =
    1. | Itruetest
    2. | Ifalsetest
    3. | Iinttest of integer_comparison
    4. | Iinttest_imm of integer_comparison * int
    5. | Ifloattest of float_comparison
    6. | Ioddtest
    7. | Ieventest
    type operation =
    1. | Imove
    2. | Ispill
    3. | Ireload
    4. | Iconst_int of nativeint
    5. | Iconst_float of int64
    6. | Iconst_symbol of string
    7. | Icall_ind
    8. | Icall_imm of {
      1. func : string;
      }
    9. | Itailcall_ind
    10. | Itailcall_imm of {
      1. func : string;
      }
    11. | Iextcall of {
      1. func : string;
      2. ty_res : Cmm.machtype;
      3. ty_args : Cmm.exttype list;
      4. alloc : bool;
      5. stack_ofs : int;
      }
    12. | Istackoffset of int
    13. | Iload of {
      1. memory_chunk : Cmm.memory_chunk;
      2. addressing_mode : Arch.addressing_mode;
      3. mutability : Asttypes.mutable_flag;
      4. is_atomic : bool;
      }
    14. | Istore of Cmm.memory_chunk * Arch.addressing_mode * bool
    15. | Ialloc of {
      1. bytes : int;
      2. dbginfo : Debuginfo.alloc_dbginfo;
      }
    16. | Iintop of integer_operation
    17. | Iintop_imm of integer_operation * int
    18. | Inegf
    19. | Iabsf
    20. | Iaddf
    21. | Isubf
    22. | Imulf
    23. | Idivf
    24. | Ifloatofint
    25. | Iintoffloat
    26. | Iopaque
    27. | Ispecific of Arch.specific_operation
    28. | Ipoll of {
      1. return_label : Cmm.label option;
      }
    29. | Idls_get
    type instruction = {
    1. desc : instruction_desc;
    2. next : instruction;
    3. arg : Reg.t array;
    4. res : Reg.t array;
    5. dbg : Debuginfo.t;
    6. mutable live : Reg.Set.t;
    }
    and instruction_desc =
    1. | Iend
    2. | Iop of operation
    3. | Ireturn
    4. | Iifthenelse of test * instruction * instruction
    5. | Iswitch of int array * instruction array
    6. | Icatch of Cmm.rec_flag * (int * instruction) list * instruction
    7. | Iexit of int
    8. | Itrywith of instruction * instruction
    9. | Iraise of Lambda.raise_kind
    type fundecl = {
    1. fun_name : string;
    2. fun_args : Reg.t array;
    3. fun_body : instruction;
    4. fun_codegen_options : Cmm.codegen_option list;
    5. fun_dbg : Debuginfo.t;
    6. fun_poll : Lambda.poll_attribute;
    7. fun_num_stack_slots : int array;
    8. fun_contains_calls : bool;
    }
    val dummy_instr : instruction
    val end_instr : unit -> instruction
    val instr_cons : instruction_desc -> Reg.t array -> Reg.t array -> diff --git a/dev/ocaml/Main_args/Default/Main/index.html b/dev/ocaml/Main_args/Default/Main/index.html index bcfee619..08a1393a 100644 --- a/dev/ocaml/Main_args/Default/Main/index.html +++ b/dev/ocaml/Main_args/Default/Main/index.html @@ -1,2 +1,2 @@ -Main (ocaml.Main_args.Default.Main)

    Module Default.Main

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    \ No newline at end of file +Main (ocaml.Main_args.Default.Main)

    Module Default.Main

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Default/Odoc_args/index.html b/dev/ocaml/Main_args/Default/Odoc_args/index.html index 5d6d5e57..3d678687 100644 --- a/dev/ocaml/Main_args/Default/Odoc_args/index.html +++ b/dev/ocaml/Main_args/Default/Odoc_args/index.html @@ -1,2 +1,2 @@ -Odoc_args (ocaml.Main_args.Default.Odoc_args)

    Module Default.Odoc_args

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    \ No newline at end of file +Odoc_args (ocaml.Main_args.Default.Odoc_args)

    Module Default.Odoc_args

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Default/Optmain/index.html b/dev/ocaml/Main_args/Default/Optmain/index.html index 1ac48abe..6be1a2fb 100644 --- a/dev/ocaml/Main_args/Default/Optmain/index.html +++ b/dev/ocaml/Main_args/Default/Optmain/index.html @@ -1,2 +1,2 @@ -Optmain (ocaml.Main_args.Default.Optmain)

    Module Default.Optmain

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    \ No newline at end of file +Optmain (ocaml.Main_args.Default.Optmain)

    Module Default.Optmain

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Default/Opttopmain/index.html b/dev/ocaml/Main_args/Default/Opttopmain/index.html index bf48ca5f..769aa40f 100644 --- a/dev/ocaml/Main_args/Default/Opttopmain/index.html +++ b/dev/ocaml/Main_args/Default/Opttopmain/index.html @@ -1,2 +1,2 @@ -Opttopmain (ocaml.Main_args.Default.Opttopmain)

    Module Default.Opttopmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    \ No newline at end of file +Opttopmain (ocaml.Main_args.Default.Opttopmain)

    Module Default.Opttopmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Default/Topmain/index.html b/dev/ocaml/Main_args/Default/Topmain/index.html index 9974b9be..1b7ce38e 100644 --- a/dev/ocaml/Main_args/Default/Topmain/index.html +++ b/dev/ocaml/Main_args/Default/Topmain/index.html @@ -1,2 +1,2 @@ -Topmain (ocaml.Main_args.Default.Topmain)

    Module Default.Topmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    \ No newline at end of file +Topmain (ocaml.Main_args.Default.Topmain)

    Module Default.Topmain

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html b/dev/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html index 15dd2e6e..6ba78051 100644 --- a/dev/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html +++ b/dev/ocaml/Main_args/Make_bytecomp_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_bytecomp_options._)

    Parameter Make_bytecomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    \ No newline at end of file +_ (ocaml.Main_args.Make_bytecomp_options._)

    Parameter Make_bytecomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html b/dev/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html index abad6b58..dd8d7887 100644 --- a/dev/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html +++ b/dev/ocaml/Main_args/Make_bytetop_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_bytetop_options._)

    Parameter Make_bytetop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    \ No newline at end of file +_ (ocaml.Main_args.Make_bytetop_options._)

    Parameter Make_bytetop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html b/dev/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html index 8787a018..2147ca3b 100644 --- a/dev/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html +++ b/dev/ocaml/Main_args/Make_ocamldoc_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_ocamldoc_options._)

    Parameter Make_ocamldoc_options._

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    \ No newline at end of file +_ (ocaml.Main_args.Make_ocamldoc_options._)

    Parameter Make_ocamldoc_options._

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html b/dev/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html index 981d7141..4f23bedf 100644 --- a/dev/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html +++ b/dev/ocaml/Main_args/Make_optcomp_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_optcomp_options._)

    Parameter Make_optcomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    \ No newline at end of file +_ (ocaml.Main_args.Make_optcomp_options._)

    Parameter Make_optcomp_options._

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html b/dev/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html index 7be4db0c..129d9e73 100644 --- a/dev/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html +++ b/dev/ocaml/Main_args/Make_opttop_options/argument-1-_/index.html @@ -1,2 +1,2 @@ -_ (ocaml.Main_args.Make_opttop_options._)

    Parameter Make_opttop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    \ No newline at end of file +_ (ocaml.Main_args.Make_opttop_options._)

    Parameter Make_opttop_options._

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Bytecomp_options/index.html b/dev/ocaml/Main_args/module-type-Bytecomp_options/index.html index fba352d9..dc39e79c 100644 --- a/dev/ocaml/Main_args/module-type-Bytecomp_options/index.html +++ b/dev/ocaml/Main_args/module-type-Bytecomp_options/index.html @@ -1,2 +1,2 @@ -Bytecomp_options (ocaml.Main_args.Bytecomp_options)

    Module type Main_args.Bytecomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    \ No newline at end of file +Bytecomp_options (ocaml.Main_args.Bytecomp_options)

    Module type Main_args.Bytecomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _compat_32 : unit -> unit
    val _custom : unit -> unit
    val _no_check_prims : unit -> unit
    val _dllib : string -> unit
    val _dllpath : string -> unit
    val _make_runtime : unit -> unit
    val _vmthread : unit -> unit
    val _use_runtime : string -> unit
    val _output_complete_exe : unit -> unit
    val _dinstr : unit -> unit
    val _dcamlprimc : unit -> unit
    val _use_prims : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Bytetop_options/index.html b/dev/ocaml/Main_args/module-type-Bytetop_options/index.html index 051e0d65..f6653ede 100644 --- a/dev/ocaml/Main_args/module-type-Bytetop_options/index.html +++ b/dev/ocaml/Main_args/module-type-Bytetop_options/index.html @@ -1,2 +1,2 @@ -Bytetop_options (ocaml.Main_args.Bytetop_options)

    Module type Main_args.Bytetop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    \ No newline at end of file +Bytetop_options (ocaml.Main_args.Bytetop_options)

    Module type Main_args.Bytetop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    val _dinstr : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Common_options/index.html b/dev/ocaml/Main_args/module-type-Common_options/index.html index d25e8342..6c550b48 100644 --- a/dev/ocaml/Main_args/module-type-Common_options/index.html +++ b/dev/ocaml/Main_args/module-type-Common_options/index.html @@ -1,2 +1,2 @@ -Common_options (ocaml.Main_args.Common_options)

    Module type Main_args.Common_options

    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    \ No newline at end of file +Common_options (ocaml.Main_args.Common_options)

    Module type Main_args.Common_options

    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Compiler_options/index.html b/dev/ocaml/Main_args/module-type-Compiler_options/index.html index 5fe52b46..f7bfec5d 100644 --- a/dev/ocaml/Main_args/module-type-Compiler_options/index.html +++ b/dev/ocaml/Main_args/module-type-Compiler_options/index.html @@ -1,2 +1,2 @@ -Compiler_options (ocaml.Main_args.Compiler_options)

    Module type Main_args.Compiler_options

    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    \ No newline at end of file +Compiler_options (ocaml.Main_args.Compiler_options)

    Module type Main_args.Compiler_options

    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _pp : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Core_options/index.html b/dev/ocaml/Main_args/module-type-Core_options/index.html index c026a489..22ce32f8 100644 --- a/dev/ocaml/Main_args/module-type-Core_options/index.html +++ b/dev/ocaml/Main_args/module-type-Core_options/index.html @@ -1,2 +1,2 @@ -Core_options (ocaml.Main_args.Core_options)

    Module type Main_args.Core_options

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    \ No newline at end of file +Core_options (ocaml.Main_args.Core_options)

    Module type Main_args.Core_options

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Ocamldoc_options/index.html b/dev/ocaml/Main_args/module-type-Ocamldoc_options/index.html index 350621c9..a653bd43 100644 --- a/dev/ocaml/Main_args/module-type-Ocamldoc_options/index.html +++ b/dev/ocaml/Main_args/module-type-Ocamldoc_options/index.html @@ -1,2 +1,2 @@ -Ocamldoc_options (ocaml.Main_args.Ocamldoc_options)

    Module type Main_args.Ocamldoc_options

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    \ No newline at end of file +Ocamldoc_options (ocaml.Main_args.Ocamldoc_options)

    Module type Main_args.Ocamldoc_options

    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _pp : string -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _vmthread : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Optcomp_options/index.html b/dev/ocaml/Main_args/module-type-Optcomp_options/index.html index d009f253..9a4afe62 100644 --- a/dev/ocaml/Main_args/module-type-Optcomp_options/index.html +++ b/dev/ocaml/Main_args/module-type-Optcomp_options/index.html @@ -1,2 +1,2 @@ -Optcomp_options (ocaml.Main_args.Optcomp_options)

    Module type Main_args.Optcomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    \ No newline at end of file +Optcomp_options (ocaml.Main_args.Optcomp_options)

    Module type Main_args.Optcomp_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _no_rectypes : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    include Compiler_options
    val _a : unit -> unit
    val _annot : unit -> unit
    val _binannot : unit -> unit
    val _c : unit -> unit
    val _cc : string -> unit
    val _cclib : string -> unit
    val _ccopt : string -> unit
    val _cmi_file : string -> unit
    val _config : unit -> unit
    val _config_var : string -> unit
    val _for_pack : string -> unit
    val _g : unit -> unit
    val _stop_after : string -> unit
    val _i : unit -> unit
    val _impl : string -> unit
    val _intf : string -> unit
    val _intf_suffix : string -> unit
    val _keep_docs : unit -> unit
    val _no_keep_docs : unit -> unit
    val _keep_locs : unit -> unit
    val _no_keep_locs : unit -> unit
    val _linkall : unit -> unit
    val _o : string -> unit
    val _opaque : unit -> unit
    val _output_obj : unit -> unit
    val _output_complete_obj : unit -> unit
    val _pack : unit -> unit
    val _plugin : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _runtime_variant : string -> unit
    val _with_runtime : unit -> unit
    val _without_runtime : unit -> unit
    val _short_paths : unit -> unit
    val _thread : unit -> unit
    val _v : unit -> unit
    val _verbose : unit -> unit
    val _where : unit -> unit
    val _color : string -> unit
    val _error_style : string -> unit
    val _match_context_rows : int -> unit
    val _dtimings : unit -> unit
    val _dprofile : unit -> unit
    val _dump_into_file : unit -> unit
    val _dump_dir : string -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _p : unit -> unit
    val _pp : string -> unit
    val _S : unit -> unit
    val _shared : unit -> unit
    val _afl_instrument : unit -> unit
    val _afl_inst_ratio : int -> unit
    val _function_sections : unit -> unit
    val _save_ir_after : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Opttop_options/index.html b/dev/ocaml/Main_args/module-type-Opttop_options/index.html index b0f730fa..d5dec2d2 100644 --- a/dev/ocaml/Main_args/module-type-Opttop_options/index.html +++ b/dev/ocaml/Main_args/module-type-Opttop_options/index.html @@ -1,2 +1,2 @@ -Opttop_options (ocaml.Main_args.Opttop_options)

    Module type Main_args.Opttop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    \ No newline at end of file +Opttop_options (ocaml.Main_args.Opttop_options)

    Module type Main_args.Opttop_options

    include Toplevel_options
    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    include Optcommon_options
    val _compact : unit -> unit
    val _inline : string -> unit
    val _inline_toplevel : string -> unit
    val _inlining_report : unit -> unit
    val _dump_pass : string -> unit
    val _inline_max_depth : string -> unit
    val _rounds : int -> unit
    val _inline_max_unroll : string -> unit
    val _classic_inlining : unit -> unit
    val _inline_call_cost : string -> unit
    val _inline_alloc_cost : string -> unit
    val _inline_prim_cost : string -> unit
    val _inline_branch_cost : string -> unit
    val _inline_indirect_cost : string -> unit
    val _inline_lifting_benefit : string -> unit
    val _unbox_closures : unit -> unit
    val _unbox_closures_factor : int -> unit
    val _inline_branch_factor : string -> unit
    val _remove_unused_arguments : unit -> unit
    val _no_unbox_free_vars_of_closures : unit -> unit
    val _no_unbox_specialised_args : unit -> unit
    val _o2 : unit -> unit
    val _o3 : unit -> unit
    val _insn_sched : unit -> unit
    val _no_insn_sched : unit -> unit
    val _linscan : unit -> unit
    val _no_float_const_prop : unit -> unit
    val _clambda_checks : unit -> unit
    val _dflambda : unit -> unit
    val _drawflambda : unit -> unit
    val _dflambda_invariants : unit -> unit
    val _dflambda_no_invariants : unit -> unit
    val _dflambda_let : int -> unit
    val _dflambda_verbose : unit -> unit
    val _drawclambda : unit -> unit
    val _dclambda : unit -> unit
    val _dcmm_invariants : unit -> unit
    val _dcmm : unit -> unit
    val _dsel : unit -> unit
    val _dcombine : unit -> unit
    val _dcse : unit -> unit
    val _dlive : unit -> unit
    val _dspill : unit -> unit
    val _dsplit : unit -> unit
    val _dinterf : unit -> unit
    val _dprefer : unit -> unit
    val _dalloc : unit -> unit
    val _dreload : unit -> unit
    val _dscheduling : unit -> unit
    val _dlinear : unit -> unit
    val _dinterval : unit -> unit
    val _dstartup : unit -> unit
    val _verbose : unit -> unit
    val _S : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Main_args/module-type-Toplevel_options/index.html b/dev/ocaml/Main_args/module-type-Toplevel_options/index.html index da644485..3dbf74d4 100644 --- a/dev/ocaml/Main_args/module-type-Toplevel_options/index.html +++ b/dev/ocaml/Main_args/module-type-Toplevel_options/index.html @@ -1,2 +1,2 @@ -Toplevel_options (ocaml.Main_args.Toplevel_options)

    Module type Main_args.Toplevel_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _safe_string : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _unsafe_string : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    \ No newline at end of file +Toplevel_options (ocaml.Main_args.Toplevel_options)

    Module type Main_args.Toplevel_options

    include Core_options
    include Common_options
    val _absname : unit -> unit
    val _alert : string -> unit
    val _I : string -> unit
    val _labels : unit -> unit
    val _alias_deps : unit -> unit
    val _no_alias_deps : unit -> unit
    val _app_funct : unit -> unit
    val _no_app_funct : unit -> unit
    val _noassert : unit -> unit
    val _nolabels : unit -> unit
    val _nostdlib : unit -> unit
    val _nocwd : unit -> unit
    val _open : string -> unit
    val _ppx : string -> unit
    val _principal : unit -> unit
    val _no_principal : unit -> unit
    val _rectypes : unit -> unit
    val _no_rectypes : unit -> unit
    val _short_paths : unit -> unit
    val _strict_sequence : unit -> unit
    val _no_strict_sequence : unit -> unit
    val _strict_formats : unit -> unit
    val _no_strict_formats : unit -> unit
    val _unboxed_types : unit -> unit
    val _no_unboxed_types : unit -> unit
    val _version : unit -> unit
    val _vnum : unit -> unit
    val _w : string -> unit
    val anonymous : string -> unit
    val _nopervasives : unit -> unit
    val _unsafe : unit -> unit
    val _warn_error : string -> unit
    val _warn_help : unit -> unit
    val _dno_unique_ids : unit -> unit
    val _dunique_ids : unit -> unit
    val _dno_locations : unit -> unit
    val _dlocations : unit -> unit
    val _dsource : unit -> unit
    val _dparsetree : unit -> unit
    val _dtypedtree : unit -> unit
    val _dshape : unit -> unit
    val _drawlambda : unit -> unit
    val _dlambda : unit -> unit
    val _init : string -> unit
    val _noinit : unit -> unit
    val _no_version : unit -> unit
    val _noprompt : unit -> unit
    val _nopromptcont : unit -> unit
    val _stdin : unit -> unit
    val _args : string -> string array
    val _args0 : string -> string array
    val _color : string -> unit
    val _error_style : string -> unit
    val _eval : string -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Misc/Stdlib/String/Map/index.html b/dev/ocaml/Misc/Stdlib/String/Map/index.html index b74f42bd..25848e66 100644 --- a/dev/ocaml/Misc/Stdlib/String/Map/index.html +++ b/dev/ocaml/Misc/Stdlib/String/Map/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Misc/Stdlib/String/Set/index.html b/dev/ocaml/Misc/Stdlib/String/Set/index.html index 0451b9e9..b3cef904 100644 --- a/dev/ocaml/Misc/Stdlib/String/Set/index.html +++ b/dev/ocaml/Misc/Stdlib/String/Set/index.html @@ -1,3 +1,3 @@ Set (ocaml.Misc.Stdlib.String.Set)

    Module String.Set

    type elt = string

    The type of the set elements.

    type t

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : (elt -> elt) -> t -> t

    map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Misc/Stdlib/String/index.html b/dev/ocaml/Misc/Stdlib/String/index.html index cc85d580..6e7032d5 100644 --- a/dev/ocaml/Misc/Stdlib/String/index.html +++ b/dev/ocaml/Misc/Stdlib/String/index.html @@ -1,3 +1,3 @@ String (ocaml.Misc.Stdlib.String)

    Module Stdlib.String

    include module type of Stdlib.String

    Strings

    type t = string

    The type for strings.

    val make : int -> char -> string

    make n c is a string of length n with each index holding the character c.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_string_length.

    val init : int -> (int -> char) -> string

    init n f is a string of length n with index i holding the character f i (called in increasing index order).

    • raises Invalid_argument

      if n < 0 or n > Sys.max_string_length.

    • since 4.02.0
    val empty : string

    The empty string.

    • since 4.13.0
    val of_bytes : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    • since 4.13.0
    val to_bytes : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    • since 4.13.0
    val length : string -> int

    length s is the length (number of bytes/characters) of s.

    val get : string -> int -> char

    get s i is the character at index i in s. This is the same as writing s.[i].

    • raises Invalid_argument

      if i not an index of s.

    Concatenating

    Note. The Stdlib.(^) binary operator concatenates two strings.

    val concat : string -> string list -> string

    concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    val cat : string -> string -> string

    cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    • since 4.13.0

    Predicates and comparisons

    val equal : t -> t -> bool

    equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

    • since 4.03.0 (4.05.0 in StringLabels)
    val compare : t -> t -> int

    compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

    val starts_with : prefix:string -> string -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:string -> string -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13.0
    val contains_from : string -> int -> char -> bool

    contains_from s start c is true if and only if c appears in s after position start.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : string -> int -> char -> bool

    rcontains_from s stop c is true if and only if c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val contains : string -> char -> bool

    contains s c is String.contains_from s 0 c.

    Extracting substrings

    val sub : string -> int -> int -> string

    sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val split_on_char : char -> string -> string list

    split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

    The function's result is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) - (split_on_char sep s) = s).
    • No string in the result contains the sep character.
    • since 4.04.0 (4.05.0 in StringLabels)

    Transforming

    val map : (char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00.0
    val mapi : (int -> char -> char) -> string -> string

    mapi f s is like map but the index of the character is also passed to f.

    • since 4.02.0
    val fold_left : ('a -> char -> 'a) -> 'a -> string -> 'a

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13.0
    val fold_right : (char -> 'a -> 'a) -> string -> 'a -> 'a

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13.0
    val exists : (char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00.0
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)

    Traversing

    val iter : (char -> unit) -> string -> unit

    iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : (int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00.0

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Stdlib.Seq.t

    to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Stdlib.Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Stdlib.Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Deprecated functions

    val create : int -> bytes

    create n returns a fresh byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_string_length.

    • deprecated

      This is a deprecated alias of Bytes.create/BytesLabels.create.

    val set : bytes -> int -> char -> unit

    set s n c modifies byte sequence s in place, replacing the byte at index n with c. You can also write s.[n] <- c instead of set s n c.

    • raises Invalid_argument

      if n is not a valid index in s.

    • deprecated

      This is a deprecated alias of Bytes.set/BytesLabels.set.

    val blit : string -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from the string src, starting at index src_pos, to byte sequence dst, starting at character number dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    val copy : string -> string

    Return a copy of the given string.

    • deprecated

      Because strings are immutable, it doesn't make much sense to make identical copies of them.

    val fill : bytes -> int -> int -> char -> unit

    fill s pos len c modifies byte sequence s in place, replacing len bytes by c, starting at pos.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    • deprecated

      This is a deprecated alias of Bytes.fill/BytesLabels.fill.

    val uppercase : string -> string

    Return a copy of the argument, with all lowercase letters translated to uppercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val lowercase : string -> string

    Return a copy of the argument, with all uppercase letters translated to lowercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val capitalize : string -> string

    Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set..

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uncapitalize : string -> string

    Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13.0
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13.0
    module Set : Set.S with type elt = string
    module Map : Map.S with type key = string
    module Tbl : Hashtbl.S with type key = string
    val print : Stdlib.Format.formatter -> t -> unit
    val for_all : (char -> bool) -> t -> bool
    \ No newline at end of file + (split_on_char sep s) = s).
  • No string in the result contains the sep character.
  • Transforming

    val map : (char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00.0
    val mapi : (int -> char -> char) -> string -> string

    mapi f s is like map but the index of the character is also passed to f.

    • since 4.02.0
    val fold_left : ('a -> char -> 'a) -> 'a -> string -> 'a

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13.0
    val fold_right : (char -> 'a -> 'a) -> string -> 'a -> 'a

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13.0
    val exists : (char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00.0
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    • raises Invalid_argument

      if the result is longer than Sys.max_string_length bytes.

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)

    Traversing

    val iter : (char -> unit) -> string -> unit

    iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : (int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00.0

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Stdlib.Seq.t

    to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Stdlib.Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Stdlib.Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    UTF-8

    val get_utf_8_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Stdlib.Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    val blit : string -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from the string src, starting at index src_pos, to byte sequence dst, starting at character number dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13.0
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val hash : t -> int

    An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

    • since 5.0.0
    val seeded_hash : int -> t -> int

    A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

    • since 5.0.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13.0
    module Set : Set.S with type elt = string
    module Map : Map.S with type key = string
    module Tbl : Hashtbl.S with type key = string
    val print : Stdlib.Format.formatter -> t -> unit
    val for_all : (char -> bool) -> t -> bool
    \ No newline at end of file diff --git a/dev/ocaml/Mutable_variable/Map/index.html b/dev/ocaml/Mutable_variable/Map/index.html index 2d504466..b30e84a1 100644 --- a/dev/ocaml/Mutable_variable/Map/index.html +++ b/dev/ocaml/Mutable_variable/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Mutable_variable/Set/index.html b/dev/ocaml/Mutable_variable/Set/index.html index 296ca91c..019901bd 100644 --- a/dev/ocaml/Mutable_variable/Set/index.html +++ b/dev/ocaml/Mutable_variable/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Mutable_variable.Set)

    Module Mutable_variable.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Mutable_variable.Set)

    Module Mutable_variable.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Mutex/index.html b/dev/ocaml/Mutex/index.html deleted file mode 100644 index 04278168..00000000 --- a/dev/ocaml/Mutex/index.html +++ /dev/null @@ -1,4 +0,0 @@ - -Mutex (ocaml.Mutex)

    Module Mutex

    Locks for mutual exclusion.

    Mutexes (mutual-exclusion locks) are used to implement critical sections and protect shared mutable data structures against concurrent accesses. The typical use is (if m is the mutex associated with the data structure D):

    Mutex.lock m;
    -(* Critical section that operates over D *);
    -Mutex.unlock m
    type t

    The type of mutexes.

    val create : unit -> t

    Return a new mutex.

    val lock : t -> unit

    Lock the given mutex. Only one thread can have the mutex locked at any time. A thread that attempts to lock a mutex already locked by another thread will suspend until the other thread unlocks the mutex.

    • raises Sys_error

      if the mutex is already locked by the thread calling Mutex.lock.

    • before 4.12

      Sys_error was not raised for recursive locking (platform-dependent behaviour)

    val try_lock : t -> bool

    Same as Mutex.lock, but does not suspend the calling thread if the mutex is already locked: just return false immediately in that case. If the mutex is unlocked, lock it and return true.

    val unlock : t -> unit

    Unlock the given mutex. Other threads suspended trying to lock the mutex will restart. The mutex must have been previously locked by the thread that calls Mutex.unlock.

    • raises Sys_error

      if the mutex is unlocked or was locked by another thread.

    • before 4.12

      Sys_error was not raised when unlocking an unlocked mutex or when unlocking a mutex from a different thread.

    \ No newline at end of file diff --git a/dev/ocaml/Numbers/Float/Map/index.html b/dev/ocaml/Numbers/Float/Map/index.html index 0df22dac..cce72dc0 100644 --- a/dev/ocaml/Numbers/Float/Map/index.html +++ b/dev/ocaml/Numbers/Float/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Numbers/Float/Set/index.html b/dev/ocaml/Numbers/Float/Set/index.html index 03f1c84c..cf5f4e92 100644 --- a/dev/ocaml/Numbers/Float/Set/index.html +++ b/dev/ocaml/Numbers/Float/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Numbers.Float.Set)

    Module Float.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Numbers.Float.Set)

    Module Float.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Numbers/Int/Map/index.html b/dev/ocaml/Numbers/Int/Map/index.html index 9b18dc61..49c306ac 100644 --- a/dev/ocaml/Numbers/Int/Map/index.html +++ b/dev/ocaml/Numbers/Int/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Numbers/Int/Set/index.html b/dev/ocaml/Numbers/Int/Set/index.html index 72ed6682..0741c288 100644 --- a/dev/ocaml/Numbers/Int/Set/index.html +++ b/dev/ocaml/Numbers/Int/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Numbers.Int.Set)

    Module Int.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Numbers.Int.Set)

    Module Int.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Ocamlmktop_init/index.html b/dev/ocaml/Ocamlmktop_init/index.html new file mode 100644 index 00000000..7ff9a977 --- /dev/null +++ b/dev/ocaml/Ocamlmktop_init/index.html @@ -0,0 +1,2 @@ + +Ocamlmktop_init (ocaml.Ocamlmktop_init)

    Module Ocamlmktop_init

    \ No newline at end of file diff --git a/dev/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/class-html/index.html b/dev/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/class-html/index.html index 71d57b70..6baa484f 100644 --- a/dev/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/class-html/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Html_functor/argument-1-_/class-html/index.html @@ -44,7 +44,7 @@ int -> string option -> Odoc_info.text -> - unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> + unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> ?complete:bool -> ?with_link:bool -> Odoc_info.Class.t_class -> @@ -78,7 +78,7 @@ Odoc_dag2html.dag -> string
    method html_of_described_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
    method html_of_included_module : Buffer.t -> Odoc_info.Module.included_module -> unit
    method html_of_info : ?cls:string -> @@ -124,7 +124,7 @@ Odoc_info.Parameter.parameter -> unit
    method html_of_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_raised_exceptions : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_record : father:Odoc_info.Name.t -> diff --git a/dev/ocaml/Odoc_gen/module-type-Html_functor/class-html/index.html b/dev/ocaml/Odoc_gen/module-type-Html_functor/class-html/index.html index 8b1a46bc..6f75947d 100644 --- a/dev/ocaml/Odoc_gen/module-type-Html_functor/class-html/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Html_functor/class-html/index.html @@ -44,7 +44,7 @@ int -> string option -> Odoc_info.text -> - unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> + unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> ?complete:bool -> ?with_link:bool -> Odoc_info.Class.t_class -> @@ -78,7 +78,7 @@ Odoc_dag2html.dag -> string
    method html_of_described_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
    method html_of_included_module : Buffer.t -> Odoc_info.Module.included_module -> unit
    method html_of_info : ?cls:string -> @@ -124,7 +124,7 @@ Odoc_info.Parameter.parameter -> unit
    method html_of_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_raised_exceptions : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_record : father:Odoc_info.Name.t -> diff --git a/dev/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/class-latex/index.html b/dev/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/class-latex/index.html index 4a2b0347..ed6ebf92 100644 --- a/dev/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/class-latex/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Latex_functor/argument-1-_/class-latex/index.html @@ -107,7 +107,7 @@ Odoc_info.Name.t -> string -> Types.type_expr list -> - string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_attribute : Odoc_info.Value.t_attribute -> + string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_gen/module-type-Latex_functor/class-latex/index.html b/dev/ocaml/Odoc_gen/module-type-Latex_functor/class-latex/index.html index 55ed3e1f..8647ba7b 100644 --- a/dev/ocaml/Odoc_gen/module-type-Latex_functor/class-latex/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Latex_functor/class-latex/index.html @@ -107,7 +107,7 @@ Odoc_info.Name.t -> string -> Types.type_expr list -> - string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_attribute : Odoc_info.Value.t_attribute -> + string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/class-man/index.html b/dev/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/class-man/index.html index 1f88cdc8..e2e08717 100644 --- a/dev/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/class-man/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Man_functor/argument-1-_/class-man/index.html @@ -43,4 +43,4 @@ unit
    method man_of_type_extension : Buffer.t -> Odoc_info.Name.t -> Odoc_info.Extension.t_type_extension -> - unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file + unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_alerts : Odoc_info.alert list -> string list
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file diff --git a/dev/ocaml/Odoc_gen/module-type-Man_functor/class-man/index.html b/dev/ocaml/Odoc_gen/module-type-Man_functor/class-man/index.html index 4d9a05f7..1e00b2b0 100644 --- a/dev/ocaml/Odoc_gen/module-type-Man_functor/class-man/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Man_functor/class-man/index.html @@ -43,4 +43,4 @@ unit
    method man_of_type_extension : Buffer.t -> Odoc_info.Name.t -> Odoc_info.Extension.t_type_extension -> - unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file + unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_alerts : Odoc_info.alert list -> string list
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file diff --git a/dev/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/class-texi/index.html b/dev/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/class-texi/index.html index 832505bf..622ff4e6 100644 --- a/dev/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/class-texi/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Texi_functor/argument-1-_/class-texi/index.html @@ -60,7 +60,7 @@ Odoc_info.Extension.t_type_extension -> string
    method texi_of_value : Odoc_info.Value.t_value -> string
    method text_el_of_type_expr : Odoc_info.Name.t -> Types.type_expr -> - Odoc_info.text_element
    method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_gen/module-type-Texi_functor/class-texi/index.html b/dev/ocaml/Odoc_gen/module-type-Texi_functor/class-texi/index.html index c93883e1..ac0c4c45 100644 --- a/dev/ocaml/Odoc_gen/module-type-Texi_functor/class-texi/index.html +++ b/dev/ocaml/Odoc_gen/module-type-Texi_functor/class-texi/index.html @@ -60,7 +60,7 @@ Odoc_info.Extension.t_type_extension -> string
    method texi_of_value : Odoc_info.Value.t_value -> string
    method text_el_of_type_expr : Odoc_info.Name.t -> Types.type_expr -> - Odoc_info.text_element
    method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_html/Generator/class-html/index.html b/dev/ocaml/Odoc_html/Generator/class-html/index.html index 3a7b894a..9eab1f5e 100644 --- a/dev/ocaml/Odoc_html/Generator/class-html/index.html +++ b/dev/ocaml/Odoc_html/Generator/class-html/index.html @@ -44,7 +44,7 @@ int -> string option -> Odoc_info.text -> - unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> + unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> ?complete:bool -> ?with_link:bool -> Odoc_info.Class.t_class -> @@ -78,7 +78,7 @@ Odoc_dag2html.dag -> string
    method html_of_described_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
    method html_of_included_module : Buffer.t -> Odoc_info.Module.included_module -> unit
    method html_of_info : ?cls:string -> @@ -124,7 +124,7 @@ Odoc_info.Parameter.parameter -> unit
    method html_of_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_raised_exceptions : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_record : father:Odoc_info.Name.t -> diff --git a/dev/ocaml/Odoc_html/class-info/index.html b/dev/ocaml/Odoc_html/class-info/index.html index 6df5e504..5939971e 100644 --- a/dev/ocaml/Odoc_html/class-info/index.html +++ b/dev/ocaml/Odoc_html/class-info/index.html @@ -1,5 +1,5 @@ -info (ocaml.Odoc_html.info)

    Class Odoc_html.info

    val mutable tag_functions : (string * (Odoc_info.text -> string)) list
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_custom : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_info : ?cls:string -> +info (ocaml.Odoc_html.info)

    Class Odoc_html.info

    val mutable tag_functions : (string * (Odoc_info.text -> string)) list
    method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_custom : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_info : ?cls:string -> ?indent:bool -> Buffer.t -> Odoc_types.info option -> diff --git a/dev/ocaml/Odoc_html/module-type-Html_generator/class-html/index.html b/dev/ocaml/Odoc_html/module-type-Html_generator/class-html/index.html index 111a08d9..56e9088d 100644 --- a/dev/ocaml/Odoc_html/module-type-Html_generator/class-html/index.html +++ b/dev/ocaml/Odoc_html/module-type-Html_generator/class-html/index.html @@ -44,7 +44,7 @@ int -> string option -> Odoc_info.text -> - unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> + unit
    method html_of_Verbatim : Buffer.t -> string -> unit
    method html_of_alerts : Buffer.t -> Odoc_info.alert list -> unit
    method html_of_attribute : Buffer.t -> Odoc_info.Value.t_attribute -> unit
    method html_of_author_list : Buffer.t -> string list -> unit
    method html_of_before : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_class : Buffer.t -> ?complete:bool -> ?with_link:bool -> Odoc_info.Class.t_class -> @@ -78,7 +78,7 @@ Odoc_dag2html.dag -> string
    method html_of_described_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_exception : Buffer.t -> Odoc_info.Exception.t_exception -> unit
    method html_of_included_module : Buffer.t -> Odoc_info.Module.included_module -> unit
    method html_of_info : ?cls:string -> @@ -124,7 +124,7 @@ Odoc_info.Parameter.parameter -> unit
    method html_of_parameter_list : Buffer.t -> Odoc_info.Name.t -> - Odoc_parameter.parameter list -> + Odoc_info.Parameter.parameter list -> unit
    method html_of_raised_exceptions : Buffer.t -> (string * Odoc_info.text) list -> unit
    method html_of_record : father:Odoc_info.Name.t -> diff --git a/dev/ocaml/Odoc_info/index.html b/dev/ocaml/Odoc_info/index.html index 141b9725..4e3fa269 100644 --- a/dev/ocaml/Odoc_info/index.html +++ b/dev/ocaml/Odoc_info/index.html @@ -1,9 +1,9 @@ -Odoc_info (ocaml.Odoc_info)

    Module Odoc_info

    Interface to the information collected in source files.

    type ref_kind = Odoc_types.ref_kind =
    1. | RK_module
    2. | RK_module_type
    3. | RK_class
    4. | RK_class_type
    5. | RK_value
    6. | RK_type
    7. | RK_extension
    8. | RK_exception
    9. | RK_attribute
    10. | RK_method
    11. | RK_section of text
    12. | RK_recfield
    13. | RK_const

    The different kinds of element references.

    and text_element = Odoc_types.text_element =
    1. | Raw of string
      (*

      Raw text.

      *)
    2. | Code of string
      (*

      The string is source code.

      *)
    3. | CodePre of string
      (*

      The string is pre-formatted source code.

      *)
    4. | Verbatim of string
      (*

      String 'as is'.

      *)
    5. | Bold of text
      (*

      Text in bold style.

      *)
    6. | Italic of text
      (*

      Text in italic.

      *)
    7. | Emphasize of text
      (*

      Emphasized text.

      *)
    8. | Center of text
      (*

      Centered text.

      *)
    9. | Left of text
      (*

      Left alignment.

      *)
    10. | Right of text
      (*

      Right alignment.

      *)
    11. | List of text list
      (*

      A list.

      *)
    12. | Enum of text list
      (*

      An enumerated list.

      *)
    13. | Newline
      (*

      To force a line break.

      *)
    14. | Block of text
      (*

      Like html's block quote.

      *)
    15. | Title of int * string option * text
      (*

      Style number, optional label, and text.

      *)
    16. | Latex of string
      (*

      A string for latex.

      *)
    17. | Ref of string * ref_kind option * text option
      (*

      A reference to an element. Complete name and kind. An optional text can be given to display this text instead of the element name.

      *)
    18. | Superscript of text
      (*

      Superscripts.

      *)
    19. | Subscript of text
      (*

      Subscripts.

      *)
    20. | Module_list of string list
      (*

      The table of the given modules with their abstract.

      *)
    21. | Index_list
      (*

      The links to the various indexes (values, types, ...)

      *)
    22. | Custom of string * text
      (*

      to extend {foo syntax

      *)
    23. | Target of string * string
      (*

      (target, code) : to specify code specific to a target format

      *)
    and text = text_element list

    A text is a list of text_element. The order matters.

    type see_ref = Odoc_types.see_ref =
    1. | See_url of string
    2. | See_file of string
    3. | See_doc of string

    The different forms of references in @see tags.

    exception Text_syntax of int * int * string

    Raised when parsing string to build a Odoc_info.text structure. (line, char, string)

    type see = see_ref * text

    The information in a @see tag.

    type param = string * text

    Parameter name and description.

    type raised_exception = string * text

    Raised exception name and description.

    type info = Odoc_types.info = {
    1. i_desc : text option;
      (*

      The description text.

      *)
    2. i_authors : string list;
      (*

      The list of authors in @author tags.

      *)
    3. i_version : string option;
      (*

      The string in the @version tag.

      *)
    4. i_sees : see list;
      (*

      The list of @see tags.

      *)
    5. i_since : string option;
      (*

      The string in the @since tag.

      *)
    6. i_before : (string * text) list;
      (*

      the version number and text in @before tag

      *)
    7. i_deprecated : text option;
      (*

      The description text of the @deprecated tag.

      *)
    8. i_params : param list;
      (*

      The list of parameter descriptions.

      *)
    9. i_raised_exceptions : raised_exception list;
      (*

      The list of raised exceptions.

      *)
    10. i_return_value : text option;
      (*

      The description text of the return value.

      *)
    11. i_custom : (string * text) list;
      (*

      A text associated to a custom @-tag.

      *)
    }

    Information in a special comment

    • before 3.12.0

      @before information was not present.

    type location = Odoc_types.location = {
    1. loc_impl : Location.t option;
      (*

      implementation location

      *)
    2. loc_inter : Location.t option;
      (*

      interface location

      *)
    }

    Location of elements in implementation and interface files.

    val dummy_loc : location

    A dummy location.

    module Name : sig ... end

    Representation of element names.

    module Parameter : sig ... end

    Representation and manipulation of method / function / class / module parameters.

    module Extension : sig ... end

    Representation and manipulation of extensions.

    module Exception : sig ... end

    Representation and manipulation of exceptions.

    module Type : sig ... end

    Representation and manipulation of types.

    module Value : sig ... end

    Representation and manipulation of values, class attributes and class methods.

    module Class : sig ... end

    Representation and manipulation of classes and class types.

    module Module : sig ... end

    Representation and manipulation of modules and module types.

    Getting strings from values

    val reset_type_names : unit -> unit

    This function is used to reset the names of type variables. It must be called when printing the whole type of a function, but not when printing the type of its parameters. Same for classes (call it) and methods and attributes (don't call it).

    val string_of_variance : Type.t_type -> (bool * bool) -> string

    string_of_variance t (covariant, invariant) returns "+" if the given information means "covariant", "-" if it means "contravariant", orelse "", and always "" if the given type is not an abstract type with no manifest (i.e. no need for the variance to be printed).

    val string_of_type_expr : Types.type_expr -> string

    This function returns a string representing a Types.type_expr.

    val string_of_class_params : Class.t_class -> string
    • returns

      a string to display the parameters of the given class, in the same form as the compiler.

    val string_of_type_list : ?par:bool -> string -> Types.type_expr list -> string

    This function returns a string to represent the given list of types, with a given separator.

    val string_of_type_param_list : Type.t_type -> string

    This function returns a string to represent the list of type parameters for the given type.

    val string_of_type_extension_param_list : Extension.t_type_extension -> string

    This function returns a string to represent the list of type parameters for the given type extension.

    val string_of_class_type_param_list : Types.type_expr list -> string

    This function returns a string to represent the given list of type parameters of a class or class type, with a given separator.

    val string_of_module_type : +Odoc_info (ocaml.Odoc_info)

    Module Odoc_info

    Interface to the information collected in source files.

    type ref_kind = Odoc_types.ref_kind =
    1. | RK_module
    2. | RK_module_type
    3. | RK_class
    4. | RK_class_type
    5. | RK_value
    6. | RK_type
    7. | RK_extension
    8. | RK_exception
    9. | RK_attribute
    10. | RK_method
    11. | RK_section of text
    12. | RK_recfield
    13. | RK_const

    The different kinds of element references.

    and text_element = Odoc_types.text_element =
    1. | Raw of string
      (*

      Raw text.

      *)
    2. | Code of string
      (*

      The string is source code.

      *)
    3. | CodePre of string
      (*

      The string is pre-formatted source code.

      *)
    4. | Verbatim of string
      (*

      String 'as is'.

      *)
    5. | Bold of text
      (*

      Text in bold style.

      *)
    6. | Italic of text
      (*

      Text in italic.

      *)
    7. | Emphasize of text
      (*

      Emphasized text.

      *)
    8. | Center of text
      (*

      Centered text.

      *)
    9. | Left of text
      (*

      Left alignment.

      *)
    10. | Right of text
      (*

      Right alignment.

      *)
    11. | List of text list
      (*

      A list.

      *)
    12. | Enum of text list
      (*

      An enumerated list.

      *)
    13. | Newline
      (*

      To force a line break.

      *)
    14. | Block of text
      (*

      Like html's block quote.

      *)
    15. | Title of int * string option * text
      (*

      Style number, optional label, and text.

      *)
    16. | Latex of string
      (*

      A string for latex.

      *)
    17. | Ref of string * ref_kind option * text option
      (*

      A reference to an element. Complete name and kind. An optional text can be given to display this text instead of the element name.

      *)
    18. | Superscript of text
      (*

      Superscripts.

      *)
    19. | Subscript of text
      (*

      Subscripts.

      *)
    20. | Module_list of string list
      (*

      The table of the given modules with their abstract.

      *)
    21. | Index_list
      (*

      The links to the various indexes (values, types, ...)

      *)
    22. | Custom of string * text
      (*

      to extend {foo syntax

      *)
    23. | Target of string * string
      (*

      (target, code) : to specify code specific to a target format

      *)
    and text = text_element list

    A text is a list of text_element. The order matters.

    type see_ref = Odoc_types.see_ref =
    1. | See_url of string
    2. | See_file of string
    3. | See_doc of string

    The different forms of references in @see tags.

    exception Text_syntax of int * int * string

    Raised when parsing string to build a Odoc_info.text structure. (line, char, string)

    type see = see_ref * text

    The information in a @see tag.

    type param = string * text

    Parameter name and description.

    type raised_exception = string * text

    Raised exception name and description.

    type alert = Odoc_types.alert = {
    1. alert_name : string;
    2. alert_payload : string option;
    }
    type info = Odoc_types.info = {
    1. i_desc : text option;
      (*

      The description text.

      *)
    2. i_authors : string list;
      (*

      The list of authors in @author tags.

      *)
    3. i_version : string option;
      (*

      The string in the @version tag.

      *)
    4. i_sees : see list;
      (*

      The list of @see tags.

      *)
    5. i_since : string option;
      (*

      The string in the @since tag.

      *)
    6. i_before : (string * text) list;
      (*

      the version number and text in @before tag

      *)
    7. i_deprecated : text option;
      (*

      The description text of the @deprecated tag.

      *)
    8. i_params : param list;
      (*

      The list of parameter descriptions.

      *)
    9. i_raised_exceptions : raised_exception list;
      (*

      The list of raised exceptions.

      *)
    10. i_return_value : text option;
      (*

      The description text of the return value.

      *)
    11. i_custom : (string * text) list;
      (*

      A text associated to a custom @-tag.

      *)
    12. i_alerts : alert list;
      (*

      Alerts associated to the same item. Not from special comments.

      *)
    }

    Information in a special comment

    • before 3.12.0

      @before information was not present.

    type location = Odoc_types.location = {
    1. loc_impl : Location.t option;
      (*

      implementation location

      *)
    2. loc_inter : Location.t option;
      (*

      interface location

      *)
    }

    Location of elements in implementation and interface files.

    val dummy_loc : location

    A dummy location.

    module Name : sig ... end

    Representation of element names.

    module Parameter : sig ... end

    Representation and manipulation of method / function / class / module parameters.

    module Extension : sig ... end

    Representation and manipulation of extensions.

    module Exception : sig ... end

    Representation and manipulation of exceptions.

    module Type : sig ... end

    Representation and manipulation of types.

    module Value : sig ... end

    Representation and manipulation of values, class attributes and class methods.

    module Class : sig ... end

    Representation and manipulation of classes and class types.

    module Module : sig ... end

    Representation and manipulation of modules and module types.

    Getting strings from values

    val reset_type_names : unit -> unit

    This function is used to reset the names of type variables. It must be called when printing the whole type of a function, but not when printing the type of its parameters. Same for classes (call it) and methods and attributes (don't call it).

    val string_of_variance : Type.t_type -> (bool * bool) -> string

    string_of_variance t (covariant, invariant) returns "+" if the given information means "covariant", "-" if it means "contravariant", orelse "", and always "" if the given type is not an abstract type with no manifest (i.e. no need for the variance to be printed).

    val string_of_type_expr : Types.type_expr -> string

    This function returns a string representing a Types.type_expr.

    val string_of_class_params : Class.t_class -> string
    • returns

      a string to display the parameters of the given class, in the same form as the compiler.

    val string_of_type_list : ?par:bool -> string -> Types.type_expr list -> string

    This function returns a string to represent the given list of types, with a given separator.

    val string_of_type_param_list : Type.t_type -> string

    This function returns a string to represent the list of type parameters for the given type.

    val string_of_type_extension_param_list : Extension.t_type_extension -> string

    This function returns a string to represent the list of type parameters for the given type extension.

    val string_of_class_type_param_list : Types.type_expr list -> string

    This function returns a string to represent the given list of type parameters of a class or class type, with a given separator.

    val string_of_module_type : ?code:string -> ?complete:bool -> Types.module_type -> - string

    This function returns a string representing a Types.module_type.

    • parameter complete

      indicates if we must print complete signatures or just sig end. Default is false.

    • parameter code

      if complete = false and the type contains something else than identificators and functors, then the given code is used.

    val string_of_class_type : ?complete:bool -> Types.class_type -> string

    This function returns a string representing a Types.class_type.

    • parameter complete

      indicates if we must print complete signatures or just object end. Default is false.

    val string_of_text : text -> string

    Get a string from a text.

    val string_of_info : info -> string

    Get a string from an info structure.

    val string_of_type : Type.t_type -> string
    • returns

      a string to describe the given type.

    val string_of_record : Type.record_field list -> string
    val string_of_type_extension : Extension.t_type_extension -> string
    • returns

      a string to describe the given type extension.

    val string_of_exception : Exception.t_exception -> string
    • returns

      a string to describe the given exception.

    val string_of_value : Value.t_value -> string
    • returns

      a string to describe the given value.

    val string_of_attribute : Value.t_attribute -> string
    • returns

      a string to describe the given attribute.

    val string_of_method : Value.t_method -> string
    • returns

      a string to describe the given method.

    Miscellaneous functions

    val first_sentence_of_text : text -> text

    Return the first sentence (until the first dot followed by a blank or the first blank line) of a text. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

    val first_sentence_and_rest_of_text : text -> text * text

    Return the first sentence (until the first dot followed by a blank or the first blank line) of a text, and the remaining text after. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

    val text_no_title_no_list : text -> text

    Return the given text without any title or list.

    val text_concat : Odoc_types.text -> Odoc_types.text list -> Odoc_types.text

    concat sep l concats the given list of text l, each separated with the text sep.

    val get_titles_in_text : text -> (int * string option * text) list

    Return the list of titles in a text. A title is a title level, an optional label and a text.

    val create_index_lists : 'a list -> ('a -> string) -> 'a list list

    Take a sorted list of elements, a function to get the name of an element and return the list of list of elements, where each list group elements beginning by the same letter. Since the original list is sorted, elements whose name does not begin with a letter should be in the first returned list.

    val remove_option : Types.type_expr -> Types.type_expr

    Take a type and remove the option top constructor. This is useful when printing labels, we then remove the top option constructor for optional labels.

    val is_optional : Asttypes.arg_label -> bool

    Return true if the given label is optional.

    val label_name : Asttypes.arg_label -> string

    Return the label name for the given label, i.e. removes the beginning '?' if present.

    val use_hidden_modules : Name.t -> Name.t

    Return the given name where the module name or part of it was removed, according to the list of modules which must be hidden (cf Odoc_args.hidden_modules)

    val verbose : string -> unit

    Print the given string if the verbose mode is activated.

    val warning : string -> unit

    Print a warning message to stderr. If warnings must be treated as errors, then the error counter is incremented.

    val print_warnings : bool ref

    A flag to indicate whether ocamldoc warnings must be printed or not.

    val errors : int ref

    Increment this counter when an error is encountered. The ocamldoc tool will print the number of errors encountered exit with code 1 if this number is greater than 0.

    val apply_opt : ('a -> 'b) -> 'a option -> 'b option

    Apply a function to an optional value.

    val apply_if_equal : ('a -> 'a) -> 'a -> 'a -> 'a

    Apply a function to a first value if it is not different from a second value. If the two values are different, return the second one.

    val text_of_string : string -> text

    text_of_string s returns the text structure from the given string.

    • raises Text_syntax

      if a syntax error is encountered.

    val text_string_of_text : text -> string

    text_string_of_text text returns the string representing the given text. This string can then be parsed again by Odoc_info.text_of_string.

    val info_of_string : string -> info

    info_of_string s parses the given string like a regular ocamldoc comment and return an Odoc_info.info structure.

    • returns

      an empty structure if there was a syntax error. TODO: change this

    val info_string_of_info : info -> string

    info_string_of_info info returns the string representing the given info. This string can then be parsed again by Odoc_info.info_of_string.

    val info_of_comment_file : Module.t_module list -> string -> info

    info_of_comment_file file parses the given file and return an Odoc_info.info structure. The content of the file must have the same syntax as the content of a special comment. The given module list is used for cross reference.

    • raises Failure

      if the file could not be opened or there is a syntax error.

    val remove_ending_newline : string -> string

    remove_ending_newline s returns s without the optional ending newline.

    Research in elements

    module Scan : sig ... end

    Scanning of collected information

    module Dep : sig ... end

    Computation of dependencies.

    Some global variables

    module Global : sig ... end
    val analyse_files : + string

    This function returns a string representing a Types.module_type.

    • parameter complete

      indicates if we must print complete signatures or just sig end. Default is false.

    • parameter code

      if complete = false and the type contains something else than identificators and functors, then the given code is used.

    val string_of_class_type : ?complete:bool -> Types.class_type -> string

    This function returns a string representing a Types.class_type.

    • parameter complete

      indicates if we must print complete signatures or just object end. Default is false.

    val string_of_text : text -> string

    Get a string from a text.

    val string_of_info : info -> string

    Get a string from an info structure.

    val string_of_type : Type.t_type -> string
    • returns

      a string to describe the given type.

    val string_of_record : Type.record_field list -> string
    val string_of_type_extension : Extension.t_type_extension -> string
    • returns

      a string to describe the given type extension.

    val string_of_exception : Exception.t_exception -> string
    • returns

      a string to describe the given exception.

    val string_of_value : Value.t_value -> string
    • returns

      a string to describe the given value.

    val string_of_attribute : Value.t_attribute -> string
    • returns

      a string to describe the given attribute.

    val string_of_method : Value.t_method -> string
    • returns

      a string to describe the given method.

    Miscellaneous functions

    val first_sentence_of_text : text -> text

    Return the first sentence (until the first dot followed by a blank or the first blank line) of a text. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

    val first_sentence_and_rest_of_text : text -> text * text

    Return the first sentence (until the first dot followed by a blank or the first blank line) of a text, and the remaining text after. Don't stop in the middle of Code, CodePre, Verbatim, List, Enum, Latex, Link, Ref, Subscript or Superscript.

    val text_no_title_no_list : text -> text

    Return the given text without any title or list.

    val text_concat : Odoc_types.text -> Odoc_types.text list -> Odoc_types.text

    concat sep l concats the given list of text l, each separated with the text sep.

    val get_titles_in_text : text -> (int * string option * text) list

    Return the list of titles in a text. A title is a title level, an optional label and a text.

    val create_index_lists : 'a list -> ('a -> string) -> 'a list list

    Take a sorted list of elements, a function to get the name of an element and return the list of list of elements, where each list group elements beginning by the same letter. Since the original list is sorted, elements whose name does not begin with a letter should be in the first returned list.

    val remove_option : Types.type_expr -> Types.type_expr

    Take a type and remove the option top constructor. This is useful when printing labels, we then remove the top option constructor for optional labels.

    val is_optional : Asttypes.arg_label -> bool

    Return true if the given label is optional.

    val label_name : Asttypes.arg_label -> string

    Return the label name for the given label, i.e. removes the beginning '?' if present.

    val use_hidden_modules : Name.t -> Name.t

    Return the given name where the module name or part of it was removed, according to the list of modules which must be hidden (cf Odoc_args.hidden_modules)

    val verbose : string -> unit

    Print the given string if the verbose mode is activated.

    val warning : string -> unit

    Print a warning message to stderr. If warnings must be treated as errors, then the error counter is incremented.

    val print_warnings : bool ref

    A flag to indicate whether ocamldoc warnings must be printed or not.

    val errors : int ref

    Increment this counter when an error is encountered. The ocamldoc tool will print the number of errors encountered exit with code 1 if this number is greater than 0.

    val apply_opt : ('a -> 'b) -> 'a option -> 'b option

    Apply a function to an optional value.

    val apply_if_equal : ('a -> 'a) -> 'a -> 'a -> 'a

    Apply a function to a first value if it is not different from a second value. If the two values are different, return the second one.

    val text_of_string : string -> text

    text_of_string s returns the text structure from the given string.

    • raises Text_syntax

      if a syntax error is encountered.

    val text_string_of_text : text -> string

    text_string_of_text text returns the string representing the given text. This string can then be parsed again by Odoc_info.text_of_string.

    val info_of_string : string -> info

    info_of_string s parses the given string like a regular ocamldoc comment and return an Odoc_info.info structure.

    • returns

      an empty structure if there was a syntax error. TODO: change this

    val info_of_comment_file : Module.t_module list -> string -> info

    info_of_comment_file file parses the given file and return an Odoc_info.info structure. The content of the file must have the same syntax as the content of a special comment. The given module list is used for cross reference.

    • raises Failure

      if the file could not be opened or there is a syntax error.

    val remove_ending_newline : string -> string

    remove_ending_newline s returns s without the optional ending newline.

    Research in elements

    module Scan : sig ... end

    Scanning of collected information

    module Dep : sig ... end

    Computation of dependencies.

    Some global variables

    module Global : sig ... end
    val analyse_files : ?merge_options:Odoc_types.merge_option list -> ?include_dirs:string list -> ?labels:bool -> diff --git a/dev/ocaml/Odoc_latex/Generator/class-latex/index.html b/dev/ocaml/Odoc_latex/Generator/class-latex/index.html index be801886..afa68c07 100644 --- a/dev/ocaml/Odoc_latex/Generator/class-latex/index.html +++ b/dev/ocaml/Odoc_latex/Generator/class-latex/index.html @@ -107,7 +107,7 @@ Odoc_info.Name.t -> string -> Types.type_expr list -> - string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_attribute : Odoc_info.Value.t_attribute -> + string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_latex/module-type-Latex_generator/class-latex/index.html b/dev/ocaml/Odoc_latex/module-type-Latex_generator/class-latex/index.html index 1e1f5727..e7c3ea0c 100644 --- a/dev/ocaml/Odoc_latex/module-type-Latex_generator/class-latex/index.html +++ b/dev/ocaml/Odoc_latex/module-type-Latex_generator/class-latex/index.html @@ -107,7 +107,7 @@ Odoc_info.Name.t -> string -> Types.type_expr list -> - string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_attribute : Odoc_info.Value.t_attribute -> + string
    method recfield_label : ?no_:bool -> Odoc_info.Name.t -> string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method section_style : int -> string -> string
    method subst : (Str.regexp * string) list -> string -> string
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_man/Generator/class-man/index.html b/dev/ocaml/Odoc_man/Generator/class-man/index.html index c4623f37..97458430 100644 --- a/dev/ocaml/Odoc_man/Generator/class-man/index.html +++ b/dev/ocaml/Odoc_man/Generator/class-man/index.html @@ -43,4 +43,4 @@ unit
    method man_of_type_extension : Buffer.t -> Odoc_info.Name.t -> Odoc_info.Extension.t_type_extension -> - unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file + unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_alerts : Odoc_info.alert list -> string list
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file diff --git a/dev/ocaml/Odoc_man/class-info/index.html b/dev/ocaml/Odoc_man/class-info/index.html index 1ba1a91c..8334d065 100644 --- a/dev/ocaml/Odoc_man/class-info/index.html +++ b/dev/ocaml/Odoc_man/class-info/index.html @@ -1,2 +1,2 @@ -info (ocaml.Odoc_man.info)

    Class Odoc_man.info

    val mutable tag_functions : (string * (Odoc_info.text -> string)) list
    method man_of_info : ?margin:int -> Buffer.t -> Odoc_types.info option -> unit
    method man_of_text : Buffer.t -> Odoc_info.text -> unit
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file +info (ocaml.Odoc_man.info)

    Class Odoc_man.info

    val mutable tag_functions : (string * (Odoc_info.text -> string)) list
    method man_of_info : ?margin:int -> Buffer.t -> Odoc_types.info option -> unit
    method man_of_text : Buffer.t -> Odoc_info.text -> unit
    method str_man_of_alerts : Odoc_info.alert list -> string list
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file diff --git a/dev/ocaml/Odoc_man/module-type-Man_generator/class-man/index.html b/dev/ocaml/Odoc_man/module-type-Man_generator/class-man/index.html index efa56173..6834a08b 100644 --- a/dev/ocaml/Odoc_man/module-type-Man_generator/class-man/index.html +++ b/dev/ocaml/Odoc_man/module-type-Man_generator/class-man/index.html @@ -43,4 +43,4 @@ unit
    method man_of_type_extension : Buffer.t -> Odoc_info.Name.t -> Odoc_info.Extension.t_type_extension -> - unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file + unit
    method man_of_value : Buffer.t -> Odoc_info.Value.t_value -> unit
    method open_out : string -> out_channel
    method relative_idents : Odoc_info.Name.t -> Odoc_info.Name.t -> string
    method remove_newlines : string -> string
    method str_man_of_alerts : Odoc_info.alert list -> string list
    method str_man_of_author_list : string list -> string
    method str_man_of_before : (string * Odoc_info.text) list -> string
    method str_man_of_custom : (string * Odoc_info.text) list -> string list
    method str_man_of_raised_exceptions : (string * Odoc_info.text) list -> string
    method str_man_of_return_opt : Odoc_info.text option -> string
    method str_man_of_see : (Odoc_info.see_ref * Odoc_info.text) -> string
    method str_man_of_sees : (Odoc_info.see_ref * Odoc_info.text) list -> string
    method str_man_of_since_opt : string option -> string
    method str_man_of_text : Odoc_info.text -> string
    method str_man_of_version_opt : string option -> string
    \ No newline at end of file diff --git a/dev/ocaml/Odoc_messages/index.html b/dev/ocaml/Odoc_messages/index.html index c338f744..189104d5 100644 --- a/dev/ocaml/Odoc_messages/index.html +++ b/dev/ocaml/Odoc_messages/index.html @@ -1,2 +1,2 @@ -Odoc_messages (ocaml.Odoc_messages)

    Module Odoc_messages

    val ok : string
    val software : string
    val config_version : string
    val magic : string
    val usage : string
    val options_are : string
    val latex_only : string
    val texi_only : string
    val latex_texi_only : string
    val html_only : string
    val html_latex_only : string
    val html_latex_texi_only : string
    val man_only : string
    val option_impl : string
    val option_intf : string
    val option_text : string
    val display_custom_generators_dir : string
    val add_load_dir : string
    val load_file : string
    val werr : string
    val show_missed_crossref : string
    val hide_warnings : string
    val target_dir : string
    val dump : string
    val load : string
    val css_style : string
    val index_only : string
    val colorize_code : string
    val html_short_functors : string
    val charset : string -> string
    val no_navbar : string
    val generate_html : string
    val generate_latex : string
    val generate_texinfo : string
    val generate_man : string
    val generate_dot : string
    val option_not_in_native_code : string -> string
    val default_out_file : string
    val out_file : string
    val dot_include_all : string
    val dot_types : string
    val default_dot_colors : string list list
    val dot_colors : string
    val dot_reduce : string
    val man_mini : string
    val default_man_section : string
    val man_section : string
    val default_man_suffix : string
    val man_suffix : string
    val option_title : string
    val option_intro : string
    val with_parameter_list : string
    val hide_modules : string
    val no_header : string
    val no_trailer : string
    val separate_files : string
    val latex_title : (int * string) list ref -> string
    val default_latex_value_prefix : string
    val latex_value_prefix : string
    val default_latex_type_prefix : string
    val latex_type_prefix : string
    val default_latex_type_elt_prefix : string
    val latex_type_elt_prefix : string
    val default_latex_extension_prefix : string
    val latex_extension_prefix : string
    val default_latex_exception_prefix : string
    val latex_exception_prefix : string
    val default_latex_module_prefix : string
    val latex_module_prefix : string
    val default_latex_module_type_prefix : string
    val latex_module_type_prefix : string
    val default_latex_class_prefix : string
    val latex_class_prefix : string
    val default_latex_class_type_prefix : string
    val latex_class_type_prefix : string
    val default_latex_attribute_prefix : string
    val latex_attribute_prefix : string
    val default_latex_method_prefix : string
    val latex_method_prefix : string
    val no_toc : string
    val sort_modules : string
    val no_stop : string
    val no_custom_tags : string
    val remove_stars : string
    val keep_code : string
    val inverse_merge_ml_mli : string
    val no_filter_with_module_constraints : string
    val merge_description : char * string
    val merge_author : char * string
    val merge_version : char * string
    val merge_see : char * string
    val merge_since : char * string
    val merge_before : char * string
    val merge_deprecated : char * string
    val merge_param : char * string
    val merge_raised_exception : char * string
    val merge_return_value : char * string
    val merge_custom : char * string
    val merge_all : char * string
    val no_index : string
    val esc_8bits : string
    val texinfo_title : (int * (string * string)) list ref -> string
    val info_section : string
    val info_entry : string
    val options_can_be : string
    val string_of_options_list : (char * string) list -> string
    val merge_options : string
    val initially_opened_module : string
    val library_namespace : string
    val help : string
    val warning : string
    val error_location : string -> int -> int -> string
    val bad_magic_number : string
    val not_a_module_name : string -> string
    val load_file_error : string -> string -> string
    val wrong_format : string -> string
    val errors_occured : int -> string
    val parse_error : string
    val text_parse_error : int -> int -> string -> string
    val file_not_found_in_paths : string list -> string -> string
    val tag_not_handled : string -> string
    val should_escape_at_sign : string
    val bad_tree : string
    val not_a_valid_tag : string -> string
    val fun_without_param : string -> string
    val method_without_param : string -> string
    val anonymous_parameters : string -> string
    val function_colon : string -> string
    val implicit_match_in_parameter : string
    val unknown_extension : string -> string
    val two_implementations : string -> string
    val two_interfaces : string -> string
    val too_many_module_objects : string -> string
    val extension_not_found_in_implementation : string -> string -> string
    val exception_not_found_in_implementation : string -> string -> string
    val type_not_found_in_implementation : string -> string -> string
    val module_not_found_in_implementation : string -> string -> string
    val value_not_found_in_implementation : string -> string -> string
    val class_not_found_in_implementation : string -> string -> string
    val attribute_not_found_in_implementation : string -> string -> string
    val method_not_found_in_implementation : string -> string -> string
    val different_types : string -> string
    val attribute_type_not_found : string -> string -> string
    val method_type_not_found : string -> string -> string
    val module_not_found : string -> string -> string
    val module_type_not_found : string -> string -> string
    val value_not_found : string -> string -> string
    val extension_not_found : string -> string -> string
    val exception_not_found : string -> string -> string
    val type_not_found : string -> string -> string
    val class_not_found : string -> string -> string
    val class_type_not_found : string -> string -> string
    val type_not_found_in_typedtree : string -> string
    val extension_not_found_in_typedtree : string -> string
    val exception_not_found_in_typedtree : string -> string
    val module_type_not_found_in_typedtree : string -> string
    val module_not_found_in_typedtree : string -> string
    val class_not_found_in_typedtree : string -> string
    val class_type_not_found_in_typedtree : string -> string
    val inherit_classexp_not_found_in_typedtree : int -> string
    val attribute_not_found_in_typedtree : string -> string
    val method_not_found_in_typedtree : string -> string
    val misplaced_comment : string -> int -> string
    val cross_module_not_found : string -> string
    val cross_module_type_not_found : string -> string
    val cross_module_or_module_type_not_found : string -> string
    val cross_class_not_found : string -> string
    val cross_class_type_not_found : string -> string
    val cross_class_or_class_type_not_found : string -> string
    val cross_extension_not_found : string -> string
    val cross_exception_not_found : string -> string
    val cross_element_not_found : string -> string
    val cross_method_not_found : string -> string
    val cross_attribute_not_found : string -> string
    val cross_section_not_found : string -> string
    val cross_value_not_found : string -> string
    val cross_type_not_found : string -> string
    val cross_recfield_not_found : string -> string
    val cross_const_not_found : string -> string
    val code_could_be_cross_reference : string -> string -> string
    val object_end : string
    val struct_end : string
    val sig_end : string
    val current_generator_is_not : string -> string
    val analysing : string -> string
    val merging : string
    val cross_referencing : string
    val generating_doc : string
    val loading : string -> string
    val file_generated : string -> string
    val file_exists_dont_generate : string -> string
    val modul : string
    val modules : string
    val functors : string
    val values : string
    val types : string
    val extensions : string
    val exceptions : string
    val record : string
    val variant : string
    val mutab : string
    val functions : string
    val parameters : string
    val abstract : string
    val functo : string
    val clas : string
    val classes : string
    val attributes : string
    val methods : string
    val authors : string
    val version : string
    val since : string
    val before : string
    val deprecated : string
    val raises : string
    val returns : string
    val inherits : string
    val inheritance : string
    val privat : string
    val module_type : string
    val class_type : string
    val description : string
    val interface : string
    val type_parameters : string
    val class_types : string
    val module_types : string
    val see_also : string
    val documentation : string
    val index_of : string
    val top : string
    val index_of_values : string
    val index_of_extensions : string
    val index_of_exceptions : string
    val index_of_types : string
    val index_of_attributes : string
    val index_of_methods : string
    val index_of_classes : string
    val index_of_class_types : string
    val index_of_modules : string
    val index_of_module_types : string
    val previous : string
    val next : string
    val up : string
    \ No newline at end of file +Odoc_messages (ocaml.Odoc_messages)

    Module Odoc_messages

    val ok : string
    val software : string
    val config_version : string
    val magic : string
    val usage : string
    val options_are : string
    val latex_only : string
    val texi_only : string
    val latex_texi_only : string
    val html_only : string
    val html_latex_only : string
    val html_latex_texi_only : string
    val man_only : string
    val option_impl : string
    val option_intf : string
    val option_text : string
    val display_custom_generators_dir : string
    val add_load_dir : string
    val load_file : string
    val werr : string
    val show_missed_crossref : string
    val hide_warnings : string
    val target_dir : string
    val dump : string
    val load : string
    val css_style : string
    val index_only : string
    val colorize_code : string
    val html_short_functors : string
    val charset : string -> string
    val no_navbar : string
    val generate_html : string
    val generate_latex : string
    val generate_texinfo : string
    val generate_man : string
    val generate_dot : string
    val option_not_in_native_code : string -> string
    val default_out_file : string
    val out_file : string
    val dot_include_all : string
    val dot_types : string
    val default_dot_colors : string list list
    val dot_colors : string
    val dot_reduce : string
    val man_mini : string
    val default_man_section : string
    val man_section : string
    val default_man_suffix : string
    val man_suffix : string
    val option_title : string
    val option_intro : string
    val with_parameter_list : string
    val hide_modules : string
    val no_header : string
    val no_trailer : string
    val separate_files : string
    val latex_title : (int * string) list ref -> string
    val default_latex_value_prefix : string
    val latex_value_prefix : string
    val default_latex_type_prefix : string
    val latex_type_prefix : string
    val default_latex_type_elt_prefix : string
    val latex_type_elt_prefix : string
    val default_latex_extension_prefix : string
    val latex_extension_prefix : string
    val default_latex_exception_prefix : string
    val latex_exception_prefix : string
    val default_latex_module_prefix : string
    val latex_module_prefix : string
    val default_latex_module_type_prefix : string
    val latex_module_type_prefix : string
    val default_latex_class_prefix : string
    val latex_class_prefix : string
    val default_latex_class_type_prefix : string
    val latex_class_type_prefix : string
    val default_latex_attribute_prefix : string
    val latex_attribute_prefix : string
    val default_latex_method_prefix : string
    val latex_method_prefix : string
    val no_toc : string
    val sort_modules : string
    val no_stop : string
    val no_custom_tags : string
    val remove_stars : string
    val keep_code : string
    val inverse_merge_ml_mli : string
    val no_filter_with_module_constraints : string
    val merge_description : char * string
    val merge_author : char * string
    val merge_version : char * string
    val merge_see : char * string
    val merge_since : char * string
    val merge_before : char * string
    val merge_deprecated : char * string
    val merge_param : char * string
    val merge_raised_exception : char * string
    val merge_return_value : char * string
    val merge_custom : char * string
    val merge_all : char * string
    val no_index : string
    val esc_8bits : string
    val texinfo_title : (int * (string * string)) list ref -> string
    val info_section : string
    val info_entry : string
    val options_can_be : string
    val string_of_options_list : (char * string) list -> string
    val merge_options : string
    val initially_opened_module : string
    val library_namespace : string
    val help : string
    val warning : string
    val error_location : string -> int -> int -> string
    val bad_magic_number : string
    val not_a_module_name : string -> string
    val load_file_error : string -> string -> string
    val wrong_format : string -> string
    val errors_occured : int -> string
    val parse_error : string
    val text_parse_error : int -> int -> string -> string
    val file_not_found_in_paths : string list -> string -> string
    val tag_not_handled : string -> string
    val should_escape_at_sign : string
    val bad_tree : string
    val not_a_valid_tag : string -> string
    val fun_without_param : string -> string
    val method_without_param : string -> string
    val anonymous_parameters : string -> string
    val function_colon : string -> string
    val implicit_match_in_parameter : string
    val unknown_extension : string -> string
    val two_implementations : string -> string
    val two_interfaces : string -> string
    val too_many_module_objects : string -> string
    val extension_not_found_in_implementation : string -> string -> string
    val exception_not_found_in_implementation : string -> string -> string
    val type_not_found_in_implementation : string -> string -> string
    val module_not_found_in_implementation : string -> string -> string
    val value_not_found_in_implementation : string -> string -> string
    val class_not_found_in_implementation : string -> string -> string
    val attribute_not_found_in_implementation : string -> string -> string
    val method_not_found_in_implementation : string -> string -> string
    val different_types : string -> string
    val attribute_type_not_found : string -> string -> string
    val method_type_not_found : string -> string -> string
    val module_not_found : string -> string -> string
    val module_type_not_found : string -> string -> string
    val value_not_found : string -> string -> string
    val extension_not_found : string -> string -> string
    val exception_not_found : string -> string -> string
    val type_not_found : string -> string -> string
    val class_not_found : string -> string -> string
    val class_type_not_found : string -> string -> string
    val type_not_found_in_typedtree : string -> string
    val extension_not_found_in_typedtree : string -> string
    val exception_not_found_in_typedtree : string -> string
    val module_type_not_found_in_typedtree : string -> string
    val module_not_found_in_typedtree : string -> string
    val class_not_found_in_typedtree : string -> string
    val class_type_not_found_in_typedtree : string -> string
    val inherit_classexp_not_found_in_typedtree : int -> string
    val attribute_not_found_in_typedtree : string -> string
    val method_not_found_in_typedtree : string -> string
    val misplaced_comment : string -> int -> string
    val cross_module_not_found : string -> string
    val cross_module_type_not_found : string -> string
    val cross_module_or_module_type_not_found : string -> string
    val cross_class_not_found : string -> string
    val cross_class_type_not_found : string -> string
    val cross_class_or_class_type_not_found : string -> string
    val cross_extension_not_found : string -> string
    val cross_exception_not_found : string -> string
    val cross_element_not_found : string -> string
    val cross_method_not_found : string -> string
    val cross_attribute_not_found : string -> string
    val cross_section_not_found : string -> string
    val cross_value_not_found : string -> string
    val cross_type_not_found : string -> string
    val cross_recfield_not_found : string -> string
    val cross_const_not_found : string -> string
    val code_could_be_cross_reference : string -> string -> string
    val object_end : string
    val struct_end : string
    val sig_end : string
    val current_generator_is_not : string -> string
    val analysing : string -> string
    val merging : string
    val cross_referencing : string
    val generating_doc : string
    val loading : string -> string
    val file_generated : string -> string
    val file_exists_dont_generate : string -> string
    val modul : string
    val modules : string
    val functors : string
    val values : string
    val types : string
    val extensions : string
    val exceptions : string
    val record : string
    val variant : string
    val mutab : string
    val functions : string
    val parameters : string
    val abstract : string
    val functo : string
    val clas : string
    val classes : string
    val attributes : string
    val methods : string
    val authors : string
    val version : string
    val since : string
    val before : string
    val deprecated : string
    val alert : string
    val raises : string
    val returns : string
    val inherits : string
    val inheritance : string
    val privat : string
    val module_type : string
    val class_type : string
    val description : string
    val interface : string
    val type_parameters : string
    val class_types : string
    val module_types : string
    val see_also : string
    val documentation : string
    val index_of : string
    val top : string
    val index_of_values : string
    val index_of_extensions : string
    val index_of_exceptions : string
    val index_of_types : string
    val index_of_attributes : string
    val index_of_methods : string
    val index_of_classes : string
    val index_of_class_types : string
    val index_of_modules : string
    val index_of_module_types : string
    val previous : string
    val next : string
    val up : string
    \ No newline at end of file diff --git a/dev/ocaml/Odoc_sig/index.html b/dev/ocaml/Odoc_sig/index.html index dd0dc654..8c41c2f1 100644 --- a/dev/ocaml/Odoc_sig/index.html +++ b/dev/ocaml/Odoc_sig/index.html @@ -1,2 +1,5 @@ -Odoc_sig (ocaml.Odoc_sig)

    Module Odoc_sig

    module type Info_retriever = sig ... end
    module Analyser (_ : Info_retriever) : sig ... end
    \ No newline at end of file +Odoc_sig (ocaml.Odoc_sig)

    Module Odoc_sig

    module type Info_retriever = sig ... end
    val analyze_alerts : + Odoc_types.info option -> + Parsetree.attributes -> + Odoc_types.info option
    module Analyser (_ : Info_retriever) : sig ... end
    \ No newline at end of file diff --git a/dev/ocaml/Odoc_texi/Generator/class-texi/index.html b/dev/ocaml/Odoc_texi/Generator/class-texi/index.html index 972a0b20..bfb4a865 100644 --- a/dev/ocaml/Odoc_texi/Generator/class-texi/index.html +++ b/dev/ocaml/Odoc_texi/Generator/class-texi/index.html @@ -60,7 +60,7 @@ Odoc_info.Extension.t_type_extension -> string
    method texi_of_value : Odoc_info.Value.t_value -> string
    method text_el_of_type_expr : Odoc_info.Name.t -> Types.type_expr -> - Odoc_info.text_element
    method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_texi/module-type-Texi_generator/class-texi/index.html b/dev/ocaml/Odoc_texi/module-type-Texi_generator/class-texi/index.html index 211dbd1b..d9052332 100644 --- a/dev/ocaml/Odoc_texi/module-type-Texi_generator/class-texi/index.html +++ b/dev/ocaml/Odoc_texi/module-type-Texi_generator/class-texi/index.html @@ -60,7 +60,7 @@ Odoc_info.Extension.t_type_extension -> string
    method texi_of_value : Odoc_info.Value.t_value -> string
    method text_el_of_type_expr : Odoc_info.Name.t -> Types.type_expr -> - Odoc_info.text_element
    method text_of_attribute : Odoc_info.Value.t_attribute -> + Odoc_info.text_element
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_to_text/class-info/index.html b/dev/ocaml/Odoc_to_text/class-info/index.html index a0d0b825..5385fa0f 100644 --- a/dev/ocaml/Odoc_to_text/class-info/index.html +++ b/dev/ocaml/Odoc_to_text/class-info/index.html @@ -1,5 +1,5 @@ -info (ocaml.Odoc_to_text.info)

    Class Odoc_to_text.info

    val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> +info (ocaml.Odoc_to_text.info)

    Class Odoc_to_text.info

    val mutable tag_functions : (string * (Odoc_info.text -> Odoc_info.text)) list
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_custom : (string * Odoc_info.text) list -> Odoc_info.text
    method text_of_info : ?block:bool -> Odoc_info.info option -> Odoc_info.text_element list
    method text_of_raised_exceptions : Odoc_info.raised_exception list -> diff --git a/dev/ocaml/Odoc_to_text/class-to_text/index.html b/dev/ocaml/Odoc_to_text/class-to_text/index.html index 30759a53..9ca6cfb1 100644 --- a/dev/ocaml/Odoc_to_text/class-to_text/index.html +++ b/dev/ocaml/Odoc_to_text/class-to_text/index.html @@ -13,7 +13,7 @@ Odoc_info.Name.t -> string -> Types.type_expr list -> - string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method text_of_attribute : Odoc_info.Value.t_attribute -> + string
    method relative_idents : Odoc_info.Name.t -> string -> string
    method relative_module_idents : Odoc_info.Name.t -> string -> string
    method text_of_alerts : Odoc_info.alert list -> Odoc_info.text_element list
    method text_of_attribute : Odoc_info.Value.t_attribute -> Odoc_info.text_element list
    method text_of_author_list : string list -> Odoc_info.text_element list
    method text_of_before : (string * Odoc_info.text) list -> Odoc_info.text_element list
    method text_of_class_kind : Odoc_info.Name.t -> Odoc_info.Class.class_kind -> diff --git a/dev/ocaml/Odoc_types/index.html b/dev/ocaml/Odoc_types/index.html index 05298794..8f06d60e 100644 --- a/dev/ocaml/Odoc_types/index.html +++ b/dev/ocaml/Odoc_types/index.html @@ -1,2 +1,2 @@ -Odoc_types (ocaml.Odoc_types)

    Module Odoc_types

    type ref_kind =
    1. | RK_module
    2. | RK_module_type
    3. | RK_class
    4. | RK_class_type
    5. | RK_value
    6. | RK_type
    7. | RK_extension
    8. | RK_exception
    9. | RK_attribute
    10. | RK_method
    11. | RK_section of text
    12. | RK_recfield
    13. | RK_const
    and text_element =
    1. | Raw of string
    2. | Code of string
    3. | CodePre of string
    4. | Verbatim of string
    5. | Bold of text
    6. | Italic of text
    7. | Emphasize of text
    8. | Center of text
    9. | Left of text
    10. | Right of text
    11. | List of text list
    12. | Enum of text list
    13. | Newline
    14. | Block of text
    15. | Title of int * string option * text
    16. | Latex of string
    17. | Ref of string * ref_kind option * text option
    18. | Superscript of text
    19. | Subscript of text
    20. | Module_list of string list
    21. | Index_list
    22. | Custom of string * text
    23. | Target of string * string
    and text = text_element list
    type see_ref =
    1. | See_url of string
    2. | See_file of string
    3. | See_doc of string
    type see = see_ref * text
    type param = string * text
    type raised_exception = string * text
    type info = {
    1. i_desc : text option;
    2. i_authors : string list;
    3. i_version : string option;
    4. i_sees : see list;
    5. i_since : string option;
    6. i_before : (string * text) list;
    7. i_deprecated : text option;
    8. i_params : param list;
    9. i_raised_exceptions : raised_exception list;
    10. i_return_value : text option;
    11. i_custom : (string * text) list;
    }
    val dummy_info : info
    type location = {
    1. loc_impl : Location.t option;
    2. loc_inter : Location.t option;
    }
    val dummy_loc : location
    type merge_option =
    1. | Merge_description
    2. | Merge_author
    3. | Merge_version
    4. | Merge_see
    5. | Merge_since
    6. | Merge_before
    7. | Merge_deprecated
    8. | Merge_param
    9. | Merge_raised_exception
    10. | Merge_return_value
    11. | Merge_custom
    val all_merge_options : merge_option list
    type magic
    val magic : magic
    type 'a dump
    val make_dump : 'a -> 'a dump
    val open_dump : 'a dump -> 'a
    \ No newline at end of file +Odoc_types (ocaml.Odoc_types)

    Module Odoc_types

    type ref_kind =
    1. | RK_module
    2. | RK_module_type
    3. | RK_class
    4. | RK_class_type
    5. | RK_value
    6. | RK_type
    7. | RK_extension
    8. | RK_exception
    9. | RK_attribute
    10. | RK_method
    11. | RK_section of text
    12. | RK_recfield
    13. | RK_const
    and text_element =
    1. | Raw of string
    2. | Code of string
    3. | CodePre of string
    4. | Verbatim of string
    5. | Bold of text
    6. | Italic of text
    7. | Emphasize of text
    8. | Center of text
    9. | Left of text
    10. | Right of text
    11. | List of text list
    12. | Enum of text list
    13. | Newline
    14. | Block of text
    15. | Title of int * string option * text
    16. | Latex of string
    17. | Ref of string * ref_kind option * text option
    18. | Superscript of text
    19. | Subscript of text
    20. | Module_list of string list
    21. | Index_list
    22. | Custom of string * text
    23. | Target of string * string
    and text = text_element list
    type see_ref =
    1. | See_url of string
    2. | See_file of string
    3. | See_doc of string
    type see = see_ref * text
    type param = string * text
    type raised_exception = string * text
    type alert = {
    1. alert_name : string;
    2. alert_payload : string option;
    }
    type info = {
    1. i_desc : text option;
    2. i_authors : string list;
    3. i_version : string option;
    4. i_sees : see list;
    5. i_since : string option;
    6. i_before : (string * text) list;
    7. i_deprecated : text option;
    8. i_params : param list;
    9. i_raised_exceptions : raised_exception list;
    10. i_return_value : text option;
    11. i_custom : (string * text) list;
    12. i_alerts : alert list;
    }
    val dummy_info : info
    type location = {
    1. loc_impl : Location.t option;
    2. loc_inter : Location.t option;
    }
    val dummy_loc : location
    type merge_option =
    1. | Merge_description
    2. | Merge_author
    3. | Merge_version
    4. | Merge_see
    5. | Merge_since
    6. | Merge_before
    7. | Merge_deprecated
    8. | Merge_param
    9. | Merge_raised_exception
    10. | Merge_return_value
    11. | Merge_custom
    val all_merge_options : merge_option list
    type magic
    val magic : magic
    type 'a dump
    val make_dump : 'a -> 'a dump
    val open_dump : 'a dump -> 'a
    \ No newline at end of file diff --git a/dev/ocaml/Opcodes/index.html b/dev/ocaml/Opcodes/index.html index 66cab873..2695da62 100644 --- a/dev/ocaml/Opcodes/index.html +++ b/dev/ocaml/Opcodes/index.html @@ -1,2 +1,2 @@ -Opcodes (ocaml.Opcodes)

    Module Opcodes

    val opACC0 : int
    val opACC1 : int
    val opACC2 : int
    val opACC3 : int
    val opACC4 : int
    val opACC5 : int
    val opACC6 : int
    val opACC7 : int
    val opACC : int
    val opPUSH : int
    val opPUSHACC0 : int
    val opPUSHACC1 : int
    val opPUSHACC2 : int
    val opPUSHACC3 : int
    val opPUSHACC4 : int
    val opPUSHACC5 : int
    val opPUSHACC6 : int
    val opPUSHACC7 : int
    val opPUSHACC : int
    val opPOP : int
    val opASSIGN : int
    val opENVACC1 : int
    val opENVACC2 : int
    val opENVACC3 : int
    val opENVACC4 : int
    val opENVACC : int
    val opPUSHENVACC1 : int
    val opPUSHENVACC2 : int
    val opPUSHENVACC3 : int
    val opPUSHENVACC4 : int
    val opPUSHENVACC : int
    val opPUSH_RETADDR : int
    val opAPPLY : int
    val opAPPLY1 : int
    val opAPPLY2 : int
    val opAPPLY3 : int
    val opAPPTERM : int
    val opAPPTERM1 : int
    val opAPPTERM2 : int
    val opAPPTERM3 : int
    val opRETURN : int
    val opRESTART : int
    val opGRAB : int
    val opCLOSURE : int
    val opCLOSUREREC : int
    val opOFFSETCLOSUREM3 : int
    val opOFFSETCLOSURE0 : int
    val opOFFSETCLOSURE3 : int
    val opOFFSETCLOSURE : int
    val opPUSHOFFSETCLOSUREM3 : int
    val opPUSHOFFSETCLOSURE0 : int
    val opPUSHOFFSETCLOSURE3 : int
    val opPUSHOFFSETCLOSURE : int
    val opGETGLOBAL : int
    val opPUSHGETGLOBAL : int
    val opGETGLOBALFIELD : int
    val opPUSHGETGLOBALFIELD : int
    val opSETGLOBAL : int
    val opATOM0 : int
    val opATOM : int
    val opPUSHATOM0 : int
    val opPUSHATOM : int
    val opMAKEBLOCK : int
    val opMAKEBLOCK1 : int
    val opMAKEBLOCK2 : int
    val opMAKEBLOCK3 : int
    val opMAKEFLOATBLOCK : int
    val opGETFIELD0 : int
    val opGETFIELD1 : int
    val opGETFIELD2 : int
    val opGETFIELD3 : int
    val opGETFIELD : int
    val opGETFLOATFIELD : int
    val opSETFIELD0 : int
    val opSETFIELD1 : int
    val opSETFIELD2 : int
    val opSETFIELD3 : int
    val opSETFIELD : int
    val opSETFLOATFIELD : int
    val opVECTLENGTH : int
    val opGETVECTITEM : int
    val opSETVECTITEM : int
    val opGETBYTESCHAR : int
    val opSETBYTESCHAR : int
    val opBRANCH : int
    val opBRANCHIF : int
    val opBRANCHIFNOT : int
    val opSWITCH : int
    val opBOOLNOT : int
    val opPUSHTRAP : int
    val opPOPTRAP : int
    val opRAISE : int
    val opCHECK_SIGNALS : int
    val opC_CALL1 : int
    val opC_CALL2 : int
    val opC_CALL3 : int
    val opC_CALL4 : int
    val opC_CALL5 : int
    val opC_CALLN : int
    val opCONST0 : int
    val opCONST1 : int
    val opCONST2 : int
    val opCONST3 : int
    val opCONSTINT : int
    val opPUSHCONST0 : int
    val opPUSHCONST1 : int
    val opPUSHCONST2 : int
    val opPUSHCONST3 : int
    val opPUSHCONSTINT : int
    val opNEGINT : int
    val opADDINT : int
    val opSUBINT : int
    val opMULINT : int
    val opDIVINT : int
    val opMODINT : int
    val opANDINT : int
    val opORINT : int
    val opXORINT : int
    val opLSLINT : int
    val opLSRINT : int
    val opASRINT : int
    val opEQ : int
    val opNEQ : int
    val opLTINT : int
    val opLEINT : int
    val opGTINT : int
    val opGEINT : int
    val opOFFSETINT : int
    val opOFFSETREF : int
    val opISINT : int
    val opGETMETHOD : int
    val opBEQ : int
    val opBNEQ : int
    val opBLTINT : int
    val opBLEINT : int
    val opBGTINT : int
    val opBGEINT : int
    val opULTINT : int
    val opUGEINT : int
    val opBULTINT : int
    val opBUGEINT : int
    val opGETPUBMET : int
    val opGETDYNMET : int
    val opSTOP : int
    val opEVENT : int
    val opBREAK : int
    val opRERAISE : int
    val opRAISE_NOTRACE : int
    val opGETSTRINGCHAR : int
    \ No newline at end of file +Opcodes (ocaml.Opcodes)

    Module Opcodes

    val opACC0 : int
    val opACC1 : int
    val opACC2 : int
    val opACC3 : int
    val opACC4 : int
    val opACC5 : int
    val opACC6 : int
    val opACC7 : int
    val opACC : int
    val opPUSH : int
    val opPUSHACC0 : int
    val opPUSHACC1 : int
    val opPUSHACC2 : int
    val opPUSHACC3 : int
    val opPUSHACC4 : int
    val opPUSHACC5 : int
    val opPUSHACC6 : int
    val opPUSHACC7 : int
    val opPUSHACC : int
    val opPOP : int
    val opASSIGN : int
    val opENVACC1 : int
    val opENVACC2 : int
    val opENVACC3 : int
    val opENVACC4 : int
    val opENVACC : int
    val opPUSHENVACC1 : int
    val opPUSHENVACC2 : int
    val opPUSHENVACC3 : int
    val opPUSHENVACC4 : int
    val opPUSHENVACC : int
    val opPUSH_RETADDR : int
    val opAPPLY : int
    val opAPPLY1 : int
    val opAPPLY2 : int
    val opAPPLY3 : int
    val opAPPTERM : int
    val opAPPTERM1 : int
    val opAPPTERM2 : int
    val opAPPTERM3 : int
    val opRETURN : int
    val opRESTART : int
    val opGRAB : int
    val opCLOSURE : int
    val opCLOSUREREC : int
    val opOFFSETCLOSUREM3 : int
    val opOFFSETCLOSURE0 : int
    val opOFFSETCLOSURE3 : int
    val opOFFSETCLOSURE : int
    val opPUSHOFFSETCLOSUREM3 : int
    val opPUSHOFFSETCLOSURE0 : int
    val opPUSHOFFSETCLOSURE3 : int
    val opPUSHOFFSETCLOSURE : int
    val opGETGLOBAL : int
    val opPUSHGETGLOBAL : int
    val opGETGLOBALFIELD : int
    val opPUSHGETGLOBALFIELD : int
    val opSETGLOBAL : int
    val opATOM0 : int
    val opATOM : int
    val opPUSHATOM0 : int
    val opPUSHATOM : int
    val opMAKEBLOCK : int
    val opMAKEBLOCK1 : int
    val opMAKEBLOCK2 : int
    val opMAKEBLOCK3 : int
    val opMAKEFLOATBLOCK : int
    val opGETFIELD0 : int
    val opGETFIELD1 : int
    val opGETFIELD2 : int
    val opGETFIELD3 : int
    val opGETFIELD : int
    val opGETFLOATFIELD : int
    val opSETFIELD0 : int
    val opSETFIELD1 : int
    val opSETFIELD2 : int
    val opSETFIELD3 : int
    val opSETFIELD : int
    val opSETFLOATFIELD : int
    val opVECTLENGTH : int
    val opGETVECTITEM : int
    val opSETVECTITEM : int
    val opGETBYTESCHAR : int
    val opSETBYTESCHAR : int
    val opBRANCH : int
    val opBRANCHIF : int
    val opBRANCHIFNOT : int
    val opSWITCH : int
    val opBOOLNOT : int
    val opPUSHTRAP : int
    val opPOPTRAP : int
    val opRAISE : int
    val opCHECK_SIGNALS : int
    val opC_CALL1 : int
    val opC_CALL2 : int
    val opC_CALL3 : int
    val opC_CALL4 : int
    val opC_CALL5 : int
    val opC_CALLN : int
    val opCONST0 : int
    val opCONST1 : int
    val opCONST2 : int
    val opCONST3 : int
    val opCONSTINT : int
    val opPUSHCONST0 : int
    val opPUSHCONST1 : int
    val opPUSHCONST2 : int
    val opPUSHCONST3 : int
    val opPUSHCONSTINT : int
    val opNEGINT : int
    val opADDINT : int
    val opSUBINT : int
    val opMULINT : int
    val opDIVINT : int
    val opMODINT : int
    val opANDINT : int
    val opORINT : int
    val opXORINT : int
    val opLSLINT : int
    val opLSRINT : int
    val opASRINT : int
    val opEQ : int
    val opNEQ : int
    val opLTINT : int
    val opLEINT : int
    val opGTINT : int
    val opGEINT : int
    val opOFFSETINT : int
    val opOFFSETREF : int
    val opISINT : int
    val opGETMETHOD : int
    val opBEQ : int
    val opBNEQ : int
    val opBLTINT : int
    val opBLEINT : int
    val opBGTINT : int
    val opBGEINT : int
    val opULTINT : int
    val opUGEINT : int
    val opBULTINT : int
    val opBUGEINT : int
    val opGETPUBMET : int
    val opGETDYNMET : int
    val opSTOP : int
    val opEVENT : int
    val opBREAK : int
    val opRERAISE : int
    val opRAISE_NOTRACE : int
    val opGETSTRINGCHAR : int
    val opPERFORM : int
    val opRESUME : int
    val opRESUMETERM : int
    val opREPERFORMTERM : int
    \ No newline at end of file diff --git a/dev/ocaml/Parameter/Map/index.html b/dev/ocaml/Parameter/Map/index.html index 4b084e7a..21c7c493 100644 --- a/dev/ocaml/Parameter/Map/index.html +++ b/dev/ocaml/Parameter/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Parameter/Set/index.html b/dev/ocaml/Parameter/Set/index.html index 44e3bd77..8be0c465 100644 --- a/dev/ocaml/Parameter/Set/index.html +++ b/dev/ocaml/Parameter/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Parameter.Set)

    Module Parameter.Set

    include Identifiable.Set with module T := T
    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    val vars : parameter list -> Variable.Set.t
    \ No newline at end of file +Set (ocaml.Parameter.Set)

    Module Parameter.Set

    include Identifiable.Set with module T := T
    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    val vars : parameter list -> Variable.Set.t
    \ No newline at end of file diff --git a/dev/ocaml/Path/Map/index.html b/dev/ocaml/Path/Map/index.html index 3c5e9399..ff808d6b 100644 --- a/dev/ocaml/Path/Map/index.html +++ b/dev/ocaml/Path/Map/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Path/Set/index.html b/dev/ocaml/Path/Set/index.html index 54b34c9a..accf604a 100644 --- a/dev/ocaml/Path/Set/index.html +++ b/dev/ocaml/Path/Set/index.html @@ -1,3 +1,3 @@ Set (ocaml.Path.Set)

    Module Path.Set

    type elt = t

    The type of the set elements.

    type t

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : (elt -> elt) -> t -> t

    map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Persistent_env/index.html b/dev/ocaml/Persistent_env/index.html index 66607a1a..ba488b54 100644 --- a/dev/ocaml/Persistent_env/index.html +++ b/dev/ocaml/Persistent_env/index.html @@ -1,6 +1,6 @@ Persistent_env (ocaml.Persistent_env)

    Module Persistent_env

    module Consistbl : - module type of struct include Consistbl.Make(Misc.Stdlib.String) end
    type error =
    1. | Illegal_renaming of Misc.modname * Misc.modname * Misc.filepath
    2. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
    3. | Need_recursive_types of Misc.modname
    4. | Depend_on_unsafe_string_unit of Misc.modname
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    module Persistent_signature : sig ... end
    type can_load_cmis =
    1. | Can_load_cmis
    2. | Cannot_load_cmis of Lazy_backtrack.log
    type 'a t
    val empty : unit -> 'a t
    val clear : 'a t -> unit
    val clear_missing : 'a t -> unit
    val fold : 'a t -> (Misc.modname -> 'a -> 'b -> 'b) -> 'b -> 'b
    val read : + module type of struct include Consistbl.Make(Misc.Stdlib.String) end
    type error =
    1. | Illegal_renaming of Misc.modname * Misc.modname * Misc.filepath
    2. | Inconsistent_import of Misc.modname * Misc.filepath * Misc.filepath
    3. | Need_recursive_types of Misc.modname
    exception Error of error
    val report_error : Stdlib.Format.formatter -> error -> unit
    module Persistent_signature : sig ... end
    type can_load_cmis =
    1. | Can_load_cmis
    2. | Cannot_load_cmis of Lazy_backtrack.log
    type 'a t
    val empty : unit -> 'a t
    val clear : 'a t -> unit
    val clear_missing : 'a t -> unit
    val fold : 'a t -> (Misc.modname -> 'a -> 'b -> 'b) -> 'b -> 'b
    val read : 'a t -> (Persistent_signature.t -> 'a) -> Misc.modname -> diff --git a/dev/ocaml/Predef/index.html b/dev/ocaml/Predef/index.html index b2f1bf3a..e7879145 100644 --- a/dev/ocaml/Predef/index.html +++ b/dev/ocaml/Predef/index.html @@ -3,4 +3,4 @@ (Ident.t -> Types.type_declaration -> 'a -> 'a) -> (Ident.t -> Types.extension_constructor -> 'a -> 'a) -> 'a -> - 'a * 'a
    val builtin_values : (string * Ident.t) list
    val builtin_idents : (string * Ident.t) list
    val ident_division_by_zero : Ident.t

    All predefined exceptions, exposed as Ident.t for flambda (for building value approximations). The Ident.t for division by zero is also exported explicitly so flambda can generate code to raise it.

    val all_predef_exns : Ident.t list
    \ No newline at end of file + 'a
    val builtin_values : (string * Ident.t) list
    val builtin_idents : (string * Ident.t) list
    val ident_division_by_zero : Ident.t

    All predefined exceptions, exposed as Ident.t for flambda (for building value approximations). The Ident.t for division by zero is also exported explicitly so flambda can generate code to raise it.

    val all_predef_exns : Ident.t list
    \ No newline at end of file diff --git a/dev/ocaml/Projection/Map/index.html b/dev/ocaml/Projection/Map/index.html index 54d15d8f..8bcd5135 100644 --- a/dev/ocaml/Projection/Map/index.html +++ b/dev/ocaml/Projection/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Projection/Set/index.html b/dev/ocaml/Projection/Set/index.html index 2f5b11c7..dbf70590 100644 --- a/dev/ocaml/Projection/Set/index.html +++ b/dev/ocaml/Projection/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Projection.Set)

    Module Projection.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Projection.Set)

    Module Projection.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Reg/Map/index.html b/dev/ocaml/Reg/Map/index.html index 168fc8a7..0921e3d2 100644 --- a/dev/ocaml/Reg/Map/index.html +++ b/dev/ocaml/Reg/Map/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Reg/Set/index.html b/dev/ocaml/Reg/Set/index.html index 85dd5852..ca351878 100644 --- a/dev/ocaml/Reg/Set/index.html +++ b/dev/ocaml/Reg/Set/index.html @@ -1,3 +1,3 @@ Set (ocaml.Reg.Set)

    Module Reg.Set

    type elt = t

    The type of the set elements.

    type t

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : (elt -> elt) -> t -> t

    map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Reloadgen/class-reload_generic/index.html b/dev/ocaml/Reloadgen/class-reload_generic/index.html index 54421269..17f21b57 100644 --- a/dev/ocaml/Reloadgen/class-reload_generic/index.html +++ b/dev/ocaml/Reloadgen/class-reload_generic/index.html @@ -2,4 +2,4 @@ reload_generic (ocaml.Reloadgen.reload_generic)

    Class Reloadgen.reload_generic

    method reload_operation : Mach.operation -> Reg.t array -> Reg.t array -> - Reg.t array * Reg.t array
    method reload_test : Mach.test -> Reg.t array -> Reg.t array
    method makereg : Reg.t -> Reg.t
    method makeregs : Reg.t array -> Reg.t array
    method fundecl : Mach.fundecl -> int array -> Mach.fundecl * bool
    \ No newline at end of file + Reg.t array * Reg.t array
    method reload_test : Mach.test -> Reg.t array -> Reg.t array
    method makereg : Reg.t -> Reg.t
    method fundecl : Mach.fundecl -> int array -> Mach.fundecl * bool
    \ No newline at end of file diff --git a/dev/ocaml/Runtime_events/Callbacks/index.html b/dev/ocaml/Runtime_events/Callbacks/index.html new file mode 100644 index 00000000..2230542d --- /dev/null +++ b/dev/ocaml/Runtime_events/Callbacks/index.html @@ -0,0 +1,10 @@ + +Callbacks (ocaml.Runtime_events.Callbacks)

    Module Runtime_events.Callbacks

    type t

    Type of callbacks

    val create : + ?runtime_begin:(int -> Timestamp.t -> runtime_phase -> unit) -> + ?runtime_end:(int -> Timestamp.t -> runtime_phase -> unit) -> + ?runtime_counter:(int -> Timestamp.t -> runtime_counter -> int -> unit) -> + ?alloc:(int -> Timestamp.t -> int array -> unit) -> + ?lifecycle:(int -> Timestamp.t -> lifecycle -> int option -> unit) -> + ?lost_events:(int -> int -> unit) -> + unit -> + t

    Create a Callback that optionally subscribes to one or more runtime events. The first int supplied to callbacks is the ring buffer index. Each domain owns a single ring buffer for the duration of the domain's existence. After a domain terminates, a newly spawned domain may take ownership of the ring buffer. A runtime_begin callback is called when the runtime enters a new phase (e.g a runtime_begin with EV_MINOR is called at the start of a minor GC). A runtime_end callback is called when the runtime leaves a certain phase. The runtime_counter callback is called when a counter is emitted by the runtime. lifecycle callbacks are called when the ring undergoes a change in lifecycle and a consumer may need to respond. alloc callbacks are currently only called on the instrumented runtime. lost_events callbacks are called if the consumer code detects some unconsumed events have been overwritten.

    \ No newline at end of file diff --git a/dev/ocaml/Runtime_events/Timestamp/index.html b/dev/ocaml/Runtime_events/Timestamp/index.html new file mode 100644 index 00000000..a0b1dcd4 --- /dev/null +++ b/dev/ocaml/Runtime_events/Timestamp/index.html @@ -0,0 +1,2 @@ + +Timestamp (ocaml.Runtime_events.Timestamp)

    Module Runtime_events.Timestamp

    type t

    Type for the int64 timestamp to allow for future changes

    val to_int64 : t -> int64
    \ No newline at end of file diff --git a/dev/ocaml/Runtime_events/index.html b/dev/ocaml/Runtime_events/index.html new file mode 100644 index 00000000..f5c53d48 --- /dev/null +++ b/dev/ocaml/Runtime_events/index.html @@ -0,0 +1,2 @@ + +Runtime_events (ocaml.Runtime_events)

    Module Runtime_events

    Runtime events - ring buffer-based runtime tracing

    This module enables users to enable and subscribe to tracing events from the Garbage Collector and other parts of the OCaml runtime. This can be useful for diagnostic or performance monitoring purposes. This module can be used to subscribe to events for the current process or external processes asynchronously.

    When enabled (either via setting the OCAML_RUNTIME_EVENTS_START environment variable or calling Runtime_events.start) a file with the pid of the process and extension .events will be created. By default this is in the current directory but can be over-ridden by the OCAML_RUNTIME_EVENTS_DIR environment variable. Each domain maintains its own ring buffer in a section of the larger file into which it emits events.

    There is additionally a set of C APIs in runtime_events.h that can enable zero-impact monitoring of the current process or bindings for other languages.

    The runtime events system's behaviour can be controlled by the following environment variables:

    type runtime_counter =
    1. | EV_C_FORCE_MINOR_ALLOC_SMALL
    2. | EV_C_FORCE_MINOR_MAKE_VECT
    3. | EV_C_FORCE_MINOR_SET_MINOR_HEAP_SIZE
    4. | EV_C_FORCE_MINOR_MEMPROF
    5. | EV_C_MINOR_PROMOTED
    6. | EV_C_MINOR_ALLOCATED
    7. | EV_C_REQUEST_MAJOR_ALLOC_SHR
    8. | EV_C_REQUEST_MAJOR_ADJUST_GC_SPEED
    9. | EV_C_REQUEST_MINOR_REALLOC_REF_TABLE
    10. | EV_C_REQUEST_MINOR_REALLOC_EPHE_REF_TABLE
    11. | EV_C_REQUEST_MINOR_REALLOC_CUSTOM_TABLE

    The type for counter events emitted by the runtime

    type runtime_phase =
    1. | EV_EXPLICIT_GC_SET
    2. | EV_EXPLICIT_GC_STAT
    3. | EV_EXPLICIT_GC_MINOR
    4. | EV_EXPLICIT_GC_MAJOR
    5. | EV_EXPLICIT_GC_FULL_MAJOR
    6. | EV_EXPLICIT_GC_COMPACT
    7. | EV_MAJOR
    8. | EV_MAJOR_SWEEP
    9. | EV_MAJOR_MARK_ROOTS
    10. | EV_MAJOR_MARK
    11. | EV_MINOR
    12. | EV_MINOR_LOCAL_ROOTS
    13. | EV_MINOR_FINALIZED
    14. | EV_EXPLICIT_GC_MAJOR_SLICE
    15. | EV_FINALISE_UPDATE_FIRST
    16. | EV_FINALISE_UPDATE_LAST
    17. | EV_INTERRUPT_REMOTE
    18. | EV_MAJOR_EPHE_MARK
    19. | EV_MAJOR_EPHE_SWEEP
    20. | EV_MAJOR_FINISH_MARKING
    21. | EV_MAJOR_GC_CYCLE_DOMAINS
    22. | EV_MAJOR_GC_PHASE_CHANGE
    23. | EV_MAJOR_GC_STW
    24. | EV_MAJOR_MARK_OPPORTUNISTIC
    25. | EV_MAJOR_SLICE
    26. | EV_MAJOR_FINISH_CYCLE
    27. | EV_MINOR_CLEAR
    28. | EV_MINOR_FINALIZERS_OLDIFY
    29. | EV_MINOR_GLOBAL_ROOTS
    30. | EV_MINOR_LEAVE_BARRIER
    31. | EV_STW_API_BARRIER
    32. | EV_STW_HANDLER
    33. | EV_STW_LEADER
    34. | EV_MAJOR_FINISH_SWEEPING
    35. | EV_MINOR_FINALIZERS_ADMIN
    36. | EV_MINOR_REMEMBERED_SET
    37. | EV_MINOR_REMEMBERED_SET_PROMOTE
    38. | EV_MINOR_LOCAL_ROOTS_PROMOTE
    39. | EV_DOMAIN_CONDITION_WAIT
    40. | EV_DOMAIN_RESIZE_HEAP_RESERVATION

    The type for span events emitted by the runtime

    type lifecycle =
    1. | EV_RING_START
    2. | EV_RING_STOP
    3. | EV_RING_PAUSE
    4. | EV_RING_RESUME
    5. | EV_FORK_PARENT
    6. | EV_FORK_CHILD
    7. | EV_DOMAIN_SPAWN
    8. | EV_DOMAIN_TERMINATE

    Lifecycle events for the ring itself

    val lifecycle_name : lifecycle -> string

    Return a string representation of a given lifecycle event type

    val runtime_phase_name : runtime_phase -> string

    Return a string representation of a given runtime phase event type

    val runtime_counter_name : runtime_counter -> string

    Return a string representation of a given runtime counter type

    type cursor

    Type of the cursor used when consuming

    module Timestamp : sig ... end
    module Callbacks : sig ... end
    val start : unit -> unit

    start () will start the collection of events in the runtime if not already started.

    Events can be consumed by creating a cursor with create_cursor and providing a set of callbacks to be called for each type of event.

    val pause : unit -> unit

    pause () will pause the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

    val resume : unit -> unit

    resume () will resume the collection of events in the runtime. Traces are collected if the program has called Runtime_events.start () or the OCAML_RUNTIME_EVENTS_START environment variable has been set.

    val create_cursor : (string * int) option -> cursor

    create_cursor path_pid creates a cursor to read from an runtime_events. Cursors can be created for runtime_events in and out of process. A runtime_events ring-buffer may have multiple cursors reading from it at any point in time and a program may have multiple cursors open concurrently (for example if multiple consumers want different sets of events). If path_pid is None then a cursor is created for the current process. Otherwise the pair contains a string path to the directory that contains the pid.events file and int pid for the runtime_events of an external process to monitor.

    val free_cursor : cursor -> unit

    Free a previously created runtime_events cursor

    val read_poll : cursor -> Callbacks.t -> int option -> int

    read_poll cursor callbacks max_option calls the corresponding functions on callbacks for up to max_option events read off cursor's runtime_events and returns the number of events read.

    \ No newline at end of file diff --git a/dev/ocaml/Semaphore/Binary/index.html b/dev/ocaml/Semaphore/Binary/index.html deleted file mode 100644 index be8e486e..00000000 --- a/dev/ocaml/Semaphore/Binary/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Binary (ocaml.Semaphore.Binary)

    Module Semaphore.Binary

    type t

    The type of binary semaphores.

    val make : bool -> t

    make b returns a new binary semaphore. If b is true, the initial value of the semaphore is 1, meaning "available". If b is false, the initial value of the semaphore is 0, meaning "unavailable".

    val release : t -> unit

    release s sets the value of semaphore s to 1, putting it in the "available" state. If other threads are waiting on s, one of them is restarted.

    val acquire : t -> unit

    acquire s blocks the calling thread until the semaphore s has value 1 (is available), then atomically sets it to 0 and returns.

    val try_acquire : t -> bool

    try_acquire s immediately returns false if the semaphore s has value 0. If s has value 1, its value is atomically set to 0 and try_acquire s returns true.

    \ No newline at end of file diff --git a/dev/ocaml/Semaphore/Counting/index.html b/dev/ocaml/Semaphore/Counting/index.html deleted file mode 100644 index 937d8dd0..00000000 --- a/dev/ocaml/Semaphore/Counting/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Counting (ocaml.Semaphore.Counting)

    Module Semaphore.Counting

    type t

    The type of counting semaphores.

    val make : int -> t

    make n returns a new counting semaphore, with initial value n. The initial value n must be nonnegative.

    • raises Invalid_argument

      if n < 0

    val release : t -> unit

    release s increments the value of semaphore s. If other threads are waiting on s, one of them is restarted. If the current value of s is equal to max_int, the value of the semaphore is unchanged and a Sys_error exception is raised to signal overflow.

    • raises Sys_error

      if the value of the semaphore would overflow max_int

    val acquire : t -> unit

    acquire s blocks the calling thread until the value of semaphore s is not zero, then atomically decrements the value of s and returns.

    val try_acquire : t -> bool

    try_acquire s immediately returns false if the value of semaphore s is zero. Otherwise, the value of s is atomically decremented and try_acquire s returns true.

    val get_value : t -> int

    get_value s returns the current value of semaphore s. The current value can be modified at any time by concurrent release and acquire operations. Hence, the get_value operation is racy, and its result should only be used for debugging or informational messages.

    \ No newline at end of file diff --git a/dev/ocaml/Semaphore/index.html b/dev/ocaml/Semaphore/index.html deleted file mode 100644 index 734f0958..00000000 --- a/dev/ocaml/Semaphore/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Semaphore (ocaml.Semaphore)

    Module Semaphore

    Semaphores

    A semaphore is a thread synchronization device that can be used to control access to a shared resource.

    Two flavors of semaphores are provided: counting semaphores and binary semaphores.

    Counting semaphores

    A counting semaphore is a counter that can be accessed concurrently by several threads. The typical use is to synchronize producers and consumers of a resource by counting how many units of the resource are available.

    The two basic operations on semaphores are:

    module Counting : sig ... end

    Binary semaphores

    Binary semaphores are a variant of counting semaphores where semaphores can only take two values, 0 and 1.

    A binary semaphore can be used to control access to a single shared resource, with value 1 meaning "resource is available" and value 0 meaning "resource is unavailable".

    The "release" operation of a binary semaphore sets its value to 1, and "acquire" waits until the value is 1 and sets it to 0.

    A binary semaphore can be used instead of a mutex (see module Mutex) when the mutex discipline (of unlocking the mutex from the thread that locked it) is too restrictive. The "acquire" operation corresponds to locking the mutex, and the "release" operation to unlocking it, but "release" can be performed in a thread different than the one that performed the "acquire". Likewise, it is safe to release a binary semaphore that is already available.

    module Binary : sig ... end
    \ No newline at end of file diff --git a/dev/ocaml/Set_of_closures_id/Map/index.html b/dev/ocaml/Set_of_closures_id/Map/index.html index cc9040de..33d9af36 100644 --- a/dev/ocaml/Set_of_closures_id/Map/index.html +++ b/dev/ocaml/Set_of_closures_id/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Set_of_closures_id/Set/index.html b/dev/ocaml/Set_of_closures_id/Set/index.html index 90a6112b..8f7d963a 100644 --- a/dev/ocaml/Set_of_closures_id/Set/index.html +++ b/dev/ocaml/Set_of_closures_id/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Set_of_closures_id.Set)

    Module Set_of_closures_id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Set_of_closures_id.Set)

    Module Set_of_closures_id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Set_of_closures_origin/Map/index.html b/dev/ocaml/Set_of_closures_origin/Map/index.html index 64ac57b0..8f06dedd 100644 --- a/dev/ocaml/Set_of_closures_origin/Map/index.html +++ b/dev/ocaml/Set_of_closures_origin/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Set_of_closures_origin/Set/index.html b/dev/ocaml/Set_of_closures_origin/Set/index.html index a97ca1a0..d65b94f8 100644 --- a/dev/ocaml/Set_of_closures_origin/Set/index.html +++ b/dev/ocaml/Set_of_closures_origin/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Set_of_closures_origin.Set)

    Module Set_of_closures_origin.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Set_of_closures_origin.Set)

    Module Set_of_closures_origin.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Shape/Item/Map/index.html b/dev/ocaml/Shape/Item/Map/index.html index 44f3047f..2629442e 100644 --- a/dev/ocaml/Shape/Item/Map/index.html +++ b/dev/ocaml/Shape/Item/Map/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Shape/Uid/Map/index.html b/dev/ocaml/Shape/Uid/Map/index.html index 63d64f05..58e93013 100644 --- a/dev/ocaml/Shape/Uid/Map/index.html +++ b/dev/ocaml/Shape/Uid/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Shape/Uid/Set/index.html b/dev/ocaml/Shape/Uid/Set/index.html index 91e519da..5990250d 100644 --- a/dev/ocaml/Shape/Uid/Set/index.html +++ b/dev/ocaml/Shape/Uid/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Shape.Uid.Set)

    Module Uid.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Shape.Uid.Set)

    Module Uid.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Static_exception/Map/index.html b/dev/ocaml/Static_exception/Map/index.html index ec0b5db0..45ce02c1 100644 --- a/dev/ocaml/Static_exception/Map/index.html +++ b/dev/ocaml/Static_exception/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Static_exception/Set/index.html b/dev/ocaml/Static_exception/Set/index.html index 6bb43aa4..149e0af2 100644 --- a/dev/ocaml/Static_exception/Set/index.html +++ b/dev/ocaml/Static_exception/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Static_exception.Set)

    Module Static_exception.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Static_exception.Set)

    Module Static_exception.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Arg/index.html b/dev/ocaml/Stdlib/Arg/index.html index fbeb9a23..4709b012 100644 --- a/dev/ocaml/Stdlib/Arg/index.html +++ b/dev/ocaml/Stdlib/Arg/index.html @@ -13,7 +13,7 @@ let speclist = let () = Arg.parse speclist anon_fun usage_msg; - (* Main functionality here *)

    Syntax of command lines: A keyword is a character string starting with a -. An option is a keyword alone or followed by an argument. The types of keywords are: Unit, Bool, Set, Clear, String, Set_string, Int, Set_int, Float, Set_float, Tuple, Symbol, Rest, Rest_all and Expand.

    Unit, Set and Clear keywords take no argument.

    A Rest or Rest_all keyword takes the remainder of the command line as arguments. (More explanations below.)

    Every other keyword takes the following word on the command line as argument. For compatibility with GNU getopt_long, keyword=arg is also allowed. Arguments not preceded by a keyword are called anonymous arguments.

    Examples (cmd is assumed to be the command name):

    • cmd -flag (a unit option)
    • cmd -int 1 (an int option with argument 1)
    • cmd -string foobar (a string option with argument "foobar")
    • cmd -float 12.34 (a float option with argument 12.34)
    • cmd a b c (three anonymous arguments: "a", "b", and "c")
    • cmd a b -- c d (two anonymous arguments and a rest option with two arguments)

    Rest takes a function that is called repeatedly for each remaining command line argument. Rest_all takes a function that is called once, with the list of all remaining arguments.

    Note that if no arguments follow a Rest keyword then the function is not called at all whereas the function for a Rest_all keyword is called with an empty list.

    type spec =
    1. | Unit of unit -> unit
      (*

      Call the function with unit argument

      *)
    2. | Bool of bool -> unit
      (*

      Call the function with a bool argument

      *)
    3. | Set of bool ref
      (*

      Set the reference to true

      *)
    4. | Clear of bool ref
      (*

      Set the reference to false

      *)
    5. | String of string -> unit
      (*

      Call the function with a string argument

      *)
    6. | Set_string of string ref
      (*

      Set the reference to the string argument

      *)
    7. | Int of int -> unit
      (*

      Call the function with an int argument

      *)
    8. | Set_int of int ref
      (*

      Set the reference to the int argument

      *)
    9. | Float of float -> unit
      (*

      Call the function with a float argument

      *)
    10. | Set_float of float ref
      (*

      Set the reference to the float argument

      *)
    11. | Tuple of spec list
      (*

      Take several arguments according to the spec list

      *)
    12. | Symbol of string list * string -> unit
      (*

      Take one of the symbols as argument and call the function with the symbol

      *)
    13. | Rest of string -> unit
      (*

      Stop interpreting keywords and call the function with each remaining argument

      *)
    14. | Rest_all of string list -> unit
      (*

      Stop interpreting keywords and call the function with all remaining arguments

      *)
    15. | Expand of string -> string array
      (*

      If the remaining arguments to process are of the form ["-foo"; "arg"] @ rest where "foo" is registered as Expand f, then the arguments f "arg" @ rest are processed. Only allowed in parse_and_expand_argv_dynamic.

      *)

    The concrete type describing the behavior associated with a keyword.

    type key = string
    type doc = string
    type usage_msg = string
    type anon_fun = string -> unit
    val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit

    Arg.parse speclist anon_fun usage_msg parses the command line. speclist is a list of triples (key, spec, doc). key is the option keyword, it must start with a '-' character. spec gives the option type and the function to call when this option is found on the command line. doc is a one-line description of this option. anon_fun is called on anonymous arguments. The functions in spec and anon_fun are called in the same order as their arguments appear on the command line.

    If an error occurs, Arg.parse exits the program, after printing to standard error an error message as follows:

    • The reason for the error: unknown option, invalid or missing argument, etc.
    • usage_msg
    • The list of options, each followed by the corresponding doc string. Beware: options that have an empty doc string will not be included in the list.

    For the user to be able to specify anonymous arguments starting with a -, include for example ("-", String anon_fun, doc) in speclist.

    By default, parse recognizes two unit options, -help and --help, which will print to standard output usage_msg and the list of options, and exit the program. You can override this behaviour by specifying your own -help and --help options in speclist.

    val parse_dynamic : + (* Main functionality here *)

    Syntax of command lines: A keyword is a character string starting with a -. An option is a keyword alone or followed by an argument. The types of keywords are: Unit, Bool, Set, Clear, String, Set_string, Int, Set_int, Float, Set_float, Tuple, Symbol, Rest, Rest_all and Expand.

    Unit, Set and Clear keywords take no argument.

    A Rest or Rest_all keyword takes the remainder of the command line as arguments. (More explanations below.)

    Every other keyword takes the following word on the command line as argument. For compatibility with GNU getopt_long, keyword=arg is also allowed. Arguments not preceded by a keyword are called anonymous arguments.

    Examples (cmd is assumed to be the command name):

    • cmd -flag (a unit option)
    • cmd -int 1 (an int option with argument 1)
    • cmd -string foobar (a string option with argument "foobar")
    • cmd -float 12.34 (a float option with argument 12.34)
    • cmd a b c (three anonymous arguments: "a", "b", and "c")
    • cmd a b -- c d (two anonymous arguments and a rest option with two arguments)

    Rest takes a function that is called repeatedly for each remaining command line argument. Rest_all takes a function that is called once, with the list of all remaining arguments.

    Note that if no arguments follow a Rest keyword then the function is not called at all whereas the function for a Rest_all keyword is called with an empty list.

    • alert unsynchronized_access The Arg module relies on a mutable global state, parsing functions should only be called from a single domain.
    type spec =
    1. | Unit of unit -> unit
      (*

      Call the function with unit argument

      *)
    2. | Bool of bool -> unit
      (*

      Call the function with a bool argument

      *)
    3. | Set of bool ref
      (*

      Set the reference to true

      *)
    4. | Clear of bool ref
      (*

      Set the reference to false

      *)
    5. | String of string -> unit
      (*

      Call the function with a string argument

      *)
    6. | Set_string of string ref
      (*

      Set the reference to the string argument

      *)
    7. | Int of int -> unit
      (*

      Call the function with an int argument

      *)
    8. | Set_int of int ref
      (*

      Set the reference to the int argument

      *)
    9. | Float of float -> unit
      (*

      Call the function with a float argument

      *)
    10. | Set_float of float ref
      (*

      Set the reference to the float argument

      *)
    11. | Tuple of spec list
      (*

      Take several arguments according to the spec list

      *)
    12. | Symbol of string list * string -> unit
      (*

      Take one of the symbols as argument and call the function with the symbol

      *)
    13. | Rest of string -> unit
      (*

      Stop interpreting keywords and call the function with each remaining argument

      *)
    14. | Rest_all of string list -> unit
      (*

      Stop interpreting keywords and call the function with all remaining arguments

      *)
    15. | Expand of string -> string array
      (*

      If the remaining arguments to process are of the form ["-foo"; "arg"] @ rest where "foo" is registered as Expand f, then the arguments f "arg" @ rest are processed. Only allowed in parse_and_expand_argv_dynamic.

      *)

    The concrete type describing the behavior associated with a keyword.

    type key = string
    type doc = string
    type usage_msg = string
    type anon_fun = string -> unit
    val parse : (key * spec * doc) list -> anon_fun -> usage_msg -> unit

    Arg.parse speclist anon_fun usage_msg parses the command line. speclist is a list of triples (key, spec, doc). key is the option keyword, it must start with a '-' character. spec gives the option type and the function to call when this option is found on the command line. doc is a one-line description of this option. anon_fun is called on anonymous arguments. The functions in spec and anon_fun are called in the same order as their arguments appear on the command line.

    If an error occurs, Arg.parse exits the program, after printing to standard error an error message as follows:

    • The reason for the error: unknown option, invalid or missing argument, etc.
    • usage_msg
    • The list of options, each followed by the corresponding doc string. Beware: options that have an empty doc string will not be included in the list.

    For the user to be able to specify anonymous arguments starting with a -, include for example ("-", String anon_fun, doc) in speclist.

    By default, parse recognizes two unit options, -help and --help, which will print to standard output usage_msg and the list of options, and exit the program. You can override this behaviour by specifying your own -help and --help options in speclist.

    val parse_dynamic : (key * spec * doc) list ref -> anon_fun -> usage_msg -> diff --git a/dev/ocaml/Stdlib/Array/index.html b/dev/ocaml/Stdlib/Array/index.html index e6f820fa..2b7ed489 100644 --- a/dev/ocaml/Stdlib/Array/index.html +++ b/dev/ocaml/Stdlib/Array/index.html @@ -1,2 +1,15 @@ -Array (ocaml.Stdlib.Array)

    Module Stdlib.Array

    Array operations.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a array

    An alias for the type of arrays.

    val length : 'a array -> int

    Return the length (number of elements) of the given array.

    val get : 'a array -> int -> 'a

    get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : 'a array -> int -> 'a -> unit

    set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

    • raises Invalid_argument

      if n is outside the range 0 to length a - 1.

    val make : int -> 'a -> 'a array

    make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val create : int -> 'a -> 'a array
    • deprecated

      create is an alias for make.

    val create_float : int -> float array

    create_float n returns a fresh float array of length n, with uninitialized data.

    • since 4.03
    val make_float : int -> float array
    val init : int -> (int -> 'a) -> 'a array

    init n f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

    val make_matrix : int -> int -> 'a -> 'a array array

    make_matrix dimx dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

    • raises Invalid_argument

      if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val create_matrix : int -> int -> 'a -> 'a array array
    val append : 'a array -> 'a array -> 'a array

    append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_array_length.

    val concat : 'a array list -> 'a array

    Same as append, but concatenates a list of arrays.

    val sub : 'a array -> int -> int -> 'a array

    sub a pos len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : 'a array -> 'a array

    copy a returns a copy of a, that is, a fresh array containing the same elements as a.

    val fill : 'a array -> int -> int -> 'a -> unit

    fill a pos len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : 'a array -> int -> 'a array -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len elements from array src, starting at element number src_pos, to array dst, starting at element number dst_pos. It works correctly even if src and dst are the same array, and the source and destination chunks overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

    val to_list : 'a array -> 'a list

    to_list a returns the list of all the elements of a.

    val of_list : 'a list -> 'a array

    of_list l returns a fresh array containing the elements of l.

    • raises Invalid_argument

      if the length of l is greater than Sys.max_array_length.

    Iterators

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

    iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

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

    Same as iter, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val map : ('a -> 'b) -> 'a array -> 'b array

    map f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

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

    Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b array -> 'a

    fold_left f init a computes f (... (f (f init a.(0)) a.(1)) ...) a.(n-1), where n is the length of the array a.

    val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b array -> 'a * 'c array

    fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

    • since 4.13.0
    val fold_right : ('b -> 'a -> 'a) -> 'b array -> 'a -> 'a

    fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

    Iterators on two arrays

    val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit

    iter2 f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.03.0 (4.05.0 in ArrayLabels)
    val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

    map2 f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.03.0 (4.05.0 in ArrayLabels)

    Array scanning

    val for_all : ('a -> bool) -> 'a array -> bool

    for_all f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    • since 4.03.0
    val exists : ('a -> bool) -> 'a array -> bool

    exists f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    • since 4.03.0
    val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as for_all, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as exists, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val mem : 'a -> 'a array -> bool

    mem a set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

    • since 4.03.0
    val memq : 'a -> 'a array -> bool

    Same as mem, but uses physical equality instead of structural equality to compare list elements.

    • since 4.03.0
    val find_opt : ('a -> bool) -> 'a array -> 'a option

    find_opt f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

    • since 4.13.0
    val find_map : ('a -> 'b option) -> 'a array -> 'b option

    find_map f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

    • since 4.13.0

    Arrays of pairs

    val split : ('a * 'b) array -> 'a array * 'b array

    split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

    • since 4.13.0
    val combine : 'a array -> 'b array -> ('a * 'b) array

    combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

    • since 4.13.0

    Sorting

    val sort : ('a -> 'a -> int) -> 'a array -> unit

    Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : ('a -> 'a -> int) -> 'a array -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

    val fast_sort : ('a -> 'a -> int) -> 'a array -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Arrays and Sequences

    val to_seq : 'a array -> 'a Seq.t

    Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : 'a array -> (int * 'a) Seq.t

    Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val of_seq : 'a Seq.t -> 'a array

    Create an array from the generator

    • since 4.07
    \ No newline at end of file +Array (ocaml.Stdlib.Array)

    Module Stdlib.Array

    Array operations.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a array

    An alias for the type of arrays.

    val length : 'a array -> int

    Return the length (number of elements) of the given array.

    val get : 'a array -> int -> 'a

    get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : 'a array -> int -> 'a -> unit

    set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

    • raises Invalid_argument

      if n is outside the range 0 to length a - 1.

    val make : int -> 'a -> 'a array

    make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val create_float : int -> float array

    create_float n returns a fresh float array of length n, with uninitialized data.

    • since 4.03
    val init : int -> (int -> 'a) -> 'a array

    init n f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

    val make_matrix : int -> int -> 'a -> 'a array array

    make_matrix dimx dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

    • raises Invalid_argument

      if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val append : 'a array -> 'a array -> 'a array

    append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_array_length.

    val concat : 'a array list -> 'a array

    Same as append, but concatenates a list of arrays.

    val sub : 'a array -> int -> int -> 'a array

    sub a pos len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : 'a array -> 'a array

    copy a returns a copy of a, that is, a fresh array containing the same elements as a.

    val fill : 'a array -> int -> int -> 'a -> unit

    fill a pos len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : 'a array -> int -> 'a array -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len elements from array src, starting at element number src_pos, to array dst, starting at element number dst_pos. It works correctly even if src and dst are the same array, and the source and destination chunks overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

    val to_list : 'a array -> 'a list

    to_list a returns the list of all the elements of a.

    val of_list : 'a list -> 'a array

    of_list l returns a fresh array containing the elements of l.

    • raises Invalid_argument

      if the length of l is greater than Sys.max_array_length.

    Iterators

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

    iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

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

    Same as iter, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val map : ('a -> 'b) -> 'a array -> 'b array

    map f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

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

    Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b array -> 'a

    fold_left f init a computes f (... (f (f init a.(0)) a.(1)) ...) a.(n-1), where n is the length of the array a.

    val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b array -> 'a * 'c array

    fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

    • since 4.13.0
    val fold_right : ('b -> 'a -> 'a) -> 'b array -> 'a -> 'a

    fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

    Iterators on two arrays

    val iter2 : ('a -> 'b -> unit) -> 'a array -> 'b array -> unit

    iter2 f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.03.0 (4.05.0 in ArrayLabels)
    val map2 : ('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

    map2 f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.03.0 (4.05.0 in ArrayLabels)

    Array scanning

    val for_all : ('a -> bool) -> 'a array -> bool

    for_all f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    • since 4.03.0
    val exists : ('a -> bool) -> 'a array -> bool

    exists f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    • since 4.03.0
    val for_all2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as for_all, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val exists2 : ('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as exists, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val mem : 'a -> 'a array -> bool

    mem a set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

    • since 4.03.0
    val memq : 'a -> 'a array -> bool

    Same as mem, but uses physical equality instead of structural equality to compare list elements.

    • since 4.03.0
    val find_opt : ('a -> bool) -> 'a array -> 'a option

    find_opt f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

    • since 4.13.0
    val find_map : ('a -> 'b option) -> 'a array -> 'b option

    find_map f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

    • since 4.13.0

    Arrays of pairs

    val split : ('a * 'b) array -> 'a array * 'b array

    split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

    • since 4.13.0
    val combine : 'a array -> 'b array -> ('a * 'b) array

    combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

    • since 4.13.0

    Sorting

    val sort : ('a -> 'a -> int) -> 'a array -> unit

    Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : ('a -> 'a -> int) -> 'a array -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

    val fast_sort : ('a -> 'a -> int) -> 'a array -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Arrays and Sequences

    val to_seq : 'a array -> 'a Seq.t

    Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : 'a array -> (int * 'a) Seq.t

    Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val of_seq : 'a Seq.t -> 'a array

    Create an array from the generator

    • since 4.07

    Arrays and concurrency safety

    Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

    Atomicity

    Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

    For example, consider the following program:

    let size = 100_000_000
    +let a = Array.make size 1
    +let d1 = Domain.spawn (fun () ->
    +   Array.iteri (fun i x -> a.(i) <- x + 1) a
    +)
    +let d2 = Domain.spawn (fun () ->
    +  Array.iteri (fun i x -> a.(i) <- 2 * x + 1) a
    +)
    +let () = Domain.join d1; Domain.join d2

    After executing this code, each field of the array a is either 2, 3, 4 or 5. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

    Data races

    If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

    A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

    Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

    Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location (with a few exceptions for float arrays).

    Float arrays

    Float arrays have two supplementary caveats in the presence of data races.

    First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

    For instance, at the end of

    let zeros = Array.make size 0.
    +let max_floats = Array.make size Float.max_float
    +let res = Array.copy zeros
    +let d1 = Domain.spawn (fun () -> Array.blit zeros 0 res 0 size)
    +let d2 = Domain.spawn (fun () -> Array.blit max_floats 0 res 0 size)
    +let () = Domain.join d1; Domain.join d2

    the res array might contain values that are neither 0. nor max_float.

    Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/ArrayLabels/index.html b/dev/ocaml/Stdlib/ArrayLabels/index.html index 27900715..32d66742 100644 --- a/dev/ocaml/Stdlib/ArrayLabels/index.html +++ b/dev/ocaml/Stdlib/ArrayLabels/index.html @@ -1,5 +1,5 @@ -ArrayLabels (ocaml.Stdlib.ArrayLabels)

    Module Stdlib.ArrayLabels

    Array operations.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a array

    An alias for the type of arrays.

    val length : 'a array -> int

    Return the length (number of elements) of the given array.

    val get : 'a array -> int -> 'a

    get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : 'a array -> int -> 'a -> unit

    set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

    • raises Invalid_argument

      if n is outside the range 0 to length a - 1.

    val make : int -> 'a -> 'a array

    make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val create : int -> 'a -> 'a array
    • deprecated

      create is an alias for make.

    val create_float : int -> float array

    create_float n returns a fresh float array of length n, with uninitialized data.

    • since 4.03
    val make_float : int -> float array
    val init : int -> f:(int -> 'a) -> 'a array

    init n ~f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

    val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array

    make_matrix ~dimx ~dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

    • raises Invalid_argument

      if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val create_matrix : dimx:int -> dimy:int -> 'a -> 'a array array
    val append : 'a array -> 'a array -> 'a array

    append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_array_length.

    val concat : 'a array list -> 'a array

    Same as append, but concatenates a list of arrays.

    val sub : 'a array -> pos:int -> len:int -> 'a array

    sub a ~pos ~len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : 'a array -> 'a array

    copy a returns a copy of a, that is, a fresh array containing the same elements as a.

    val fill : 'a array -> pos:int -> len:int -> 'a -> unit

    fill a ~pos ~len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : +ArrayLabels (ocaml.Stdlib.ArrayLabels)

    Module Stdlib.ArrayLabels

    Array operations.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a array

    An alias for the type of arrays.

    val length : 'a array -> int

    Return the length (number of elements) of the given array.

    val get : 'a array -> int -> 'a

    get a n returns the element number n of array a. The first element has number 0. The last element has number length a - 1. You can also write a.(n) instead of get a n.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : 'a array -> int -> 'a -> unit

    set a n x modifies array a in place, replacing element number n with x. You can also write a.(n) <- x instead of set a n x.

    • raises Invalid_argument

      if n is outside the range 0 to length a - 1.

    val make : int -> 'a -> 'a array

    make n x returns a fresh array of length n, initialized with x. All the elements of this new array are initially physically equal to x (in the sense of the == predicate). Consequently, if x is mutable, it is shared among all elements of the array, and modifying x through one of the array entries will modify all other entries at the same time.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the value of x is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val create_float : int -> float array

    create_float n returns a fresh float array of length n, with uninitialized data.

    • since 4.03
    val init : int -> f:(int -> 'a) -> 'a array

    init n ~f returns a fresh array of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_array_length. If the return type of f is float, then the maximum size is only Sys.max_array_length / 2.

    val make_matrix : dimx:int -> dimy:int -> 'a -> 'a array array

    make_matrix ~dimx ~dimy e returns a two-dimensional array (an array of arrays) with first dimension dimx and second dimension dimy. All the elements of this new matrix are initially physically equal to e. The element (x,y) of a matrix m is accessed with the notation m.(x).(y).

    • raises Invalid_argument

      if dimx or dimy is negative or greater than Sys.max_array_length. If the value of e is a floating-point number, then the maximum size is only Sys.max_array_length / 2.

    val append : 'a array -> 'a array -> 'a array

    append v1 v2 returns a fresh array containing the concatenation of the arrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_array_length.

    val concat : 'a array list -> 'a array

    Same as append, but concatenates a list of arrays.

    val sub : 'a array -> pos:int -> len:int -> 'a array

    sub a ~pos ~len returns a fresh array of length len, containing the elements number pos to pos + len - 1 of array a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : 'a array -> 'a array

    copy a returns a copy of a, that is, a fresh array containing the same elements as a.

    val fill : 'a array -> pos:int -> len:int -> 'a -> unit

    fill a ~pos ~len x modifies the array a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : src:'a array -> src_pos:int -> dst:'a array -> @@ -9,4 +9,17 @@ f:('a -> 'b -> 'a * 'c) -> init:'a -> 'b array -> - 'a * 'c array

    fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

    • since 4.13.0
    val fold_right : f:('b -> 'a -> 'a) -> 'b array -> init:'a -> 'a

    fold_right ~f a ~init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

    Iterators on two arrays

    val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit

    iter2 ~f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.05.0
    val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

    map2 ~f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.05.0

    Array scanning

    val for_all : f:('a -> bool) -> 'a array -> bool

    for_all ~f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    • since 4.03.0
    val exists : f:('a -> bool) -> 'a array -> bool

    exists ~f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    • since 4.03.0
    val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as for_all, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as exists, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val mem : 'a -> set:'a array -> bool

    mem a ~set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

    • since 4.03.0
    val memq : 'a -> set:'a array -> bool

    Same as mem, but uses physical equality instead of structural equality to compare list elements.

    • since 4.03.0
    val find_opt : f:('a -> bool) -> 'a array -> 'a option

    find_opt ~f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

    • since 4.13.0
    val find_map : f:('a -> 'b option) -> 'a array -> 'b option

    find_map ~f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

    • since 4.13.0

    Arrays of pairs

    val split : ('a * 'b) array -> 'a array * 'b array

    split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

    • since 4.13.0
    val combine : 'a array -> 'b array -> ('a * 'b) array

    combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

    • since 4.13.0

    Sorting

    val sort : cmp:('a -> 'a -> int) -> 'a array -> unit

    Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

    val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Arrays and Sequences

    val to_seq : 'a array -> 'a Seq.t

    Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : 'a array -> (int * 'a) Seq.t

    Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val of_seq : 'a Seq.t -> 'a array

    Create an array from the generator

    • since 4.07
    \ No newline at end of file + 'a * 'c array

    fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

    • since 4.13.0
    val fold_right : f:('b -> 'a -> 'a) -> 'b array -> init:'a -> 'a

    fold_right ~f a ~init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the array a.

    Iterators on two arrays

    val iter2 : f:('a -> 'b -> unit) -> 'a array -> 'b array -> unit

    iter2 ~f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.05.0
    val map2 : f:('a -> 'b -> 'c) -> 'a array -> 'b array -> 'c array

    map2 ~f a b applies function f to all the elements of a and b, and builds an array with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the arrays are not the same size.

    • since 4.05.0

    Array scanning

    val for_all : f:('a -> bool) -> 'a array -> bool

    for_all ~f [|a1; ...; an|] checks if all elements of the array satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    • since 4.03.0
    val exists : f:('a -> bool) -> 'a array -> bool

    exists ~f [|a1; ...; an|] checks if at least one element of the array satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    • since 4.03.0
    val for_all2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as for_all, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val exists2 : f:('a -> 'b -> bool) -> 'a array -> 'b array -> bool

    Same as exists, but for a two-argument predicate.

    • raises Invalid_argument

      if the two arrays have different lengths.

    • since 4.11.0
    val mem : 'a -> set:'a array -> bool

    mem a ~set is true if and only if a is structurally equal to an element of l (i.e. there is an x in l such that compare a x = 0).

    • since 4.03.0
    val memq : 'a -> set:'a array -> bool

    Same as mem, but uses physical equality instead of structural equality to compare list elements.

    • since 4.03.0
    val find_opt : f:('a -> bool) -> 'a array -> 'a option

    find_opt ~f a returns the first element of the array a that satisfies the predicate f, or None if there is no value that satisfies f in the array a.

    • since 4.13.0
    val find_map : f:('a -> 'b option) -> 'a array -> 'b option

    find_map ~f a applies f to the elements of a in order, and returns the first result of the form Some v, or None if none exist.

    • since 4.13.0

    Arrays of pairs

    val split : ('a * 'b) array -> 'a array * 'b array

    split [|(a1,b1); ...; (an,bn)|] is ([|a1; ...; an|], [|b1; ...; bn|]).

    • since 4.13.0
    val combine : 'a array -> 'b array -> ('a * 'b) array

    combine [|a1; ...; an|] [|b1; ...; bn|] is [|(a1,b1); ...; (an,bn)|]. Raise Invalid_argument if the two arrays have different lengths.

    • since 4.13.0

    Sorting

    val sort : cmp:('a -> 'a -> int) -> 'a array -> unit

    Sort an array in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the array and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary array of length n/2, where n is the length of the array. It is usually faster than the current implementation of sort.

    val fast_sort : cmp:('a -> 'a -> int) -> 'a array -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Arrays and Sequences

    val to_seq : 'a array -> 'a Seq.t

    Iterate on the array, in increasing order. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : 'a array -> (int * 'a) Seq.t

    Iterate on the array, in increasing order, yielding indices along elements. Modifications of the array during iteration will be reflected in the sequence.

    • since 4.07
    val of_seq : 'a Seq.t -> 'a array

    Create an array from the generator

    • since 4.07

    Arrays and concurrency safety

    Care must be taken when concurrently accessing arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

    Atomicity

    Every array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

    For example, consider the following program:

    let size = 100_000_000
    +let a = ArrayLabels.make size 1
    +let d1 = Domain.spawn (fun () ->
    +   ArrayLabels.iteri ~f:(fun i x -> a.(i) <- x + 1) a
    +)
    +let d2 = Domain.spawn (fun () ->
    +  ArrayLabels.iteri ~f:(fun i x -> a.(i) <- 2 * x + 1) a
    +)
    +let () = Domain.join d1; Domain.join d2

    After executing this code, each field of the array a is either 2, 3, 4 or 5. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

    Data races

    If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

    A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

    Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

    Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location (with a few exceptions for float arrays).

    Float arrays

    Float arrays have two supplementary caveats in the presence of data races.

    First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

    For instance, at the end of

    let zeros = Array.make size 0.
    +let max_floats = Array.make size Float.max_float
    +let res = Array.copy zeros
    +let d1 = Domain.spawn (fun () -> Array.blit zeros 0 res 0 size)
    +let d2 = Domain.spawn (fun () -> Array.blit max_floats 0 res 0 size)
    +let () = Domain.join d1; Domain.join d2

    the res array might contain values that are neither 0. nor max_float.

    Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Atomic/index.html b/dev/ocaml/Stdlib/Atomic/index.html index 4c92d418..b08e81c1 100644 --- a/dev/ocaml/Stdlib/Atomic/index.html +++ b/dev/ocaml/Stdlib/Atomic/index.html @@ -1,2 +1,2 @@ -Atomic (ocaml.Stdlib.Atomic)

    Module Stdlib.Atomic

    This module provides a purely sequential implementation of the concurrent atomic references provided by the Multicore OCaml standard library:

    https://github.com/ocaml-multicore/ocaml-multicore/blob/parallel_minor_gc/stdlib/atomic.mli

    This sequential implementation is provided in the interest of compatibility: when people will start writing code to run on Multicore, it would be nice if their use of Atomic was backward-compatible with older versions of OCaml without having to import additional compatibility layers.

    • since 4.12
    type !'a t

    An atomic (mutable) reference to a value of type 'a.

    val make : 'a -> 'a t

    Create an atomic reference.

    val get : 'a t -> 'a

    Get the current value of the atomic reference.

    val set : 'a t -> 'a -> unit

    Set a new value for the atomic reference.

    val exchange : 'a t -> 'a -> 'a

    Set a new value for the atomic reference, and return the current value.

    val compare_and_set : 'a t -> 'a -> 'a -> bool

    compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

    val fetch_and_add : int t -> int -> int

    fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

    val incr : int t -> unit

    incr r atomically increments the value of r by 1.

    val decr : int t -> unit

    decr r atomically decrements the value of r by 1.

    \ No newline at end of file +Atomic (ocaml.Stdlib.Atomic)

    Module Stdlib.Atomic

    Atomic references.

    See 'Memory model: The hard bits' chapter in the manual.

    • since 4.12
    type !'a t

    An atomic (mutable) reference to a value of type 'a.

    val make : 'a -> 'a t

    Create an atomic reference.

    val get : 'a t -> 'a

    Get the current value of the atomic reference.

    val set : 'a t -> 'a -> unit

    Set a new value for the atomic reference.

    val exchange : 'a t -> 'a -> 'a

    Set a new value for the atomic reference, and return the current value.

    val compare_and_set : 'a t -> 'a -> 'a -> bool

    compare_and_set r seen v sets the new value of r to v only if its current value is physically equal to seen -- the comparison and the set occur atomically. Returns true if the comparison succeeded (so the set happened) and false otherwise.

    val fetch_and_add : int t -> int -> int

    fetch_and_add r n atomically increments the value of r by n, and returns the current value (before the increment).

    val incr : int t -> unit

    incr r atomically increments the value of r by 1.

    val decr : int t -> unit

    decr r atomically decrements the value of r by 1.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Bigarray/index.html b/dev/ocaml/Stdlib/Bigarray/index.html index a0de4851..c46714a5 100644 --- a/dev/ocaml/Stdlib/Bigarray/index.html +++ b/dev/ocaml/Stdlib/Bigarray/index.html @@ -1,5 +1,5 @@ -Bigarray (ocaml.Stdlib.Bigarray)

    Module Stdlib.Bigarray

    Large, multi-dimensional, numerical arrays.

    This module implements multi-dimensional arrays of integers and floating-point numbers, thereafter referred to as 'Bigarrays', to distinguish them from the standard OCaml arrays described in Array.

    The implementation allows efficient sharing of large numerical arrays between OCaml code and C or Fortran numerical libraries.

    The main differences between 'Bigarrays' and standard OCaml arrays are as follows:

    • Bigarrays are not limited in size, unlike OCaml arrays. (Normal float arrays are limited to 2,097,151 elements on a 32-bit platform, and normal arrays of other types to 4,194,303 elements.)
    • Bigarrays are multi-dimensional. Any number of dimensions between 0 and 16 is supported. In contrast, OCaml arrays are mono-dimensional and require encoding multi-dimensional arrays as arrays of arrays.
    • Bigarrays can only contain integers and floating-point numbers, while OCaml arrays can contain arbitrary OCaml data types.
    • Bigarrays provide more space-efficient storage of integer and floating-point elements than normal OCaml arrays, in particular because they support 'small' types such as single-precision floats and 8 and 16-bit integers, in addition to the standard OCaml types of double-precision floats and 32 and 64-bit integers.
    • The memory layout of Bigarrays is entirely compatible with that of arrays in C and Fortran, allowing large arrays to be passed back and forth between OCaml code and C / Fortran code with no data copying at all.
    • Bigarrays support interesting high-level operations that normal arrays do not provide efficiently, such as extracting sub-arrays and 'slicing' a multi-dimensional array along certain dimensions, all without any copying.

    Users of this module are encouraged to do open Bigarray in their source, then refer to array types and operations via short dot notation, e.g. Array1.t or Array2.sub.

    Bigarrays support all the OCaml ad-hoc polymorphic operations:

    Element kinds

    Bigarrays can contain elements of the following kinds:

    Each element kind is represented at the type level by one of the *_elt types defined below (defined with a single constructor instead of abstract types for technical injectivity reasons).

    • since 4.07.0 Moved from otherlibs to stdlib.
    type float32_elt =
    1. | Float32_elt
    type float64_elt =
    1. | Float64_elt
    type int8_signed_elt =
    1. | Int8_signed_elt
    type int8_unsigned_elt =
    1. | Int8_unsigned_elt
    type int16_signed_elt =
    1. | Int16_signed_elt
    type int16_unsigned_elt =
    1. | Int16_unsigned_elt
    type int32_elt =
    1. | Int32_elt
    type int64_elt =
    1. | Int64_elt
    type int_elt =
    1. | Int_elt
    type nativeint_elt =
    1. | Nativeint_elt
    type complex32_elt =
    1. | Complex32_elt
    type complex64_elt =
    1. | Complex64_elt
    type ('a, 'b) kind =
    1. | Float32 : (float, float32_elt) kind
    2. | Float64 : (float, float64_elt) kind
    3. | Int8_signed : (int, int8_signed_elt) kind
    4. | Int8_unsigned : (int, int8_unsigned_elt) kind
    5. | Int16_signed : (int, int16_signed_elt) kind
    6. | Int16_unsigned : (int, int16_unsigned_elt) kind
    7. | Int32 : (int32, int32_elt) kind
    8. | Int64 : (int64, int64_elt) kind
    9. | Int : (int, int_elt) kind
    10. | Nativeint : (nativeint, nativeint_elt) kind
    11. | Complex32 : (Complex.t, complex32_elt) kind
    12. | Complex64 : (Complex.t, complex64_elt) kind
    13. | Char : (char, int8_unsigned_elt) kind

    To each element kind is associated an OCaml type, which is the type of OCaml values that can be stored in the Bigarray or read back from it. This type is not necessarily the same as the type of the array elements proper: for instance, a Bigarray whose elements are of kind float32_elt contains 32-bit single precision floats, but reading or writing one of its elements from OCaml uses the OCaml type float, which is 64-bit double precision floats.

    The GADT type ('a, 'b) kind captures this association of an OCaml type 'a for values read or written in the Bigarray, and of an element kind 'b which represents the actual contents of the Bigarray. Its constructors list all possible associations of OCaml types with element kinds, and are re-exported below for backward-compatibility reasons.

    Using a generalized algebraic datatype (GADT) here allows writing well-typed polymorphic functions whose return type depend on the argument type, such as:

    let zero : type a b. (a, b) kind -> a = function
    +Bigarray (ocaml.Stdlib.Bigarray)

    Module Stdlib.Bigarray

    Large, multi-dimensional, numerical arrays.

    This module implements multi-dimensional arrays of integers and floating-point numbers, thereafter referred to as 'Bigarrays', to distinguish them from the standard OCaml arrays described in Array.

    The implementation allows efficient sharing of large numerical arrays between OCaml code and C or Fortran numerical libraries.

    The main differences between 'Bigarrays' and standard OCaml arrays are as follows:

    • Bigarrays are not limited in size, unlike OCaml arrays. (Normal float arrays are limited to 2,097,151 elements on a 32-bit platform, and normal arrays of other types to 4,194,303 elements.)
    • Bigarrays are multi-dimensional. Any number of dimensions between 0 and 16 is supported. In contrast, OCaml arrays are mono-dimensional and require encoding multi-dimensional arrays as arrays of arrays.
    • Bigarrays can only contain integers and floating-point numbers, while OCaml arrays can contain arbitrary OCaml data types.
    • Bigarrays provide more space-efficient storage of integer and floating-point elements than normal OCaml arrays, in particular because they support 'small' types such as single-precision floats and 8 and 16-bit integers, in addition to the standard OCaml types of double-precision floats and 32 and 64-bit integers.
    • The memory layout of Bigarrays is entirely compatible with that of arrays in C and Fortran, allowing large arrays to be passed back and forth between OCaml code and C / Fortran code with no data copying at all.
    • Bigarrays support interesting high-level operations that normal arrays do not provide efficiently, such as extracting sub-arrays and 'slicing' a multi-dimensional array along certain dimensions, all without any copying.

    Users of this module are encouraged to do open Bigarray in their source, then refer to array types and operations via short dot notation, e.g. Array1.t or Array2.sub.

    Bigarrays support all the OCaml ad-hoc polymorphic operations:

    Element kinds

    Bigarrays can contain elements of the following kinds:

    Each element kind is represented at the type level by one of the *_elt types defined below (defined with a single constructor instead of abstract types for technical injectivity reasons).

    • since 4.07.0 Moved from otherlibs to stdlib.
    type float32_elt =
    1. | Float32_elt
    type float64_elt =
    1. | Float64_elt
    type int8_signed_elt =
    1. | Int8_signed_elt
    type int8_unsigned_elt =
    1. | Int8_unsigned_elt
    type int16_signed_elt =
    1. | Int16_signed_elt
    type int16_unsigned_elt =
    1. | Int16_unsigned_elt
    type int32_elt =
    1. | Int32_elt
    type int64_elt =
    1. | Int64_elt
    type int_elt =
    1. | Int_elt
    type nativeint_elt =
    1. | Nativeint_elt
    type complex32_elt =
    1. | Complex32_elt
    type complex64_elt =
    1. | Complex64_elt
    type ('a, 'b) kind =
    1. | Float32 : (float, float32_elt) kind
    2. | Float64 : (float, float64_elt) kind
    3. | Int8_signed : (int, int8_signed_elt) kind
    4. | Int8_unsigned : (int, int8_unsigned_elt) kind
    5. | Int16_signed : (int, int16_signed_elt) kind
    6. | Int16_unsigned : (int, int16_unsigned_elt) kind
    7. | Int32 : (int32, int32_elt) kind
    8. | Int64 : (int64, int64_elt) kind
    9. | Int : (int, int_elt) kind
    10. | Nativeint : (nativeint, nativeint_elt) kind
    11. | Complex32 : (Complex.t, complex32_elt) kind
    12. | Complex64 : (Complex.t, complex64_elt) kind
    13. | Char : (char, int8_unsigned_elt) kind

    To each element kind is associated an OCaml type, which is the type of OCaml values that can be stored in the Bigarray or read back from it. This type is not necessarily the same as the type of the array elements proper: for instance, a Bigarray whose elements are of kind float32_elt contains 32-bit single precision floats, but reading or writing one of its elements from OCaml uses the OCaml type float, which is 64-bit double precision floats.

    The GADT type ('a, 'b) kind captures this association of an OCaml type 'a for values read or written in the Bigarray, and of an element kind 'b which represents the actual contents of the Bigarray. Its constructors list all possible associations of OCaml types with element kinds, and are re-exported below for backward-compatibility reasons.

    Using a generalized algebraic datatype (GADT) here allows writing well-typed polymorphic functions whose return type depend on the argument type, such as:

    let zero : type a b. (a, b) kind -> a = function
       | Float32 -> 0.0 | Complex32 -> Complex.zero
       | Float64 -> 0.0 | Complex64 -> Complex.zero
       | Int8_signed -> 0 | Int8_unsigned -> 0
    @@ -11,4 +11,14 @@
       int ->
       int ->
       int ->
    -  ('a, 'b, 'c) Array3.t

    Specialized version of Bigarray.reshape for reshaping to three-dimensional arrays.

    \ No newline at end of file + ('a, 'b, 'c) Array3.t

    Specialized version of Bigarray.reshape for reshaping to three-dimensional arrays.

    Bigarrays and concurrency safety

    Care must be taken when concurrently accessing bigarrays from multiple domains: accessing a bigarray will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

    Atomicity

    Every bigarray operation that accesses more than one array element is not atomic. This includes slicing, bliting, and filling bigarrays.

    For example, consider the following program:

    open Bigarray
    +let size = 100_000_000
    +let a = Array1.init Int C_layout size (fun _ -> 1)
    +let update f a () =
    +  for i = 0 to size - 1 do a.{i} <- f a.{i} done
    +let d1 = Domain.spawn (update (fun x -> x + 1) a)
    +let d2 = Domain.spawn (update (fun x -> 2 * x + 1) a)
    +let () = Domain.join d1; Domain.join d2

    After executing this code, each field of the bigarray a is either 2, 3, 4 or 5. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

    Data races

    If two domains only access disjoint parts of the bigarray, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

    A data race is said to occur when two domains access the same bigarray element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

    Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the bigarray elements.

    Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains.

    Tearing

    Bigarrays have a distinct caveat in the presence of data races: concurrent bigarray operations might produce surprising values due to tearing. More precisely, the interleaving of partial writes and reads might create values that would not exist with a sequential execution. For instance, at the end of

    let res = Array1.init Complex64 c_layout size (fun _ -> Complex.zero)
    +let d1 = Domain.spawn (fun () -> Array1.fill res Complex.one)
    +let d2 = Domain.spawn (fun () -> Array1.fill res Complex.i)
    +let () = Domain.join d1; Domain.join d2

    the res bigarray might contain values that are neither Complex.i nor Complex.one (for instance 1 + i).

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Buffer/index.html b/dev/ocaml/Stdlib/Buffer/index.html index 2eac55b4..dbde7e99 100644 --- a/dev/ocaml/Stdlib/Buffer/index.html +++ b/dev/ocaml/Stdlib/Buffer/index.html @@ -2,4 +2,4 @@ Buffer (ocaml.Stdlib.Buffer)

    Module Stdlib.Buffer

    Extensible buffers.

    This module implements buffers that automatically expand as necessary. It provides accumulative concatenation of strings in linear time (instead of quadratic time when strings are concatenated pairwise). For example:

    let concat_strings ss =
       let b = Buffer.create 16 in
         List.iter (Buffer.add_string b) ss;
    -    Buffer.contents b
    type t

    The abstract type of buffers.

    val create : int -> t

    create n returns a fresh buffer, initially empty. The n parameter is the initial size of the internal byte sequence that holds the buffer contents. That byte sequence is automatically reallocated when more than n characters are stored in the buffer, but shrinks back to n characters when reset is called. For best performance, n should be of the same order of magnitude as the number of characters that are expected to be stored in the buffer (for instance, 80 for a buffer that holds one output line). Nothing bad will happen if the buffer grows beyond that limit, however. In doubt, take n = 16 for instance. If n is not between 1 and Sys.max_string_length, it will be clipped to that interval.

    val contents : t -> string

    Return a copy of the current contents of the buffer. The buffer itself is unchanged.

    val to_bytes : t -> bytes

    Return a copy of the current contents of the buffer. The buffer itself is unchanged.

    • since 4.02
    val sub : t -> int -> int -> string

    Buffer.sub b off len returns a copy of len bytes from the current contents of the buffer b, starting at offset off.

    • raises Invalid_argument

      if off and len do not designate a valid range of b.

    val blit : t -> int -> bytes -> int -> int -> unit

    Buffer.blit src srcoff dst dstoff len copies len characters from the current contents of the buffer src, starting at offset srcoff to dst, starting at character dstoff.

    • raises Invalid_argument

      if srcoff and len do not designate a valid range of src, or if dstoff and len do not designate a valid range of dst.

    • since 3.11.2
    val nth : t -> int -> char

    Get the n-th character of the buffer.

    • raises Invalid_argument

      if index out of bounds

    val length : t -> int

    Return the number of characters currently contained in the buffer.

    val clear : t -> unit

    Empty the buffer.

    val reset : t -> unit

    Empty the buffer and deallocate the internal byte sequence holding the buffer contents, replacing it with the initial internal byte sequence of length n that was allocated by Buffer.create n. For long-lived buffers that may have grown a lot, reset allows faster reclamation of the space used by the buffer.

    val output_buffer : out_channel -> t -> unit

    output_buffer oc b writes the current contents of buffer b on the output channel oc.

    val truncate : t -> int -> unit

    truncate b len truncates the length of b to len Note: the internal byte sequence is not shortened.

    • raises Invalid_argument

      if len < 0 or len > length b.

    • since 4.05.0

    Appending

    Note: all add_* operations can raise Failure if the internal byte sequence of the buffer would need to grow beyond Sys.max_string_length.

    val add_char : t -> char -> unit

    add_char b c appends the character c at the end of buffer b.

    val add_utf_8_uchar : t -> Uchar.t -> unit

    add_utf_8_uchar b u appends the UTF-8 encoding of u at the end of buffer b.

    • since 4.06.0
    val add_utf_16le_uchar : t -> Uchar.t -> unit

    add_utf_16le_uchar b u appends the UTF-16LE encoding of u at the end of buffer b.

    • since 4.06.0
    val add_utf_16be_uchar : t -> Uchar.t -> unit

    add_utf_16be_uchar b u appends the UTF-16BE encoding of u at the end of buffer b.

    • since 4.06.0
    val add_string : t -> string -> unit

    add_string b s appends the string s at the end of buffer b.

    val add_bytes : t -> bytes -> unit

    add_bytes b s appends the byte sequence s at the end of buffer b.

    • since 4.02
    val add_substring : t -> string -> int -> int -> unit

    add_substring b s ofs len takes len characters from offset ofs in string s and appends them at the end of buffer b.

    • raises Invalid_argument

      if ofs and len do not designate a valid range of s.

    val add_subbytes : t -> bytes -> int -> int -> unit

    add_subbytes b s ofs len takes len characters from offset ofs in byte sequence s and appends them at the end of buffer b.

    • raises Invalid_argument

      if ofs and len do not designate a valid range of s.

    • since 4.02
    val add_substitute : t -> (string -> string) -> string -> unit

    add_substitute b f s appends the string pattern s at the end of buffer b with substitution. The substitution process looks for variables into the pattern and substitutes each variable name by its value, as obtained by applying the mapping f to the variable name. Inside the string pattern, a variable name immediately follows a non-escaped $ character and is one of the following:

    • a non empty sequence of alphanumeric or _ characters,
    • an arbitrary sequence of characters enclosed by a pair of matching parentheses or curly brackets. An escaped $ character is a $ that immediately follows a backslash character; it then stands for a plain $.
    • raises Not_found

      if the closing character of a parenthesized variable cannot be found.

    val add_buffer : t -> t -> unit

    add_buffer b1 b2 appends the current contents of buffer b2 at the end of buffer b1. b2 is not modified.

    val add_channel : t -> in_channel -> int -> unit

    add_channel b ic n reads at most n characters from the input channel ic and stores them at the end of buffer b.

    • raises End_of_file

      if the channel contains fewer than n characters. In this case, the characters are still added to the buffer, so as to avoid loss of data.

    • raises Invalid_argument

      if len < 0 or len > Sys.max_string_length.

    Buffers and Sequences

    val to_seq : t -> char Seq.t

    Iterate on the buffer, in increasing order.

    The behavior is not specified if the buffer is modified during iteration.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    Iterate on the buffer, in increasing order, yielding indices along chars.

    The behavior is not specified if the buffer is modified during iteration.

    • since 4.07
    val add_seq : t -> char Seq.t -> unit

    Add chars to the buffer

    • since 4.07
    val of_seq : char Seq.t -> t

    Create a buffer from the generator

    • since 4.07

    Binary encoding of integers

    The functions in this section append binary encodings of integers to buffers.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. Functions that encode these values truncate their inputs to their least significant bytes.

    val add_uint8 : t -> int -> unit

    add_uint8 b i appends a binary unsigned 8-bit integer i to b.

    • since 4.08
    val add_int8 : t -> int -> unit

    add_int8 b i appends a binary signed 8-bit integer i to b.

    • since 4.08
    val add_uint16_ne : t -> int -> unit

    add_uint16_ne b i appends a binary native-endian unsigned 16-bit integer i to b.

    • since 4.08
    val add_uint16_be : t -> int -> unit

    add_uint16_be b i appends a binary big-endian unsigned 16-bit integer i to b.

    • since 4.08
    val add_uint16_le : t -> int -> unit

    add_uint16_le b i appends a binary little-endian unsigned 16-bit integer i to b.

    • since 4.08
    val add_int16_ne : t -> int -> unit

    add_int16_ne b i appends a binary native-endian signed 16-bit integer i to b.

    • since 4.08
    val add_int16_be : t -> int -> unit

    add_int16_be b i appends a binary big-endian signed 16-bit integer i to b.

    • since 4.08
    val add_int16_le : t -> int -> unit

    add_int16_le b i appends a binary little-endian signed 16-bit integer i to b.

    • since 4.08
    val add_int32_ne : t -> int32 -> unit

    add_int32_ne b i appends a binary native-endian 32-bit integer i to b.

    • since 4.08
    val add_int32_be : t -> int32 -> unit

    add_int32_be b i appends a binary big-endian 32-bit integer i to b.

    • since 4.08
    val add_int32_le : t -> int32 -> unit

    add_int32_le b i appends a binary little-endian 32-bit integer i to b.

    • since 4.08
    val add_int64_ne : t -> int64 -> unit

    add_int64_ne b i appends a binary native-endian 64-bit integer i to b.

    • since 4.08
    val add_int64_be : t -> int64 -> unit

    add_int64_be b i appends a binary big-endian 64-bit integer i to b.

    • since 4.08
    val add_int64_le : t -> int64 -> unit

    add_int64_ne b i appends a binary little-endian 64-bit integer i to b.

    • since 4.08
    \ No newline at end of file + Buffer.contents b

    Unsynchronized accesses

    Unsynchronized accesses to a buffer may lead to an invalid buffer state. Thus, concurrent accesses to a buffer must be synchronized (for instance with a Mutex.t).

    type t

    The abstract type of buffers.

    val create : int -> t

    create n returns a fresh buffer, initially empty. The n parameter is the initial size of the internal byte sequence that holds the buffer contents. That byte sequence is automatically reallocated when more than n characters are stored in the buffer, but shrinks back to n characters when reset is called. For best performance, n should be of the same order of magnitude as the number of characters that are expected to be stored in the buffer (for instance, 80 for a buffer that holds one output line). Nothing bad will happen if the buffer grows beyond that limit, however. In doubt, take n = 16 for instance. If n is not between 1 and Sys.max_string_length, it will be clipped to that interval.

    val contents : t -> string

    Return a copy of the current contents of the buffer. The buffer itself is unchanged.

    val to_bytes : t -> bytes

    Return a copy of the current contents of the buffer. The buffer itself is unchanged.

    • since 4.02
    val sub : t -> int -> int -> string

    Buffer.sub b off len returns a copy of len bytes from the current contents of the buffer b, starting at offset off.

    • raises Invalid_argument

      if off and len do not designate a valid range of b.

    val blit : t -> int -> bytes -> int -> int -> unit

    Buffer.blit src srcoff dst dstoff len copies len characters from the current contents of the buffer src, starting at offset srcoff to dst, starting at character dstoff.

    • raises Invalid_argument

      if srcoff and len do not designate a valid range of src, or if dstoff and len do not designate a valid range of dst.

    • since 3.11.2
    val nth : t -> int -> char

    Get the n-th character of the buffer.

    • raises Invalid_argument

      if index out of bounds

    val length : t -> int

    Return the number of characters currently contained in the buffer.

    val clear : t -> unit

    Empty the buffer.

    val reset : t -> unit

    Empty the buffer and deallocate the internal byte sequence holding the buffer contents, replacing it with the initial internal byte sequence of length n that was allocated by Buffer.create n. For long-lived buffers that may have grown a lot, reset allows faster reclamation of the space used by the buffer.

    val output_buffer : out_channel -> t -> unit

    output_buffer oc b writes the current contents of buffer b on the output channel oc.

    val truncate : t -> int -> unit

    truncate b len truncates the length of b to len Note: the internal byte sequence is not shortened.

    • raises Invalid_argument

      if len < 0 or len > length b.

    • since 4.05.0

    Appending

    Note: all add_* operations can raise Failure if the internal byte sequence of the buffer would need to grow beyond Sys.max_string_length.

    val add_char : t -> char -> unit

    add_char b c appends the character c at the end of buffer b.

    val add_utf_8_uchar : t -> Uchar.t -> unit

    add_utf_8_uchar b u appends the UTF-8 encoding of u at the end of buffer b.

    • since 4.06.0
    val add_utf_16le_uchar : t -> Uchar.t -> unit

    add_utf_16le_uchar b u appends the UTF-16LE encoding of u at the end of buffer b.

    • since 4.06.0
    val add_utf_16be_uchar : t -> Uchar.t -> unit

    add_utf_16be_uchar b u appends the UTF-16BE encoding of u at the end of buffer b.

    • since 4.06.0
    val add_string : t -> string -> unit

    add_string b s appends the string s at the end of buffer b.

    val add_bytes : t -> bytes -> unit

    add_bytes b s appends the byte sequence s at the end of buffer b.

    • since 4.02
    val add_substring : t -> string -> int -> int -> unit

    add_substring b s ofs len takes len characters from offset ofs in string s and appends them at the end of buffer b.

    • raises Invalid_argument

      if ofs and len do not designate a valid range of s.

    val add_subbytes : t -> bytes -> int -> int -> unit

    add_subbytes b s ofs len takes len characters from offset ofs in byte sequence s and appends them at the end of buffer b.

    • raises Invalid_argument

      if ofs and len do not designate a valid range of s.

    • since 4.02
    val add_substitute : t -> (string -> string) -> string -> unit

    add_substitute b f s appends the string pattern s at the end of buffer b with substitution. The substitution process looks for variables into the pattern and substitutes each variable name by its value, as obtained by applying the mapping f to the variable name. Inside the string pattern, a variable name immediately follows a non-escaped $ character and is one of the following:

    • a non empty sequence of alphanumeric or _ characters,
    • an arbitrary sequence of characters enclosed by a pair of matching parentheses or curly brackets. An escaped $ character is a $ that immediately follows a backslash character; it then stands for a plain $.
    • raises Not_found

      if the closing character of a parenthesized variable cannot be found.

    val add_buffer : t -> t -> unit

    add_buffer b1 b2 appends the current contents of buffer b2 at the end of buffer b1. b2 is not modified.

    val add_channel : t -> in_channel -> int -> unit

    add_channel b ic n reads at most n characters from the input channel ic and stores them at the end of buffer b.

    • raises End_of_file

      if the channel contains fewer than n characters. In this case, the characters are still added to the buffer, so as to avoid loss of data.

    • raises Invalid_argument

      if len < 0 or len > Sys.max_string_length.

    Buffers and Sequences

    val to_seq : t -> char Seq.t

    Iterate on the buffer, in increasing order.

    The behavior is not specified if the buffer is modified during iteration.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    Iterate on the buffer, in increasing order, yielding indices along chars.

    The behavior is not specified if the buffer is modified during iteration.

    • since 4.07
    val add_seq : t -> char Seq.t -> unit

    Add chars to the buffer

    • since 4.07
    val of_seq : char Seq.t -> t

    Create a buffer from the generator

    • since 4.07

    Binary encoding of integers

    The functions in this section append binary encodings of integers to buffers.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. Functions that encode these values truncate their inputs to their least significant bytes.

    val add_uint8 : t -> int -> unit

    add_uint8 b i appends a binary unsigned 8-bit integer i to b.

    • since 4.08
    val add_int8 : t -> int -> unit

    add_int8 b i appends a binary signed 8-bit integer i to b.

    • since 4.08
    val add_uint16_ne : t -> int -> unit

    add_uint16_ne b i appends a binary native-endian unsigned 16-bit integer i to b.

    • since 4.08
    val add_uint16_be : t -> int -> unit

    add_uint16_be b i appends a binary big-endian unsigned 16-bit integer i to b.

    • since 4.08
    val add_uint16_le : t -> int -> unit

    add_uint16_le b i appends a binary little-endian unsigned 16-bit integer i to b.

    • since 4.08
    val add_int16_ne : t -> int -> unit

    add_int16_ne b i appends a binary native-endian signed 16-bit integer i to b.

    • since 4.08
    val add_int16_be : t -> int -> unit

    add_int16_be b i appends a binary big-endian signed 16-bit integer i to b.

    • since 4.08
    val add_int16_le : t -> int -> unit

    add_int16_le b i appends a binary little-endian signed 16-bit integer i to b.

    • since 4.08
    val add_int32_ne : t -> int32 -> unit

    add_int32_ne b i appends a binary native-endian 32-bit integer i to b.

    • since 4.08
    val add_int32_be : t -> int32 -> unit

    add_int32_be b i appends a binary big-endian 32-bit integer i to b.

    • since 4.08
    val add_int32_le : t -> int32 -> unit

    add_int32_le b i appends a binary little-endian 32-bit integer i to b.

    • since 4.08
    val add_int64_ne : t -> int64 -> unit

    add_int64_ne b i appends a binary native-endian 64-bit integer i to b.

    • since 4.08
    val add_int64_be : t -> int64 -> unit

    add_int64_be b i appends a binary big-endian 64-bit integer i to b.

    • since 4.08
    val add_int64_le : t -> int64 -> unit

    add_int64_ne b i appends a binary little-endian 64-bit integer i to b.

    • since 4.08
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Bytes/index.html b/dev/ocaml/Stdlib/Bytes/index.html index e023c8dc..422b288c 100644 --- a/dev/ocaml/Stdlib/Bytes/index.html +++ b/dev/ocaml/Stdlib/Bytes/index.html @@ -1,10 +1,17 @@ -Bytes (ocaml.Stdlib.Bytes)

    Module Stdlib.Bytes

    Byte sequence operations.

    A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing.

    Given a byte sequence s of length l, we can access each of the l bytes of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the byte at index n is between positions n and n+1.

    Two parameters start and len are said to designate a valid range of s if len >= 0 and start and start+len are valid positions in s.

    Byte sequences can be modified in place, for instance via the set and blit functions described below. See also strings (module String), which are almost the same data structure, but cannot be modified in place.

    Bytes are represented by the OCaml type char.

    The labeled version of this module can be used as described in the StdLabels module.

    • since 4.02.0
    val length : bytes -> int

    Return the length (number of bytes) of the argument.

    val get : bytes -> int -> char

    get s n returns the byte at index n in argument s.

    • raises Invalid_argument

      if n is not a valid index in s.

    val set : bytes -> int -> char -> unit

    set s n c modifies s in place, replacing the byte at index n with c.

    • raises Invalid_argument

      if n is not a valid index in s.

    val create : int -> bytes

    create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

    val make : int -> char -> bytes

    make n c returns a new byte sequence of length n, filled with the byte c.

    val init : int -> (int -> char) -> bytes

    init n f returns a fresh byte sequence of length n, with character i initialized to the result of f i (in increasing index order).

    val empty : bytes

    A byte sequence of size 0.

    val copy : bytes -> bytes

    Return a new byte sequence that contains the same bytes as the argument.

    val of_string : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    val to_string : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    val sub : bytes -> int -> int -> bytes

    sub s pos len returns a new byte sequence of length len, containing the subsequence of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val sub_string : bytes -> int -> int -> string

    Same as sub but return a string instead of a byte sequence.

    val extend : bytes -> int -> int -> bytes

    extend s left right returns a new byte sequence that contains the bytes of s, with left uninitialized bytes prepended and right uninitialized bytes appended to it. If left or right is negative, then bytes are removed (instead of appended) from the corresponding side of s.

    • since 4.05.0 in BytesLabels
    val fill : bytes -> int -> int -> char -> unit

    fill s pos len c modifies s in place, replacing len characters with c, starting at pos.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val blit : bytes -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from sequence src, starting at index src_pos, to sequence dst, starting at index dst_pos. It works correctly even if src and dst are the same byte sequence, and the source and destination intervals overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    val blit_string : string -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from string src, starting at index src_pos, to byte sequence dst, starting at index dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    • since 4.05.0 in BytesLabels
    val concat : bytes -> bytes list -> bytes

    concat sep sl concatenates the list of byte sequences sl, inserting the separator byte sequence sep between each, and returns the result as a new byte sequence.

    val cat : bytes -> bytes -> bytes

    cat s1 s2 concatenates s1 and s2 and returns the result as a new byte sequence.

    • since 4.05.0 in BytesLabels
    val iter : (char -> unit) -> bytes -> unit

    iter f s applies function f in turn to all the bytes of s. It is equivalent to f (get s 0); f (get s 1); ...; f (get s +Bytes (ocaml.Stdlib.Bytes)

    Module Stdlib.Bytes

    Byte sequence operations.

    A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing.

    Given a byte sequence s of length l, we can access each of the l bytes of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the byte at index n is between positions n and n+1.

    Two parameters start and len are said to designate a valid range of s if len >= 0 and start and start+len are valid positions in s.

    Byte sequences can be modified in place, for instance via the set and blit functions described below. See also strings (module String), which are almost the same data structure, but cannot be modified in place.

    Bytes are represented by the OCaml type char.

    The labeled version of this module can be used as described in the StdLabels module.

    • since 4.02.0
    val length : bytes -> int

    Return the length (number of bytes) of the argument.

    val get : bytes -> int -> char

    get s n returns the byte at index n in argument s.

    • raises Invalid_argument

      if n is not a valid index in s.

    val set : bytes -> int -> char -> unit

    set s n c modifies s in place, replacing the byte at index n with c.

    • raises Invalid_argument

      if n is not a valid index in s.

    val create : int -> bytes

    create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

    val make : int -> char -> bytes

    make n c returns a new byte sequence of length n, filled with the byte c.

    val init : int -> (int -> char) -> bytes

    init n f returns a fresh byte sequence of length n, with character i initialized to the result of f i (in increasing index order).

    val empty : bytes

    A byte sequence of size 0.

    val copy : bytes -> bytes

    Return a new byte sequence that contains the same bytes as the argument.

    val of_string : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    val to_string : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    val sub : bytes -> int -> int -> bytes

    sub s pos len returns a new byte sequence of length len, containing the subsequence of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val sub_string : bytes -> int -> int -> string

    Same as sub but return a string instead of a byte sequence.

    val extend : bytes -> int -> int -> bytes

    extend s left right returns a new byte sequence that contains the bytes of s, with left uninitialized bytes prepended and right uninitialized bytes appended to it. If left or right is negative, then bytes are removed (instead of appended) from the corresponding side of s.

    • since 4.05.0 in BytesLabels
    val fill : bytes -> int -> int -> char -> unit

    fill s pos len c modifies s in place, replacing len characters with c, starting at pos.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val blit : bytes -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from sequence src, starting at index src_pos, to sequence dst, starting at index dst_pos. It works correctly even if src and dst are the same byte sequence, and the source and destination intervals overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    val blit_string : string -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from string src, starting at index src_pos, to byte sequence dst, starting at index dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    • since 4.05.0 in BytesLabels
    val concat : bytes -> bytes list -> bytes

    concat sep sl concatenates the list of byte sequences sl, inserting the separator byte sequence sep between each, and returns the result as a new byte sequence.

    val cat : bytes -> bytes -> bytes

    cat s1 s2 concatenates s1 and s2 and returns the result as a new byte sequence.

    • since 4.05.0 in BytesLabels
    val iter : (char -> unit) -> bytes -> unit

    iter f s applies function f in turn to all the bytes of s. It is equivalent to f (get s 0); f (get s 1); ...; f (get s (length s - 1)); ().

    val iteri : (int -> char -> unit) -> bytes -> unit

    Same as iter, but the function is applied to the index of the byte as first argument and the byte itself as second argument.

    val map : (char -> char) -> bytes -> bytes

    map f s applies function f in turn to all the bytes of s (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

    val mapi : (int -> char -> char) -> bytes -> bytes

    mapi f s calls f with each character of s and its index (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

    val fold_left : ('a -> char -> 'a) -> 'a -> bytes -> 'a

    fold_left f x s computes f (... (f (f x (get s 0)) (get s 1)) ...) (get s (n-1)), where n is the length of s.

    • since 4.13.0
    val fold_right : (char -> 'a -> 'a) -> bytes -> 'a -> 'a

    fold_right f s x computes f (get s 0) (f (get s 1) ( ... (f (get s (n-1)) x) ...)), where n is the length of s.

    • since 4.13.0
    val for_all : (char -> bool) -> bytes -> bool

    for_all p s checks if all characters in s satisfy the predicate p.

    • since 4.13.0
    val exists : (char -> bool) -> bytes -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : bytes -> bytes

    Return a copy of the argument, without leading and trailing whitespace. The bytes regarded as whitespace are the ASCII characters ' ', '\012', '\n', '\r', and '\t'.

    val escaped : bytes -> bytes

    Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote.

    val index : bytes -> char -> int

    index s c returns the index of the first occurrence of byte c in s.

    • raises Not_found

      if c does not occur in s.

    val index_opt : bytes -> char -> int option

    index_opt s c returns the index of the first occurrence of byte c in s or None if c does not occur in s.

    • since 4.05
    val rindex : bytes -> char -> int

    rindex s c returns the index of the last occurrence of byte c in s.

    • raises Not_found

      if c does not occur in s.

    val rindex_opt : bytes -> char -> int option

    rindex_opt s c returns the index of the last occurrence of byte c in s or None if c does not occur in s.

    • since 4.05
    val index_from : bytes -> int -> char -> int

    index_from s i c returns the index of the first occurrence of byte c in s after position i. index s c is equivalent to index_from s 0 c.

    • raises Invalid_argument

      if i is not a valid position in s.

    • raises Not_found

      if c does not occur in s after position i.

    val index_from_opt : bytes -> int -> char -> int option

    index_from_opt s i c returns the index of the first occurrence of byte c in s after position i or None if c does not occur in s after position i. index_opt s c is equivalent to index_from_opt s 0 c.

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : bytes -> int -> char -> int

    rindex_from s i c returns the index of the last occurrence of byte c in s before position i+1. rindex s c is equivalent to rindex_from s (length s - 1) c.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • raises Not_found

      if c does not occur in s before position i+1.

    val rindex_from_opt : bytes -> int -> char -> int option

    rindex_from_opt s i c returns the index of the last occurrence of byte c in s before position i+1 or None if c does not occur in s before position i+1. rindex_opt s c is equivalent to rindex_from s (length s - 1) c.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val contains : bytes -> char -> bool

    contains s c tests if byte c appears in s.

    val contains_from : bytes -> int -> char -> bool

    contains_from s start c tests if byte c appears in s after position start. contains s c is equivalent to contains_from - s 0 c.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : bytes -> int -> char -> bool

    rcontains_from s stop c tests if byte c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val uppercase : bytes -> bytes

    Return a copy of the argument, with all lowercase letters translated to uppercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val lowercase : bytes -> bytes

    Return a copy of the argument, with all uppercase letters translated to lowercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val capitalize : bytes -> bytes

    Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uncapitalize : bytes -> bytes

    Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uppercase_ascii : bytes -> bytes

    Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val lowercase_ascii : bytes -> bytes

    Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val capitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val uncapitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    type t = bytes

    An alias for the type of byte sequences.

    val compare : t -> t -> int

    The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

    val equal : t -> t -> bool

    The equality function for byte sequences.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val starts_with : prefix:bytes -> bytes -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:bytes -> bytes -> bool

    ends_with suffix s is true if and only if s ends with suffix.

    • since 4.13.0

    Unsafe conversions (for advanced users)

    This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

    val unsafe_to_string : bytes -> string

    Unsafely convert a byte sequence into a string.

    To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

    • Unique ownership: the data may be accessed and mutated
    • Shared ownership: the data has several owners, that may only access it, not mutate it.

    Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

    unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

    There are two valid use-cases that respect this ownership discipline:

    1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

    let string_init len f : string =
    +    s 0 c.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : bytes -> int -> char -> bool

    rcontains_from s stop c tests if byte c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val uppercase_ascii : bytes -> bytes

    Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val lowercase_ascii : bytes -> bytes

    Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val capitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val uncapitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in BytesLabels)
    type t = bytes

    An alias for the type of byte sequences.

    val compare : t -> t -> int

    The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

    val equal : t -> t -> bool

    The equality function for byte sequences.

    • since 4.03.0 (4.05.0 in BytesLabels)
    val starts_with : prefix:bytes -> bytes -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:bytes -> bytes -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13.0

    Unsafe conversions (for advanced users)

    This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

    val unsafe_to_string : bytes -> string

    Unsafely convert a byte sequence into a string.

    To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

    • Unique ownership: the data may be accessed and mutated
    • Shared ownership: the data has several owners, that may only access it, not mutate it.

    Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

    unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

    There are two valid use-cases that respect this ownership discipline:

    1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

    let string_init len f : string =
       let s = Bytes.create len in
       for i = 0 to len - 1 do Bytes.set s i (f i) done;
       Bytes.unsafe_to_string s

    This function is safe because the byte sequence s will never be accessed or mutated after unsafe_to_string is called. The string_init code gives up ownership of s, and returns the ownership of the resulting string to its caller.

    Note that it would be unsafe if s was passed as an additional parameter to the function f as it could escape this way and be mutated in the future -- string_init would give up ownership of s to pass it to f, and could not call unsafe_to_string safely.

    We have provided the String.init, String.map and String.mapi functions to cover most cases of building new strings. You should prefer those over to_string or unsafe_to_string whenever applicable.

    2. Temporarily giving ownership of a byte sequence to a function that expects a uniquely owned string and returns ownership back, so that we can mutate the sequence again after the call ended.

    let bytes_length (s : bytes) =
       String.length (Bytes.unsafe_to_string s)

    In this use-case, we do not promise that s will never be mutated after the call to bytes_length s. The String.length function temporarily borrows unique ownership of the byte sequence (and sees it as a string), but returns this ownership back to the caller, which may assume that s is still a valid byte sequence after the call. Note that this is only correct because we know that String.length does not capture its argument -- it could escape by a side-channel such as a memoization combinator.

    The caller may not mutate s while the string is borrowed (it has temporarily given up ownership). This affects concurrent programs, but also higher-order functions: if String.length returned a closure to be called later, s should not be mutated until this closure is fully applied and returns ownership.

    val unsafe_of_string : string -> bytes

    Unsafely convert a shared string to a byte sequence that should not be mutated.

    The same ownership discipline that makes unsafe_to_string correct applies to unsafe_of_string: you may use it if you were the owner of the string value, and you will own the return bytes in the same mode.

    In practice, unique ownership of string values is extremely difficult to reason about correctly. You should always assume strings are shared, never uniquely owned.

    For example, string literals are implicitly shared by the compiler, so you never uniquely own them.

    let incorrect = Bytes.unsafe_of_string "hello"
     let s = Bytes.of_string "hello"

    The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

    Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

    The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

    val split_on_char : char -> bytes -> bytes list

    split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character.

    The function's output is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) - (Bytes.split_on_char sep s) = s).
    • No byte sequence in the result contains the sep character.
    • since 4.13.0

    Iterators

    val to_seq : t -> char Seq.t

    Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    Iterate on the string, in increasing order, yielding indices along chars

    • since 4.07
    val of_seq : char Seq.t -> t

    Create a string from the generator

    • since 4.07

    UTF codecs and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val set_utf_8_uchar : t -> int -> Uchar.t -> int

    set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val set_utf_16be_uchar : t -> int -> Uchar.t -> int

    set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val set_utf_16le_uchar : t -> int -> Uchar.t -> int

    set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Binary encoding/decoding of integers

    The functions in this section binary encode and decode integers to and from byte sequences.

    All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

    • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
    • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
    val get_uint8 : bytes -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

    • since 4.08
    val get_int8 : bytes -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_ne : bytes -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_be : bytes -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_le : bytes -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_ne : bytes -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_be : bytes -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_le : bytes -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int32_ne : bytes -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_be : bytes -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_le : bytes -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int64_ne : bytes -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_be : bytes -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_le : bytes -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

    • since 4.08
    val set_uint8 : bytes -> int -> int -> unit

    set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_int8 : bytes -> int -> int -> unit

    set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_ne : bytes -> int -> int -> unit

    set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_be : bytes -> int -> int -> unit

    set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_le : bytes -> int -> int -> unit

    set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_ne : bytes -> int -> int -> unit

    set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_be : bytes -> int -> int -> unit

    set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_le : bytes -> int -> int -> unit

    set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_ne : bytes -> int -> int32 -> unit

    set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_be : bytes -> int -> int32 -> unit

    set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_le : bytes -> int -> int32 -> unit

    set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_ne : bytes -> int -> int64 -> unit

    set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_be : bytes -> int -> int64 -> unit

    set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_le : bytes -> int -> int64 -> unit

    set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    \ No newline at end of file + (Bytes.split_on_char sep s) = s).
  • No byte sequence in the result contains the sep character.
    • since 4.13.0

    Iterators

    val to_seq : t -> char Seq.t

    Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    Iterate on the string, in increasing order, yielding indices along chars

    • since 4.07
    val of_seq : char Seq.t -> t

    Create a string from the generator

    • since 4.07

    UTF codecs and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val set_utf_8_uchar : t -> int -> Uchar.t -> int

    set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val set_utf_16be_uchar : t -> int -> Uchar.t -> int

    set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val set_utf_16le_uchar : t -> int -> Uchar.t -> int

    set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Binary encoding/decoding of integers

    The functions in this section binary encode and decode integers to and from byte sequences.

    All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

    • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
    • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
    val get_uint8 : bytes -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

    • since 4.08
    val get_int8 : bytes -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_ne : bytes -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_be : bytes -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_le : bytes -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_ne : bytes -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_be : bytes -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_le : bytes -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int32_ne : bytes -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_be : bytes -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_le : bytes -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int64_ne : bytes -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_be : bytes -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_le : bytes -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

    • since 4.08
    val set_uint8 : bytes -> int -> int -> unit

    set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_int8 : bytes -> int -> int -> unit

    set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_ne : bytes -> int -> int -> unit

    set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_be : bytes -> int -> int -> unit

    set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_le : bytes -> int -> int -> unit

    set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_ne : bytes -> int -> int -> unit

    set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_be : bytes -> int -> int -> unit

    set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_le : bytes -> int -> int -> unit

    set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_ne : bytes -> int -> int32 -> unit

    set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_be : bytes -> int -> int32 -> unit

    set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_le : bytes -> int -> int32 -> unit

    set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_ne : bytes -> int -> int64 -> unit

    set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_be : bytes -> int -> int64 -> unit

    set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_le : bytes -> int -> int64 -> unit

    set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

    • since 4.08

    Byte sequences and concurrency safety

    Care must be taken when concurrently accessing byte sequences from multiple domains: accessing a byte sequence will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

    Atomicity

    Every byte sequence operation that accesses more than one byte is not atomic. This includes iteration and scanning.

    For example, consider the following program:

    let size = 100_000_000
    +let b = Bytes.make size  ' '
    +let update b f ()  =
    +  Bytes.iteri (fun i x -> Bytes.set b i (Char.chr (f (Char.code x)))) b
    +let d1 = Domain.spawn (update b (fun x -> x + 1))
    +let d2 = Domain.spawn (update b (fun x -> 2 * x + 1))
    +let () = Domain.join d1; Domain.join d2

    the bytes sequence b may contain a non-deterministic mixture of '!', 'A', 'B', and 'C' values.

    After executing this code, each byte of the sequence b is either '!', 'A', 'B', or 'C'. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

    Data races

    If two domains only access disjoint parts of a byte sequence, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

    A data race is said to occur when two domains access the same byte without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

    Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the elements of the sequence.

    Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location.

    Mixed-size accesses

    Another subtle point is that if a data race involves mixed-size writes and reads to the same location, the order in which those writes and reads are observed by domains is not specified. For instance, the following code write sequentially a 32-bit integer and a char to the same index

    let b = Bytes.make 10 '\000'
    +let d1 = Domain.spawn (fun () -> Bytes.set_int32_ne b 0 100; b.[0] <- 'd' )

    In this situation, a domain that observes the write of 'd' to b.0 is not guaranteed to also observe the write to indices 1, 2, or 3.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/BytesLabels/index.html b/dev/ocaml/Stdlib/BytesLabels/index.html index 186cf364..caa5a3d9 100644 --- a/dev/ocaml/Stdlib/BytesLabels/index.html +++ b/dev/ocaml/Stdlib/BytesLabels/index.html @@ -1,5 +1,5 @@ -BytesLabels (ocaml.Stdlib.BytesLabels)

    Module Stdlib.BytesLabels

    Byte sequence operations.

    A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing.

    Given a byte sequence s of length l, we can access each of the l bytes of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the byte at index n is between positions n and n+1.

    Two parameters start and len are said to designate a valid range of s if len >= 0 and start and start+len are valid positions in s.

    Byte sequences can be modified in place, for instance via the set and blit functions described below. See also strings (module String), which are almost the same data structure, but cannot be modified in place.

    Bytes are represented by the OCaml type char.

    The labeled version of this module can be used as described in the StdLabels module.

    • since 4.02.0
    val length : bytes -> int

    Return the length (number of bytes) of the argument.

    val get : bytes -> int -> char

    get s n returns the byte at index n in argument s.

    • raises Invalid_argument

      if n is not a valid index in s.

    val set : bytes -> int -> char -> unit

    set s n c modifies s in place, replacing the byte at index n with c.

    • raises Invalid_argument

      if n is not a valid index in s.

    val create : int -> bytes

    create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

    val make : int -> char -> bytes

    make n c returns a new byte sequence of length n, filled with the byte c.

    val init : int -> f:(int -> char) -> bytes

    init n f returns a fresh byte sequence of length n, with character i initialized to the result of f i (in increasing index order).

    val empty : bytes

    A byte sequence of size 0.

    val copy : bytes -> bytes

    Return a new byte sequence that contains the same bytes as the argument.

    val of_string : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    val to_string : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    val sub : bytes -> pos:int -> len:int -> bytes

    sub s ~pos ~len returns a new byte sequence of length len, containing the subsequence of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val sub_string : bytes -> pos:int -> len:int -> string

    Same as sub but return a string instead of a byte sequence.

    val extend : bytes -> left:int -> right:int -> bytes

    extend s ~left ~right returns a new byte sequence that contains the bytes of s, with left uninitialized bytes prepended and right uninitialized bytes appended to it. If left or right is negative, then bytes are removed (instead of appended) from the corresponding side of s.

    • since 4.05.0 in BytesLabels
    val fill : bytes -> pos:int -> len:int -> char -> unit

    fill s ~pos ~len c modifies s in place, replacing len characters with c, starting at pos.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val blit : +BytesLabels (ocaml.Stdlib.BytesLabels)

    Module Stdlib.BytesLabels

    Byte sequence operations.

    A byte sequence is a mutable data structure that contains a fixed-length sequence of bytes. Each byte can be indexed in constant time for reading or writing.

    Given a byte sequence s of length l, we can access each of the l bytes of s via its index in the sequence. Indexes start at 0, and we will call an index valid in s if it falls within the range [0...l-1] (inclusive). A position is the point between two bytes or at the beginning or end of the sequence. We call a position valid in s if it falls within the range [0...l] (inclusive). Note that the byte at index n is between positions n and n+1.

    Two parameters start and len are said to designate a valid range of s if len >= 0 and start and start+len are valid positions in s.

    Byte sequences can be modified in place, for instance via the set and blit functions described below. See also strings (module String), which are almost the same data structure, but cannot be modified in place.

    Bytes are represented by the OCaml type char.

    The labeled version of this module can be used as described in the StdLabels module.

    • since 4.02.0
    val length : bytes -> int

    Return the length (number of bytes) of the argument.

    val get : bytes -> int -> char

    get s n returns the byte at index n in argument s.

    • raises Invalid_argument

      if n is not a valid index in s.

    val set : bytes -> int -> char -> unit

    set s n c modifies s in place, replacing the byte at index n with c.

    • raises Invalid_argument

      if n is not a valid index in s.

    val create : int -> bytes

    create n returns a new byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

    val make : int -> char -> bytes

    make n c returns a new byte sequence of length n, filled with the byte c.

    val init : int -> f:(int -> char) -> bytes

    init n f returns a fresh byte sequence of length n, with character i initialized to the result of f i (in increasing index order).

    val empty : bytes

    A byte sequence of size 0.

    val copy : bytes -> bytes

    Return a new byte sequence that contains the same bytes as the argument.

    val of_string : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    val to_string : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    val sub : bytes -> pos:int -> len:int -> bytes

    sub s ~pos ~len returns a new byte sequence of length len, containing the subsequence of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val sub_string : bytes -> pos:int -> len:int -> string

    Same as sub but return a string instead of a byte sequence.

    val extend : bytes -> left:int -> right:int -> bytes

    extend s ~left ~right returns a new byte sequence that contains the bytes of s, with left uninitialized bytes prepended and right uninitialized bytes appended to it. If left or right is negative, then bytes are removed (instead of appended) from the corresponding side of s.

    • since 4.05.0 in BytesLabels
    val fill : bytes -> pos:int -> len:int -> char -> unit

    fill s ~pos ~len c modifies s in place, replacing len characters with c, starting at pos.

    • raises Invalid_argument

      if pos and len do not designate a valid range of s.

    val blit : src:bytes -> src_pos:int -> dst:bytes -> @@ -13,10 +13,17 @@ len:int -> unit

    blit ~src ~src_pos ~dst ~dst_pos ~len copies len bytes from string src, starting at index src_pos, to byte sequence dst, starting at index dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    • since 4.05.0 in BytesLabels
    val concat : sep:bytes -> bytes list -> bytes

    concat ~sep sl concatenates the list of byte sequences sl, inserting the separator byte sequence sep between each, and returns the result as a new byte sequence.

    val cat : bytes -> bytes -> bytes

    cat s1 s2 concatenates s1 and s2 and returns the result as a new byte sequence.

    • since 4.05.0 in BytesLabels
    val iter : f:(char -> unit) -> bytes -> unit

    iter ~f s applies function f in turn to all the bytes of s. It is equivalent to f (get s 0); f (get s 1); ...; f (get s (length s - 1)); ().

    val iteri : f:(int -> char -> unit) -> bytes -> unit

    Same as iter, but the function is applied to the index of the byte as first argument and the byte itself as second argument.

    val map : f:(char -> char) -> bytes -> bytes

    map ~f s applies function f in turn to all the bytes of s (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

    val mapi : f:(int -> char -> char) -> bytes -> bytes

    mapi ~f s calls f with each character of s and its index (in increasing index order) and stores the resulting bytes in a new sequence that is returned as the result.

    val fold_left : f:('a -> char -> 'a) -> init:'a -> bytes -> 'a

    fold_left f x s computes f (... (f (f x (get s 0)) (get s 1)) ...) (get s (n-1)), where n is the length of s.

    • since 4.13.0
    val fold_right : f:(char -> 'a -> 'a) -> bytes -> init:'a -> 'a

    fold_right f s x computes f (get s 0) (f (get s 1) ( ... (f (get s (n-1)) x) ...)), where n is the length of s.

    • since 4.13.0
    val for_all : f:(char -> bool) -> bytes -> bool

    for_all p s checks if all characters in s satisfy the predicate p.

    • since 4.13.0
    val exists : f:(char -> bool) -> bytes -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : bytes -> bytes

    Return a copy of the argument, without leading and trailing whitespace. The bytes regarded as whitespace are the ASCII characters ' ', '\012', '\n', '\r', and '\t'.

    val escaped : bytes -> bytes

    Return a copy of the argument, with special characters represented by escape sequences, following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash and double-quote.

    val index : bytes -> char -> int

    index s c returns the index of the first occurrence of byte c in s.

    • raises Not_found

      if c does not occur in s.

    val index_opt : bytes -> char -> int option

    index_opt s c returns the index of the first occurrence of byte c in s or None if c does not occur in s.

    • since 4.05
    val rindex : bytes -> char -> int

    rindex s c returns the index of the last occurrence of byte c in s.

    • raises Not_found

      if c does not occur in s.

    val rindex_opt : bytes -> char -> int option

    rindex_opt s c returns the index of the last occurrence of byte c in s or None if c does not occur in s.

    • since 4.05
    val index_from : bytes -> int -> char -> int

    index_from s i c returns the index of the first occurrence of byte c in s after position i. index s c is equivalent to index_from s 0 c.

    • raises Invalid_argument

      if i is not a valid position in s.

    • raises Not_found

      if c does not occur in s after position i.

    val index_from_opt : bytes -> int -> char -> int option

    index_from_opt s i c returns the index of the first occurrence of byte c in s after position i or None if c does not occur in s after position i. index_opt s c is equivalent to index_from_opt s 0 c.

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : bytes -> int -> char -> int

    rindex_from s i c returns the index of the last occurrence of byte c in s before position i+1. rindex s c is equivalent to rindex_from s (length s - 1) c.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • raises Not_found

      if c does not occur in s before position i+1.

    val rindex_from_opt : bytes -> int -> char -> int option

    rindex_from_opt s i c returns the index of the last occurrence of byte c in s before position i+1 or None if c does not occur in s before position i+1. rindex_opt s c is equivalent to rindex_from s (length s - 1) c.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val contains : bytes -> char -> bool

    contains s c tests if byte c appears in s.

    val contains_from : bytes -> int -> char -> bool

    contains_from s start c tests if byte c appears in s after position start. contains s c is equivalent to contains_from - s 0 c.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : bytes -> int -> char -> bool

    rcontains_from s stop c tests if byte c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val uppercase : bytes -> bytes

    Return a copy of the argument, with all lowercase letters translated to uppercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val lowercase : bytes -> bytes

    Return a copy of the argument, with all uppercase letters translated to lowercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val capitalize : bytes -> bytes

    Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uncapitalize : bytes -> bytes

    Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uppercase_ascii : bytes -> bytes

    Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val lowercase_ascii : bytes -> bytes

    Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.05.0
    val capitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val uncapitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

    • since 4.05.0
    type t = bytes

    An alias for the type of byte sequences.

    val compare : t -> t -> int

    The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

    val equal : t -> t -> bool

    The equality function for byte sequences.

    • since 4.05.0
    val starts_with : prefix:bytes -> bytes -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:bytes -> bytes -> bool

    ends_with suffix s is true if and only if s ends with suffix.

    • since 4.13.0

    Unsafe conversions (for advanced users)

    This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

    val unsafe_to_string : bytes -> string

    Unsafely convert a byte sequence into a string.

    To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

    • Unique ownership: the data may be accessed and mutated
    • Shared ownership: the data has several owners, that may only access it, not mutate it.

    Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

    unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

    There are two valid use-cases that respect this ownership discipline:

    1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

    let string_init len f : string =
    +    s 0 c.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : bytes -> int -> char -> bool

    rcontains_from s stop c tests if byte c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val uppercase_ascii : bytes -> bytes

    Return a copy of the argument, with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val lowercase_ascii : bytes -> bytes

    Return a copy of the argument, with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.05.0
    val capitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val uncapitalize_ascii : bytes -> bytes

    Return a copy of the argument, with the first character set to lowercase, using the US-ASCII character set.

    • since 4.05.0
    type t = bytes

    An alias for the type of byte sequences.

    val compare : t -> t -> int

    The comparison function for byte sequences, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Bytes to be passed as argument to the functors Set.Make and Map.Make.

    val equal : t -> t -> bool

    The equality function for byte sequences.

    • since 4.05.0
    val starts_with : prefix:bytes -> bytes -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:bytes -> bytes -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13.0

    Unsafe conversions (for advanced users)

    This section describes unsafe, low-level conversion functions between bytes and string. They do not copy the internal data; used improperly, they can break the immutability invariant on strings provided by the -safe-string option. They are available for expert library authors, but for most purposes you should use the always-correct to_string and of_string instead.

    val unsafe_to_string : bytes -> string

    Unsafely convert a byte sequence into a string.

    To reason about the use of unsafe_to_string, it is convenient to consider an "ownership" discipline. A piece of code that manipulates some data "owns" it; there are several disjoint ownership modes, including:

    • Unique ownership: the data may be accessed and mutated
    • Shared ownership: the data has several owners, that may only access it, not mutate it.

    Unique ownership is linear: passing the data to another piece of code means giving up ownership (we cannot write the data again). A unique owner may decide to make the data shared (giving up mutation rights on it), but shared data may not become uniquely-owned again.

    unsafe_to_string s can only be used when the caller owns the byte sequence s -- either uniquely or as shared immutable data. The caller gives up ownership of s, and gains ownership of the returned string.

    There are two valid use-cases that respect this ownership discipline:

    1. Creating a string by initializing and mutating a byte sequence that is never changed after initialization is performed.

    let string_init len f : string =
       let s = Bytes.create len in
       for i = 0 to len - 1 do Bytes.set s i (f i) done;
       Bytes.unsafe_to_string s

    This function is safe because the byte sequence s will never be accessed or mutated after unsafe_to_string is called. The string_init code gives up ownership of s, and returns the ownership of the resulting string to its caller.

    Note that it would be unsafe if s was passed as an additional parameter to the function f as it could escape this way and be mutated in the future -- string_init would give up ownership of s to pass it to f, and could not call unsafe_to_string safely.

    We have provided the String.init, String.map and String.mapi functions to cover most cases of building new strings. You should prefer those over to_string or unsafe_to_string whenever applicable.

    2. Temporarily giving ownership of a byte sequence to a function that expects a uniquely owned string and returns ownership back, so that we can mutate the sequence again after the call ended.

    let bytes_length (s : bytes) =
       String.length (Bytes.unsafe_to_string s)

    In this use-case, we do not promise that s will never be mutated after the call to bytes_length s. The String.length function temporarily borrows unique ownership of the byte sequence (and sees it as a string), but returns this ownership back to the caller, which may assume that s is still a valid byte sequence after the call. Note that this is only correct because we know that String.length does not capture its argument -- it could escape by a side-channel such as a memoization combinator.

    The caller may not mutate s while the string is borrowed (it has temporarily given up ownership). This affects concurrent programs, but also higher-order functions: if String.length returned a closure to be called later, s should not be mutated until this closure is fully applied and returns ownership.

    val unsafe_of_string : string -> bytes

    Unsafely convert a shared string to a byte sequence that should not be mutated.

    The same ownership discipline that makes unsafe_to_string correct applies to unsafe_of_string: you may use it if you were the owner of the string value, and you will own the return bytes in the same mode.

    In practice, unique ownership of string values is extremely difficult to reason about correctly. You should always assume strings are shared, never uniquely owned.

    For example, string literals are implicitly shared by the compiler, so you never uniquely own them.

    let incorrect = Bytes.unsafe_of_string "hello"
     let s = Bytes.of_string "hello"

    The first declaration is incorrect, because the string literal "hello" could be shared by the compiler with other parts of the program, and mutating incorrect is a bug. You must always use the second version, which performs a copy and is thus correct.

    Assuming unique ownership of strings that are not string literals, but are (partly) built from string literals, is also incorrect. For example, mutating unsafe_of_string ("foo" ^ s) could mutate the shared string "foo" -- assuming a rope-like representation of strings. More generally, functions operating on strings will assume shared ownership, they do not preserve unique ownership. It is thus incorrect to assume unique ownership of the result of unsafe_of_string.

    The only case we have reasonable confidence is safe is if the produced bytes is shared -- used as an immutable byte sequence. This is possibly useful for incremental migration of low-level programs that manipulate immutable sequences of bytes (for example Marshal.from_bytes) and previously used the string type for this purpose.

    val split_on_char : sep:char -> bytes -> bytes list

    split_on_char sep s returns the list of all (possibly empty) subsequences of s that are delimited by the sep character.

    The function's output is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a byte sequence equal to the input (Bytes.concat (Bytes.make 1 sep) - (Bytes.split_on_char sep s) = s).
    • No byte sequence in the result contains the sep character.
    • since 4.13.0

    Iterators

    val to_seq : t -> char Seq.t

    Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    Iterate on the string, in increasing order, yielding indices along chars

    • since 4.07
    val of_seq : char Seq.t -> t

    Create a string from the generator

    • since 4.07

    UTF codecs and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val set_utf_8_uchar : t -> int -> Uchar.t -> int

    set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val set_utf_16be_uchar : t -> int -> Uchar.t -> int

    set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val set_utf_16le_uchar : t -> int -> Uchar.t -> int

    set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Binary encoding/decoding of integers

    The functions in this section binary encode and decode integers to and from byte sequences.

    All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

    • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
    • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
    val get_uint8 : bytes -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

    • since 4.08
    val get_int8 : bytes -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_ne : bytes -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_be : bytes -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_le : bytes -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_ne : bytes -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_be : bytes -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_le : bytes -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int32_ne : bytes -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_be : bytes -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_le : bytes -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int64_ne : bytes -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_be : bytes -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_le : bytes -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

    • since 4.08
    val set_uint8 : bytes -> int -> int -> unit

    set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_int8 : bytes -> int -> int -> unit

    set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_ne : bytes -> int -> int -> unit

    set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_be : bytes -> int -> int -> unit

    set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_le : bytes -> int -> int -> unit

    set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_ne : bytes -> int -> int -> unit

    set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_be : bytes -> int -> int -> unit

    set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_le : bytes -> int -> int -> unit

    set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_ne : bytes -> int -> int32 -> unit

    set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_be : bytes -> int -> int32 -> unit

    set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_le : bytes -> int -> int32 -> unit

    set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_ne : bytes -> int -> int64 -> unit

    set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_be : bytes -> int -> int64 -> unit

    set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_le : bytes -> int -> int64 -> unit

    set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    \ No newline at end of file + (Bytes.split_on_char sep s) = s
    ).
  • No byte sequence in the result contains the sep character.
    • since 4.13.0

    Iterators

    val to_seq : t -> char Seq.t

    Iterate on the string, in increasing index order. Modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    Iterate on the string, in increasing order, yielding indices along chars

    • since 4.07
    val of_seq : char Seq.t -> t

    Create a string from the generator

    • since 4.07

    UTF codecs and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val set_utf_8_uchar : t -> int -> Uchar.t -> int

    set_utf_8_uchar b i u UTF-8 encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val set_utf_16be_uchar : t -> int -> Uchar.t -> int

    set_utf_16be_uchar b i u UTF-16BE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val set_utf_16le_uchar : t -> int -> Uchar.t -> int

    set_utf_16le_uchar b i u UTF-16LE encodes u at index i in b and returns the number of bytes n that were written starting at i. If n is 0 there was not enough space to encode u at i and b was left untouched. Otherwise a new character can be encoded at i + n.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Binary encoding/decoding of integers

    The functions in this section binary encode and decode integers to and from byte sequences.

    All following functions raise Invalid_argument if the space needed at index i to decode or encode the integer is not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are handled as follows:

    • Functions that decode signed (resp. unsigned) 8-bit or 16-bit integers represented by int values sign-extend (resp. zero-extend) their result.
    • Functions that encode 8-bit or 16-bit integers represented by int values truncate their input to their least significant bytes.
    val get_uint8 : bytes -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at byte index i.

    • since 4.08
    val get_int8 : bytes -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_ne : bytes -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_be : bytes -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_uint16_le : bytes -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_ne : bytes -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_be : bytes -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int16_le : bytes -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at byte index i.

    • since 4.08
    val get_int32_ne : bytes -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_be : bytes -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int32_le : bytes -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at byte index i.

    • since 4.08
    val get_int64_ne : bytes -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_be : bytes -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at byte index i.

    • since 4.08
    val get_int64_le : bytes -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at byte index i.

    • since 4.08
    val set_uint8 : bytes -> int -> int -> unit

    set_uint8 b i v sets b's unsigned 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_int8 : bytes -> int -> int -> unit

    set_int8 b i v sets b's signed 8-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_ne : bytes -> int -> int -> unit

    set_uint16_ne b i v sets b's native-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_be : bytes -> int -> int -> unit

    set_uint16_be b i v sets b's big-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_uint16_le : bytes -> int -> int -> unit

    set_uint16_le b i v sets b's little-endian unsigned 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_ne : bytes -> int -> int -> unit

    set_int16_ne b i v sets b's native-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_be : bytes -> int -> int -> unit

    set_int16_be b i v sets b's big-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int16_le : bytes -> int -> int -> unit

    set_int16_le b i v sets b's little-endian signed 16-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_ne : bytes -> int -> int32 -> unit

    set_int32_ne b i v sets b's native-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_be : bytes -> int -> int32 -> unit

    set_int32_be b i v sets b's big-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int32_le : bytes -> int -> int32 -> unit

    set_int32_le b i v sets b's little-endian 32-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_ne : bytes -> int -> int64 -> unit

    set_int64_ne b i v sets b's native-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_be : bytes -> int -> int64 -> unit

    set_int64_be b i v sets b's big-endian 64-bit integer starting at byte index i to v.

    • since 4.08
    val set_int64_le : bytes -> int -> int64 -> unit

    set_int64_le b i v sets b's little-endian 64-bit integer starting at byte index i to v.

    • since 4.08

    Byte sequences and concurrency safety

    Care must be taken when concurrently accessing byte sequences from multiple domains: accessing a byte sequence will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

    Atomicity

    Every byte sequence operation that accesses more than one byte is not atomic. This includes iteration and scanning.

    For example, consider the following program:

    let size = 100_000_000
    +let b = Bytes.make size  ' '
    +let update b f ()  =
    +  Bytes.iteri (fun i x -> Bytes.set b i (Char.chr (f (Char.code x)))) b
    +let d1 = Domain.spawn (update b (fun x -> x + 1))
    +let d2 = Domain.spawn (update b (fun x -> 2 * x + 1))
    +let () = Domain.join d1; Domain.join d2

    the bytes sequence b may contain a non-deterministic mixture of '!', 'A', 'B', and 'C' values.

    After executing this code, each byte of the sequence b is either '!', 'A', 'B', or 'C'. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

    Data races

    If two domains only access disjoint parts of a byte sequence, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

    A data race is said to occur when two domains access the same byte without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

    Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the elements of the sequence.

    Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location.

    Mixed-size accesses

    Another subtle point is that if a data race involves mixed-size writes and reads to the same location, the order in which those writes and reads are observed by domains is not specified. For instance, the following code write sequentially a 32-bit integer and a char to the same index

    let b = Bytes.make 10 '\000'
    +let d1 = Domain.spawn (fun () -> Bytes.set_int32_ne b 0 100; b.[0] <- 'd' )

    In this situation, a domain that observes the write of 'd' to b.0 is not guaranteed to also observe the write to indices 1, 2, or 3.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Char/index.html b/dev/ocaml/Stdlib/Char/index.html index 67dd6884..452fa2b1 100644 --- a/dev/ocaml/Stdlib/Char/index.html +++ b/dev/ocaml/Stdlib/Char/index.html @@ -1,2 +1,2 @@ -Char (ocaml.Stdlib.Char)

    Module Stdlib.Char

    Character operations.

    val code : char -> int

    Return the ASCII code of the argument.

    val chr : int -> char

    Return the character with the given ASCII code.

    • raises Invalid_argument

      if the argument is outside the range 0--255.

    val escaped : char -> string

    Return a string representing the given character, with special characters escaped following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash, double-quote, and single-quote.

    val lowercase : char -> char

    Convert the given character to its equivalent lowercase character, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uppercase : char -> char

    Convert the given character to its equivalent uppercase character, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val lowercase_ascii : char -> char

    Convert the given character to its equivalent lowercase character, using the US-ASCII character set.

    • since 4.03.0
    val uppercase_ascii : char -> char

    Convert the given character to its equivalent uppercase character, using the US-ASCII character set.

    • since 4.03.0
    type t = char

    An alias for the type of characters.

    val compare : t -> t -> int

    The comparison function for characters, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Char to be passed as argument to the functors Set.Make and Map.Make.

    val equal : t -> t -> bool

    The equal function for chars.

    • since 4.03.0
    \ No newline at end of file +Char (ocaml.Stdlib.Char)

    Module Stdlib.Char

    Character operations.

    val code : char -> int

    Return the ASCII code of the argument.

    val chr : int -> char

    Return the character with the given ASCII code.

    • raises Invalid_argument

      if the argument is outside the range 0--255.

    val escaped : char -> string

    Return a string representing the given character, with special characters escaped following the lexical conventions of OCaml. All characters outside the ASCII printable range (32..126) are escaped, as well as backslash, double-quote, and single-quote.

    val lowercase_ascii : char -> char

    Convert the given character to its equivalent lowercase character, using the US-ASCII character set.

    • since 4.03.0
    val uppercase_ascii : char -> char

    Convert the given character to its equivalent uppercase character, using the US-ASCII character set.

    • since 4.03.0
    type t = char

    An alias for the type of characters.

    val compare : t -> t -> int

    The comparison function for characters, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Char to be passed as argument to the functors Set.Make and Map.Make.

    val equal : t -> t -> bool

    The equal function for chars.

    • since 4.03.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Condition/index.html b/dev/ocaml/Stdlib/Condition/index.html new file mode 100644 index 00000000..39abfea7 --- /dev/null +++ b/dev/ocaml/Stdlib/Condition/index.html @@ -0,0 +1,31 @@ + +Condition (ocaml.Stdlib.Condition)

    Module Stdlib.Condition

    Condition variables.

    Condition variables are useful when several threads wish to access a shared data structure that is protected by a mutex (a mutual exclusion lock).

    A condition variable is a communication channel. On the receiver side, one or more threads can indicate that they wish to wait for a certain property to become true. On the sender side, a thread can signal that this property has become true, causing one (or more) waiting threads to be woken up.

    For instance, in the implementation of a queue data structure, if a thread that wishes to extract an element finds that the queue is currently empty, then this thread waits for the queue to become nonempty. A thread that inserts an element into the queue signals that the queue has become nonempty. A condition variable is used for this purpose. This communication channel conveys the information that the property "the queue is nonempty" is true, or more accurately, may be true. (We explain below why the receiver of a signal cannot be certain that the property holds.)

    To continue the example of the queue, assuming that the queue has a fixed maximum capacity, then a thread that wishes to insert an element may find that the queue is full. Then, this thread must wait for the queue to become not full, and a thread that extracts an element of the queue signals that the queue has become not full. Another condition variable is used for this purpose.

    In short, a condition variable c is used to convey the information that a certain property P about a shared data structure D, protected by a mutex m, may be true.

    Condition variables provide an efficient alternative to busy-waiting. When one wishes to wait for the property P to be true, instead of writing a busy-waiting loop:

    Mutex.lock m;
    +while not P do
    +  Mutex.unlock m; Mutex.lock m
    +done;
    +<update the data structure>;
    +Mutex.unlock m

    one uses wait in the body of the loop, as follows:

    Mutex.lock m;
    +while not P do
    +  Condition.wait c m
    +done;
    +<update the data structure>;
    +Mutex.unlock m

    The busy-waiting loop is inefficient because the waiting thread consumes processing time and creates contention of the mutex m. Calling wait allows the waiting thread to be suspended, so it does not consume any computing resources while waiting.

    With a condition variable c, exactly one mutex m is associated. This association is implicit: the mutex m is not explicitly passed as an argument to create. It is up to the programmer to know, for each condition variable c, which is the associated mutex m.

    With a mutex m, several condition variables can be associated. In the example of the bounded queue, one condition variable is used to indicate that the queue is nonempty, and another condition variable is used to indicate that the queue is not full.

    With a condition variable c, exactly one logical property P should be associated. Examples of such properties include "the queue is nonempty" and "the queue is not full". It is up to the programmer to keep track, for each condition variable, of the corresponding property P. A signal is sent on the condition variable c as an indication that the property P is true, or may be true. On the receiving end, however, a thread that is woken up cannot assume that P is true; after a call to wait terminates, one must explicitly test whether P is true. There are several reasons why this is so. One reason is that, between the moment when the signal is sent and the moment when a waiting thread receives the signal and is scheduled, the property P may be falsified by some other thread that is able to acquire the mutex m and alter the data structure D. Another reason is that spurious wakeups may occur: a waiting thread can be woken up even if no signal was sent.

    Here is a complete example, where a mutex protects a sequential unbounded queue, and where a condition variable is used to signal that the queue is nonempty.

    type 'a safe_queue =
    +  { queue : 'a Queue.t; mutex : Mutex.t; nonempty : Condition.t }
    +
    +let create () =
    +  { queue = Queue.create(); mutex = Mutex.create();
    +    nonempty = Condition.create() }
    +
    +let add v q =
    +  Mutex.lock q.mutex;
    +  let was_empty = Queue.is_empty q.queue in
    +  Queue.add v q.queue;
    +  if was_empty then Condition.broadcast q.nonempty;
    +  Mutex.unlock q.mutex
    +
    +let take q =
    +  Mutex.lock q.mutex;
    +  while Queue.is_empty q.queue do Condition.wait q.nonempty q.mutex done;
    +  let v = Queue.take q.queue in (* cannot fail since queue is nonempty *)
    +  Mutex.unlock q.mutex;
    +  v

    Because the call to broadcast takes place inside the critical section, the following property holds whenever the mutex is unlocked: if the queue is nonempty, then no thread is waiting, or, in other words, if some thread is waiting, then the queue must be empty. This is a desirable property: if a thread that attempts to execute a take operation could remain suspended even though the queue is nonempty, that would be a problematic situation, known as a deadlock.

    type t

    The type of condition variables.

    val create : unit -> t

    create() creates and returns a new condition variable. This condition variable should be associated (in the programmer's mind) with a certain mutex m and with a certain property P of the data structure that is protected by the mutex m.

    val wait : t -> Mutex.t -> unit

    The call wait c m is permitted only if m is the mutex associated with the condition variable c, and only if m is currently locked. This call atomically unlocks the mutex m and suspends the current thread on the condition variable c. This thread can later be woken up after the condition variable c has been signaled via signal or broadcast; however, it can also be woken up for no reason. The mutex m is locked again before wait returns. One cannot assume that the property P associated with the condition variable c holds when wait returns; one must explicitly test whether P holds after calling wait.

    val signal : t -> unit

    signal c wakes up one of the threads waiting on the condition variable c, if there is one. If there is none, this call has no effect.

    It is recommended to call signal c inside a critical section, that is, while the mutex m associated with c is locked.

    val broadcast : t -> unit

    broadcast c wakes up all threads waiting on the condition variable c. If there are none, this call has no effect.

    It is recommended to call broadcast c inside a critical section, that is, while the mutex m associated with c is locked.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Domain/DLS/index.html b/dev/ocaml/Stdlib/Domain/DLS/index.html new file mode 100644 index 00000000..18477c72 --- /dev/null +++ b/dev/ocaml/Stdlib/Domain/DLS/index.html @@ -0,0 +1,2 @@ + +DLS (ocaml.Stdlib.Domain.DLS)

    Module Domain.DLS

    Domain-local Storage

    type 'a key

    Type of a DLS key

    val new_key : ?split_from_parent:('a -> 'a) -> (unit -> 'a) -> 'a key

    new_key f returns a new key bound to initialiser f for accessing domain-local variables.

    If split_from_parent is provided, spawning a domain will derive the child value (for this key) from the parent value.

    Note that the split_from_parent call is computed in the parent domain, and is always computed regardless of whether the child domain will use it. If the splitting function is expensive or requires client-side computation, consider using 'a Lazy.t key.

    val get : 'a key -> 'a

    get k returns v if a value v is associated to the key k on the calling domain's domain-local state. Sets k's value with its initialiser and returns it otherwise.

    val set : 'a key -> 'a -> unit

    set k v updates the calling domain's domain-local state to associate the key k with value v. It overwrites any previous values associated to k, which cannot be restored later.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Domain/index.html b/dev/ocaml/Stdlib/Domain/index.html new file mode 100644 index 00000000..c9aacef2 --- /dev/null +++ b/dev/ocaml/Stdlib/Domain/index.html @@ -0,0 +1,5 @@ + +Domain (ocaml.Stdlib.Domain)

    Module Stdlib.Domain

    • alert unstable The Domain interface may change in incompatible ways in the future.

    Domains.

    See 'Parallel programming' chapter in the manual.

    • since 5.0
    • alert unstable The Domain interface may change in incompatible ways in the future.
    type !'a t

    A domain of type 'a t runs independently, eventually producing a result of type 'a, or an exception

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

    spawn f creates a new domain that runs in parallel with the current domain.

    val join : 'a t -> 'a

    join d blocks until domain d runs to completion. If d results in a value, then that is returned by join d. If d raises an uncaught exception, then that is re-raised by join d.

    type id = private int

    Domains have unique integer identifiers

    val get_id : 'a t -> id

    get_id d returns the identifier of the domain d

    val self : unit -> id

    self () is the identifier of the currently running domain

    val before_first_spawn : (unit -> unit) -> unit

    before_first_spawn f registers f to be called before the first domain is spawned by the program. The functions registered with before_first_spawn are called on the main (initial) domain. The functions registered with before_first_spawn are called in 'first in, first out' order: the oldest function added with before_first_spawn is called first.

    • raises Invalid_argument

      if the program has already spawned a domain.

    val at_exit : (unit -> unit) -> unit

    at_exit f registers f to be called when the current domain exits. Note that at_exit callbacks are domain-local and only apply to the calling domain. The registered functions are called in 'last in, first out' order: the function most recently added with at_exit is called first. An example:

    let temp_file_key = Domain.DLS.new_key (fun _ ->
    +  let tmp = snd (Filename.open_temp_file "" "") in
    +  Domain.at_exit (fun () -> close_out_noerr tmp);
    +  tmp)

    The snippet above creates a key that when retrieved for the first time will open a temporary file and register an at_exit callback to close it, thus guaranteeing the descriptor is not leaked in case the current domain exits.

    val cpu_relax : unit -> unit

    If busy-waiting, calling cpu_relax () between iterations will improve performance on some CPU architectures

    val is_main_domain : unit -> bool

    is_main_domain () returns true if called from the initial domain.

    The recommended maximum number of domains which should be running simultaneously (including domains already running).

    The value returned is at least 1.

    module DLS : sig ... end

    Domain-local Storage

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Effect/Deep/index.html b/dev/ocaml/Stdlib/Effect/Deep/index.html new file mode 100644 index 00000000..5b6dcec5 --- /dev/null +++ b/dev/ocaml/Stdlib/Effect/Deep/index.html @@ -0,0 +1,6 @@ + +Deep (ocaml.Stdlib.Effect.Deep)

    Module Effect.Deep

    Deep handlers

    type ('a, 'b) continuation

    ('a,'b) continuation is a delimited continuation that expects a 'a value and returns a 'b value.

    val continue : ('a, 'b) continuation -> 'a -> 'b

    continue k x resumes the continuation k by passing x to k.

    • raises Continuation_already_resumed

      if the continuation has already been resumed.

    val discontinue : ('a, 'b) continuation -> exn -> 'b

    discontinue k e resumes the continuation k by raising the exception e in k.

    • raises Continuation_already_resumed

      if the continuation has already been resumed.

    val discontinue_with_backtrace : + ('a, 'b) continuation -> + exn -> + Printexc.raw_backtrace -> + 'b

    discontinue_with_backtrace k e bt resumes the continuation k by raising the exception e in k using bt as the origin for the exception.

    • raises Continuation_already_resumed

      if the continuation has already been resumed.

    type ('a, 'b) handler = {
    1. retc : 'a -> 'b;
    2. exnc : exn -> 'b;
    3. effc : 'c. 'c t -> (('c, 'b) continuation -> 'b) option;
    }

    ('a,'b) handler is a handler record with three fields -- retc is the value handler, exnc handles exceptions, and effc handles the effects performed by the computation enclosed by the handler.

    val match_with : ('c -> 'a) -> 'c -> ('a, 'b) handler -> 'b

    match_with f v h runs the computation f v in the handler h.

    type 'a effect_handler = {
    1. effc : 'b. 'b t -> (('b, 'a) continuation -> 'a) option;
    }

    'a effect_handler is a deep handler with an identity value handler fun x -> x and an exception handler that raises any exception fun e -> raise e.

    val try_with : ('b -> 'a) -> 'b -> 'a effect_handler -> 'a

    try_with f v h runs the computation f v under the handler h.

    val get_callstack : ('a, 'b) continuation -> int -> Printexc.raw_backtrace

    get_callstack c n returns a description of the top of the call stack on the continuation c, with at most n entries.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Effect/Shallow/index.html b/dev/ocaml/Stdlib/Effect/Shallow/index.html new file mode 100644 index 00000000..9fa4b424 --- /dev/null +++ b/dev/ocaml/Stdlib/Effect/Shallow/index.html @@ -0,0 +1,7 @@ + +Shallow (ocaml.Stdlib.Effect.Shallow)

    Module Effect.Shallow

    type ('a, 'b) continuation

    ('a,'b) continuation is a delimited continuation that expects a 'a value and returns a 'b value.

    val fiber : ('a -> 'b) -> ('a, 'b) continuation

    fiber f constructs a continuation that runs the computation f.

    type ('a, 'b) handler = {
    1. retc : 'a -> 'b;
    2. exnc : exn -> 'b;
    3. effc : 'c. 'c t -> (('c, 'a) continuation -> 'b) option;
    }

    ('a,'b) handler is a handler record with three fields -- retc is the value handler, exnc handles exceptions, and effc handles the effects performed by the computation enclosed by the handler.

    val continue_with : ('c, 'a) continuation -> 'c -> ('a, 'b) handler -> 'b

    continue_with k v h resumes the continuation k with value v with the handler h.

    • raises Continuation_already_resumed

      if the continuation has already been resumed.

    val discontinue_with : ('c, 'a) continuation -> exn -> ('a, 'b) handler -> 'b

    discontinue_with k e h resumes the continuation k by raising the exception e with the handler h.

    • raises Continuation_already_resumed

      if the continuation has already been resumed.

    val discontinue_with_backtrace : + ('a, 'b) continuation -> + exn -> + Printexc.raw_backtrace -> + ('b, 'c) handler -> + 'c

    discontinue_with k e bt h resumes the continuation k by raising the exception e with the handler h using the raw backtrace bt as the origin of the exception.

    • raises Continuation_already_resumed

      if the continuation has already been resumed.

    val get_callstack : ('a, 'b) continuation -> int -> Printexc.raw_backtrace

    get_callstack c n returns a description of the top of the call stack on the continuation c, with at most n entries.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Effect/index.html b/dev/ocaml/Stdlib/Effect/index.html new file mode 100644 index 00000000..78c560c2 --- /dev/null +++ b/dev/ocaml/Stdlib/Effect/index.html @@ -0,0 +1,2 @@ + +Effect (ocaml.Stdlib.Effect)

    Module Stdlib.Effect

    • alert unstable The Effect interface may change in incompatible ways in the future.

    Effects.

    See 'Language extensions/Effect handlers' section in the manual.

    • since 5.0
    • alert unstable The Effect interface may change in incompatible ways in the future.
    type _ t = ..

    The type of effects.

    exception Unhandled : 'a t -> exn

    Unhandled e is raised when effect e is performed and there is no handler for it.

    exception Continuation_already_resumed

    Exception raised when a continuation is continued or discontinued more than once.

    val perform : 'a t -> 'a

    perform e performs an effect e.

    • raises Unhandled

      if there is no handler for e.

    module Deep : sig ... end

    Deep handlers

    module Shallow : sig ... end
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/argument-1-H/index.html b/dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/argument-1-H/index.html deleted file mode 100644 index af652a69..00000000 --- a/dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/argument-1-H/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -H (ocaml.Stdlib.Ephemeron.GenHashTable.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    keys

    type 'a container

    contains keys and the associated data

    val hash : int -> t -> int
    val equal : 'a container -> t -> equal

    equality predicate used to compare a key with the one in a container. Can return EDead if the keys in the container are dead

    val create : t -> 'a -> 'a container

    create key data creates a container from some initials keys and one data

    val get_key : 'a container -> t option

    get_key cont returns the keys if they are all alive

    val get_data : 'a container -> 'a option

    get_data cont returns the data if it is alive

    val set_key_data : 'a container -> t -> 'a -> unit

    set_key_data cont modifies the key and data

    val check_key : 'a container -> bool

    check_key cont checks if all the keys contained in the data are alive

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/index.html b/dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/index.html deleted file mode 100644 index fa1f7f2d..00000000 --- a/dev/ocaml/Stdlib/Ephemeron/GenHashTable/MakeSeeded/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -MakeSeeded (ocaml.Stdlib.Ephemeron.GenHashTable.MakeSeeded)

    Module GenHashTable.MakeSeeded

    Functor building an implementation of an hash table that use the container for keeping the information given

    Parameters

    module H : sig ... end

    Signature

    type key = H.t
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/GenHashTable/index.html b/dev/ocaml/Stdlib/Ephemeron/GenHashTable/index.html deleted file mode 100644 index 47dc148a..00000000 --- a/dev/ocaml/Stdlib/Ephemeron/GenHashTable/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -GenHashTable (ocaml.Stdlib.Ephemeron.GenHashTable)

    Module Ephemeron.GenHashTable

    Hash tables on generic containers with notion of death and aliveness.

    Define a hash table on generic containers which have a notion of "death" and aliveness. If a binding is dead the hash table can automatically remove it.

    • alert old_ephemeron_api This module won't be available in 5.0
    type equal =
    1. | ETrue
    2. | EFalse
    3. | EDead
      (*

      the container is dead

      *)
    module MakeSeeded (H : sig ... end) : SeededS with type key = H.t

    Functor building an implementation of an hash table that use the container for keeping the information given

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K1/Make/index.html b/dev/ocaml/Stdlib/Ephemeron/K1/Make/index.html index 756eb776..6513ffc2 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K1/Make/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K1/Make/index.html @@ -1,2 +1,2 @@ -Make (ocaml.Stdlib.Ephemeron.K1.Make)

    Module K1.Make

    Functor building an implementation of a weak hash table

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    Moreover, the table shouldn't be modified during a call to iter. Use filter_map_inplace in this case.

    Parameters

    Signature

    type key = H.t
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +Make (ocaml.Stdlib.Ephemeron.K1.Make)

    Module K1.Make

    Functor building an implementation of a weak hash table

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    Parameters

    Signature

    type key = H.t
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/argument-1-H/index.html b/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/argument-1-H/index.html index f9e861f2..4ea2066d 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/argument-1-H/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/argument-1-H/index.html @@ -1,2 +1,2 @@ -H (ocaml.Stdlib.Ephemeron.K1.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +H (ocaml.Stdlib.Ephemeron.K1.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/index.html b/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/index.html index 4f2fa564..d97caa75 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K1/MakeSeeded/index.html @@ -1,2 +1,2 @@ -MakeSeeded (ocaml.Stdlib.Ephemeron.K1.MakeSeeded)

    Module K1.MakeSeeded

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    Parameters

    Signature

    type key = H.t
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +MakeSeeded (ocaml.Stdlib.Ephemeron.K1.MakeSeeded)

    Module K1.MakeSeeded

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    Parameters

    Signature

    type key = H.t
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K1/index.html b/dev/ocaml/Stdlib/Ephemeron/K1/index.html index 75ecc0f3..49acce57 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K1/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K1/index.html @@ -1,2 +1,2 @@ -K1 (ocaml.Stdlib.Ephemeron.K1)

    Module Ephemeron.K1

    Ephemerons with one key.

    type ('k, 'd) t

    an ephemeron with one key

    val create : unit -> ('k, 'd) t

    Ephemeron.K1.create () creates an ephemeron with one key. The data and the key are empty

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key : ('k, 'd) t -> 'k option

    Ephemeron.K1.get_key eph returns None if the key of eph is empty, Some x (where x is the key) if it is full.

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key_copy : ('k, 'd) t -> 'k option

    Ephemeron.K1.get_key_copy eph returns None if the key of eph is empty, Some x (where x is a (shallow) copy of the key) if it is full. This function has the same GC friendliness as Weak.get_copy

    If the element is a custom block it is not copied.

    • alert old_ephemeron_api This function won't be available in 5.0
    val set_key : ('k, 'd) t -> 'k -> unit

    Ephemeron.K1.set_key eph el sets the key of eph to be a (full) key to el

    • alert old_ephemeron_api This function won't be available in 5.0
    val unset_key : ('k, 'd) t -> unit

    Ephemeron.K1.unset_key eph el sets the key of eph to be an empty key. Since there is only one key, the ephemeron starts behaving like a reference on the data.

    • alert old_ephemeron_api This function won't be available in 5.0
    val check_key : ('k, 'd) t -> bool

    Ephemeron.K1.check_key eph returns true if the key of the eph is full, false if it is empty. Note that even if Ephemeron.K1.check_key eph returns true, a subsequent Ephemeron.K1.get_keyeph can return None.

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_key : ('k, _) t -> ('k, _) t -> unit

    Ephemeron.K1.blit_key eph1 eph2 sets the key of eph2 with the key of eph1. Contrary to using Ephemeron.K1.get_key followed by Ephemeron.K1.set_key or Ephemeron.K1.unset_key this function does not prevent the incremental GC from erasing the value in its current cycle.

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_data : ('k, 'd) t -> 'd option

    Ephemeron.K1.get_data eph returns None if the data of eph is empty, Some x (where x is the data) if it is full.

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_data_copy : ('k, 'd) t -> 'd option

    Ephemeron.K1.get_data_copy eph returns None if the data of eph is empty, Some x (where x is a (shallow) copy of the data) if it is full. This function has the same GC friendliness as Weak.get_copy

    If the element is a custom block it is not copied.

    • alert old_ephemeron_api This function won't be available in 5.0
    val set_data : ('k, 'd) t -> 'd -> unit

    Ephemeron.K1.set_data eph el sets the data of eph to be a (full) data to el

    • alert old_ephemeron_api This function won't be available in 5.0
    val unset_data : ('k, 'd) t -> unit

    Ephemeron.K1.unset_data eph el sets the key of eph to be an empty key. The ephemeron starts behaving like a weak pointer.

    • alert old_ephemeron_api This function won't be available in 5.0
    val check_data : ('k, 'd) t -> bool

    Ephemeron.K1.check_data eph returns true if the data of the eph is full, false if it is empty. Note that even if Ephemeron.K1.check_data eph returns true, a subsequent Ephemeron.K1.get_dataeph can return None.

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_data : (_, 'd) t -> (_, 'd) t -> unit

    Ephemeron.K1.blit_data eph1 eph2 sets the data of eph2 with the data of eph1. Contrary to using Ephemeron.K1.get_data followed by Ephemeron.K1.set_data or Ephemeron.K1.unset_data this function does not prevent the incremental GC from erasing the value in its current cycle.

    • alert old_ephemeron_api This function won't be available in 5.0
    val make : 'k -> 'd -> ('k, 'd) t

    Ephemeron.K1.make k d creates an ephemeron with key k and data d.

    val query : ('k, 'd) t -> 'k -> 'd option

    Ephemeron.K1.query eph key returns Some x (where x is the ephemeron's data) if key is physically equal to eph's key, and None if eph is empty or key is not equal to eph's key.

    module Make (H : Hashtbl.HashedType) : S with type key = H.t

    Functor building an implementation of a weak hash table

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    module Bucket : sig ... end
    \ No newline at end of file +K1 (ocaml.Stdlib.Ephemeron.K1)

    Module Ephemeron.K1

    Ephemerons with one key.

    type ('k, 'd) t

    an ephemeron with one key

    val make : 'k -> 'd -> ('k, 'd) t

    Ephemeron.K1.make k d creates an ephemeron with key k and data d.

    val query : ('k, 'd) t -> 'k -> 'd option

    Ephemeron.K1.query eph key returns Some x (where x is the ephemeron's data) if key is physically equal to eph's key, and None if eph is empty or key is not equal to eph's key.

    module Make (H : Hashtbl.HashedType) : S with type key = H.t

    Functor building an implementation of a weak hash table

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    module Bucket : sig ... end
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K2/Make/index.html b/dev/ocaml/Stdlib/Ephemeron/K2/Make/index.html index 09d88c05..7bec78c0 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K2/Make/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K2/Make/index.html @@ -1,2 +1,2 @@ -Make (ocaml.Stdlib.Ephemeron.K2.Make)

    Module K2.Make

    Functor building an implementation of a weak hash table

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    Moreover, the table shouldn't be modified during a call to iter. Use filter_map_inplace in this case.

    Parameters

    Signature

    type key = H1.t * H2.t
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +Make (ocaml.Stdlib.Ephemeron.K2.Make)

    Module K2.Make

    Functor building an implementation of a weak hash table

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    Parameters

    Signature

    type key = H1.t * H2.t
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-1-H1/index.html b/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-1-H1/index.html index 3f4d6b62..55ffb3ff 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-1-H1/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-1-H1/index.html @@ -1,2 +1,2 @@ -H1 (ocaml.Stdlib.Ephemeron.K2.MakeSeeded.H1)

    Parameter MakeSeeded.H1

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +H1 (ocaml.Stdlib.Ephemeron.K2.MakeSeeded.H1)

    Parameter MakeSeeded.H1

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-2-H2/index.html b/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-2-H2/index.html index 60e77ad6..004f0c23 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-2-H2/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/argument-2-H2/index.html @@ -1,2 +1,2 @@ -H2 (ocaml.Stdlib.Ephemeron.K2.MakeSeeded.H2)

    Parameter MakeSeeded.H2

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +H2 (ocaml.Stdlib.Ephemeron.K2.MakeSeeded.H2)

    Parameter MakeSeeded.H2

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/index.html b/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/index.html index 2aca5b21..25936bf6 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K2/MakeSeeded/index.html @@ -1,2 +1,2 @@ -MakeSeeded (ocaml.Stdlib.Ephemeron.K2.MakeSeeded)

    Module K2.MakeSeeded

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    Parameters

    Signature

    type key = H1.t * H2.t
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +MakeSeeded (ocaml.Stdlib.Ephemeron.K2.MakeSeeded)

    Module K2.MakeSeeded

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    Parameters

    Signature

    type key = H1.t * H2.t
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/K2/index.html b/dev/ocaml/Stdlib/Ephemeron/K2/index.html index 48aa0d95..857afa25 100644 --- a/dev/ocaml/Stdlib/Ephemeron/K2/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/K2/index.html @@ -1,5 +1,5 @@ -K2 (ocaml.Stdlib.Ephemeron.K2)

    Module Ephemeron.K2

    Ephemerons with two keys.

    type ('k1, 'k2, 'd) t

    an ephemeron with two keys

    val create : unit -> ('k1, 'k2, 'd) t

    Same as Ephemeron.K1.create

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key1 : ('k1, 'k2, 'd) t -> 'k1 option

    Same as Ephemeron.K1.get_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key1_copy : ('k1, 'k2, 'd) t -> 'k1 option

    Same as Ephemeron.K1.get_key_copy

    • alert old_ephemeron_api This function won't be available in 5.0
    val set_key1 : ('k1, 'k2, 'd) t -> 'k1 -> unit

    Same as Ephemeron.K1.set_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val unset_key1 : ('k1, 'k2, 'd) t -> unit

    Same as Ephemeron.K1.unset_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val check_key1 : ('k1, 'k2, 'd) t -> bool

    Same as Ephemeron.K1.check_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key2 : ('k1, 'k2, 'd) t -> 'k2 option

    Same as Ephemeron.K1.get_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key2_copy : ('k1, 'k2, 'd) t -> 'k2 option

    Same as Ephemeron.K1.get_key_copy

    • alert old_ephemeron_api This function won't be available in 5.0
    val set_key2 : ('k1, 'k2, 'd) t -> 'k2 -> unit

    Same as Ephemeron.K1.set_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val unset_key2 : ('k1, 'k2, 'd) t -> unit

    Same as Ephemeron.K1.unset_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val check_key2 : ('k1, 'k2, 'd) t -> bool

    Same as Ephemeron.K1.check_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_key1 : ('k1, _, _) t -> ('k1, _, _) t -> unit

    Same as Ephemeron.K1.blit_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_key2 : (_, 'k2, _) t -> (_, 'k2, _) t -> unit

    Same as Ephemeron.K1.blit_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_key12 : ('k1, 'k2, _) t -> ('k1, 'k2, _) t -> unit

    Same as Ephemeron.K1.blit_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_data : ('k1, 'k2, 'd) t -> 'd option

    Same as Ephemeron.K1.get_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_data_copy : ('k1, 'k2, 'd) t -> 'd option

    Same as Ephemeron.K1.get_data_copy

    • alert old_ephemeron_api This function won't be available in 5.0
    val set_data : ('k1, 'k2, 'd) t -> 'd -> unit

    Same as Ephemeron.K1.set_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val unset_data : ('k1, 'k2, 'd) t -> unit

    Same as Ephemeron.K1.unset_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val check_data : ('k1, 'k2, 'd) t -> bool

    Same as Ephemeron.K1.check_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_data : ('k1, 'k2, 'd) t -> ('k1, 'k2, 'd) t -> unit

    Same as Ephemeron.K1.blit_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val make : 'k1 -> 'k2 -> 'd -> ('k1, 'k2, 'd) t
    val query : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option
    module Make +K2 (ocaml.Stdlib.Ephemeron.K2)

    Module Ephemeron.K2

    Ephemerons with two keys.

    type ('k1, 'k2, 'd) t

    an ephemeron with two keys

    val make : 'k1 -> 'k2 -> 'd -> ('k1, 'k2, 'd) t
    val query : ('k1, 'k2, 'd) t -> 'k1 -> 'k2 -> 'd option
    module Make (H1 : Hashtbl.HashedType) (H2 : Hashtbl.HashedType) : S with type key = H1.t * H2.t

    Functor building an implementation of a weak hash table

    module MakeSeeded diff --git a/dev/ocaml/Stdlib/Ephemeron/Kn/Make/index.html b/dev/ocaml/Stdlib/Ephemeron/Kn/Make/index.html index 40bcfdea..2157f23b 100644 --- a/dev/ocaml/Stdlib/Ephemeron/Kn/Make/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/Kn/Make/index.html @@ -1,2 +1,2 @@ -Make (ocaml.Stdlib.Ephemeron.Kn.Make)

    Module Kn.Make

    Functor building an implementation of a weak hash table

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    Moreover, the table shouldn't be modified during a call to iter. Use filter_map_inplace in this case.

    Parameters

    Signature

    type key = H.t array
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +Make (ocaml.Stdlib.Ephemeron.Kn.Make)

    Module Kn.Make

    Functor building an implementation of a weak hash table

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    Parameters

    Signature

    type key = H.t array
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/argument-1-H/index.html b/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/argument-1-H/index.html index 784a0eac..dfb0c25c 100644 --- a/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/argument-1-H/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/argument-1-H/index.html @@ -1,2 +1,2 @@ -H (ocaml.Stdlib.Ephemeron.Kn.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +H (ocaml.Stdlib.Ephemeron.Kn.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/index.html b/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/index.html index 98088356..3e554fdf 100644 --- a/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/Kn/MakeSeeded/index.html @@ -1,2 +1,2 @@ -MakeSeeded (ocaml.Stdlib.Ephemeron.Kn.MakeSeeded)

    Module Kn.MakeSeeded

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    Parameters

    Signature

    type key = H.t array
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +MakeSeeded (ocaml.Stdlib.Ephemeron.Kn.MakeSeeded)

    Module Kn.MakeSeeded

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    Parameters

    Signature

    type key = H.t array
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/Kn/index.html b/dev/ocaml/Stdlib/Ephemeron/Kn/index.html index 926d5fd2..f1074d1e 100644 --- a/dev/ocaml/Stdlib/Ephemeron/Kn/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/Kn/index.html @@ -1,4 +1,4 @@ -Kn (ocaml.Stdlib.Ephemeron.Kn)

    Module Ephemeron.Kn

    Ephemerons with arbitrary number of keys of the same type.

    type ('k, 'd) t

    an ephemeron with an arbitrary number of keys of the same type

    val create : int -> ('k, 'd) t

    Same as Ephemeron.K1.create

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key : ('k, 'd) t -> int -> 'k option

    Same as Ephemeron.K1.get_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_key_copy : ('k, 'd) t -> int -> 'k option

    Same as Ephemeron.K1.get_key_copy

    • alert old_ephemeron_api This function won't be available in 5.0
    val set_key : ('k, 'd) t -> int -> 'k -> unit

    Same as Ephemeron.K1.set_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val unset_key : ('k, 'd) t -> int -> unit

    Same as Ephemeron.K1.unset_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val check_key : ('k, 'd) t -> int -> bool

    Same as Ephemeron.K1.check_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_key : ('k, _) t -> int -> ('k, _) t -> int -> int -> unit

    Same as Ephemeron.K1.blit_key

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_data : ('k, 'd) t -> 'd option

    Same as Ephemeron.K1.get_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val get_data_copy : ('k, 'd) t -> 'd option

    Same as Ephemeron.K1.get_data_copy

    • alert old_ephemeron_api This function won't be available in 5.0
    val set_data : ('k, 'd) t -> 'd -> unit

    Same as Ephemeron.K1.set_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val unset_data : ('k, 'd) t -> unit

    Same as Ephemeron.K1.unset_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val check_data : ('k, 'd) t -> bool

    Same as Ephemeron.K1.check_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val blit_data : ('k, 'd) t -> ('k, 'd) t -> unit

    Same as Ephemeron.K1.blit_data

    • alert old_ephemeron_api This function won't be available in 5.0
    val make : 'k array -> 'd -> ('k, 'd) t
    val query : ('k, 'd) t -> 'k array -> 'd option
    module Make (H : Hashtbl.HashedType) : S with type key = H.t array

    Functor building an implementation of a weak hash table

    module MakeSeeded +Kn (ocaml.Stdlib.Ephemeron.Kn)

    Module Ephemeron.Kn

    Ephemerons with arbitrary number of keys of the same type.

    type ('k, 'd) t

    an ephemeron with an arbitrary number of keys of the same type

    val make : 'k array -> 'd -> ('k, 'd) t
    val query : ('k, 'd) t -> 'k array -> 'd option
    module Make (H : Hashtbl.HashedType) : S with type key = H.t array

    Functor building an implementation of a weak hash table

    module MakeSeeded (H : Hashtbl.SeededHashedType) : SeededS with type key = H.t array

    Functor building an implementation of a weak hash table. The seed is similar to the one of Hashtbl.MakeSeeded.

    module Bucket : sig ... end
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/index.html b/dev/ocaml/Stdlib/Ephemeron/index.html index 3662d303..a6c0139a 100644 --- a/dev/ocaml/Stdlib/Ephemeron/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/index.html @@ -1,2 +1,2 @@ -Ephemeron (ocaml.Stdlib.Ephemeron)

    Module Stdlib.Ephemeron

    Ephemerons and weak hash tables.

    Ephemerons and weak hash tables are useful when one wants to cache or memorize the computation of a function, as long as the arguments and the function are used, without creating memory leaks by continuously keeping old computation results that are not useful anymore because one argument or the function is freed. An implementation using Hashtbl.t is not suitable because all associations would keep the arguments and the result in memory.

    Ephemerons can also be used for "adding" a field to an arbitrary boxed OCaml value: you can attach some information to a value created by an external library without memory leaks.

    Ephemerons hold some keys and one or no data. They are all boxed OCaml values. The keys of an ephemeron have the same behavior as weak pointers according to the garbage collector. In fact OCaml weak pointers are implemented as ephemerons without data.

    The keys and data of an ephemeron are said to be full if they point to a value, or empty if the value has never been set, has been unset, or was erased by the GC. In the function that accesses the keys or data these two states are represented by the option type.

    The data is considered by the garbage collector alive if all the full keys are alive and if the ephemeron is alive. When one of the keys is not considered alive anymore by the GC, the data is emptied from the ephemeron. The data could be alive for another reason and in that case the GC will not free it, but the ephemeron will not hold the data anymore.

    The ephemerons complicate the notion of liveness of values, because it is not anymore an equivalence with the reachability from root value by usual pointers (not weak and not ephemerons). With ephemerons the notion of liveness is constructed by the least fixpoint of: A value is alive if:

    • it is a root value
    • it is reachable from alive value by usual pointers
    • it is the data of an alive ephemeron with all its full keys alive

    Notes:

    Ephemerons are defined in a language agnostic way in this paper: B. Hayes, Ephemerons: A New Finalization Mechanism, OOPSLA'97

    • since 4.03.0
    module type S = sig ... end

    The output signature of the functors K1.Make and K2.Make. These hash tables are weak in the keys. If all the keys of a binding are alive the binding is kept, but if one of the keys of the binding is dead then the binding is removed.

    module type SeededS = sig ... end

    The output signature of the functors K1.MakeSeeded and K2.MakeSeeded.

    module K1 : sig ... end

    Ephemerons with one key.

    module K2 : sig ... end

    Ephemerons with two keys.

    module Kn : sig ... end

    Ephemerons with arbitrary number of keys of the same type.

    module GenHashTable : sig ... end

    Hash tables on generic containers with notion of death and aliveness.

    \ No newline at end of file +Ephemeron (ocaml.Stdlib.Ephemeron)

    Module Stdlib.Ephemeron

    Ephemerons and weak hash tables.

    Ephemerons and weak hash tables are useful when one wants to cache or memorize the computation of a function, as long as the arguments and the function are used, without creating memory leaks by continuously keeping old computation results that are not useful anymore because one argument or the function is freed. An implementation using Hashtbl.t is not suitable because all associations would keep the arguments and the result in memory.

    Ephemerons can also be used for "adding" a field to an arbitrary boxed OCaml value: you can attach some information to a value created by an external library without memory leaks.

    Ephemerons hold some keys and one or no data. They are all boxed OCaml values. The keys of an ephemeron have the same behavior as weak pointers according to the garbage collector. In fact OCaml weak pointers are implemented as ephemerons without data.

    The keys and data of an ephemeron are said to be full if they point to a value, or empty if the value has never been set, has been unset, or was erased by the GC. In the function that accesses the keys or data these two states are represented by the option type.

    The data is considered by the garbage collector alive if all the full keys are alive and if the ephemeron is alive. When one of the keys is not considered alive anymore by the GC, the data is emptied from the ephemeron. The data could be alive for another reason and in that case the GC will not free it, but the ephemeron will not hold the data anymore.

    The ephemerons complicate the notion of liveness of values, because it is not anymore an equivalence with the reachability from root value by usual pointers (not weak and not ephemerons). With ephemerons the notion of liveness is constructed by the least fixpoint of: A value is alive if:

    • it is a root value
    • it is reachable from alive value by usual pointers
    • it is the data of an alive ephemeron with all its full keys alive

    Notes:

    Ephemerons are defined in a language agnostic way in this paper: B. Hayes, Ephemerons: A New Finalization Mechanism, OOPSLA'97

    • since 4.03.0

    Unsynchronized accesses

    Unsynchronized accesses to a weak hash table may lead to an invalid weak hash table state. Thus, concurrent accesses to a buffer must be synchronized (for instance with a Mutex.t).

    module type S = sig ... end

    The output signature of the functors K1.Make and K2.Make. These hash tables are weak in the keys. If all the keys of a binding are alive the binding is kept, but if one of the keys of the binding is dead then the binding is removed.

    module type SeededS = sig ... end

    The output signature of the functors K1.MakeSeeded and K2.MakeSeeded.

    module K1 : sig ... end

    Ephemerons with one key.

    module K2 : sig ... end

    Ephemerons with two keys.

    module Kn : sig ... end

    Ephemerons with arbitrary number of keys of the same type.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/module-type-S/index.html b/dev/ocaml/Stdlib/Ephemeron/module-type-S/index.html index 0f3e9ff3..248e52fb 100644 --- a/dev/ocaml/Stdlib/Ephemeron/module-type-S/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/module-type-S/index.html @@ -1,2 +1,2 @@ -S (ocaml.Stdlib.Ephemeron.S)

    Module type Ephemeron.S

    The output signature of the functors K1.Make and K2.Make. These hash tables are weak in the keys. If all the keys of a binding are alive the binding is kept, but if one of the keys of the binding is dead then the binding is removed.

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    Moreover, the table shouldn't be modified during a call to iter. Use filter_map_inplace in this case.

    type key
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +S (ocaml.Stdlib.Ephemeron.S)

    Module type Ephemeron.S

    The output signature of the functors K1.Make and K2.Make. These hash tables are weak in the keys. If all the keys of a binding are alive the binding is kept, but if one of the keys of the binding is dead then the binding is removed.

    Propose the same interface as usual hash table. However since the bindings are weak, even if mem h k is true, a subsequent find h k may raise Not_found because the garbage collector can run between the two.

    type key
    type !'a t
    val create : int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Ephemeron/module-type-SeededS/index.html b/dev/ocaml/Stdlib/Ephemeron/module-type-SeededS/index.html index 872bd356..1d243a39 100644 --- a/dev/ocaml/Stdlib/Ephemeron/module-type-SeededS/index.html +++ b/dev/ocaml/Stdlib/Ephemeron/module-type-SeededS/index.html @@ -1,2 +1,2 @@ -SeededS (ocaml.Stdlib.Ephemeron.SeededS)

    Module type Ephemeron.SeededS

    The output signature of the functors K1.MakeSeeded and K2.MakeSeeded.

    type key
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • alert old_ephemeron_api This function won't be available in 5.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    • alert old_ephemeron_api This function won't be available in 5.0
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_keys : _ t -> key Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val to_seq_values : 'a t -> 'a Seq.t
    • alert old_ephemeron_api This function won't be available in 5.0
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file +SeededS (ocaml.Stdlib.Ephemeron.SeededS)

    Module type Ephemeron.SeededS

    The output signature of the functors K1.MakeSeeded and K2.MakeSeeded.

    type key
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val length : 'a t -> int
    val stats : 'a t -> Hashtbl.statistics
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    val of_seq : (key * 'a) Seq.t -> 'a t
    val clean : 'a t -> unit

    remove all dead bindings. Done automatically during automatic resizing.

    val stats_alive : 'a t -> Hashtbl.statistics

    same as Hashtbl.SeededS.stats but only count the alive bindings

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Filename/index.html b/dev/ocaml/Stdlib/Filename/index.html index c5f16b0b..444fe9f4 100644 --- a/dev/ocaml/Stdlib/Filename/index.html +++ b/dev/ocaml/Stdlib/Filename/index.html @@ -5,7 +5,7 @@ ?temp_dir:string -> string -> string -> - string * out_channel

    Same as Filename.temp_file, but returns both the name of a fresh temporary file, and an output channel opened (atomically) on this file. This function is more secure than temp_file: there is no risk that the temporary file will be modified (e.g. replaced by a symbolic link) before the program opens it. The optional argument mode is a list of additional flags to control the opening of the file. It can contain one or several of Open_append, Open_binary, and Open_text. The default is [Open_text] (open in text mode). The file is created with permissions perms (defaults to readable and writable only by the file owner, 0o600).

    • raises Sys_error

      if the file could not be opened.

    • before 4.03.0

      no ?perms optional argument

    • before 3.11.2

      no ?temp_dir optional argument

    val get_temp_dir_name : unit -> string

    The name of the temporary directory: Under Unix, the value of the TMPDIR environment variable, or "/tmp" if the variable is not set. Under Windows, the value of the TEMP environment variable, or "." if the variable is not set. The temporary directory can be changed with Filename.set_temp_dir_name.

    • since 4.00.0
    val set_temp_dir_name : string -> unit

    Change the temporary directory returned by Filename.get_temp_dir_name and used by Filename.temp_file and Filename.open_temp_file.

    • since 4.00.0
    val temp_dir_name : string

    The name of the initial temporary directory: Under Unix, the value of the TMPDIR environment variable, or "/tmp" if the variable is not set. Under Windows, the value of the TEMP environment variable, or "." if the variable is not set.

    • since 3.09.1
    val quote : string -> string

    Return a quoted version of a file name, suitable for use as one argument in a command line, escaping all meta-characters. Warning: under Windows, the output is only suitable for use with programs that follow the standard Windows quoting conventions.

    val quote_command : + string * out_channel

    Same as Filename.temp_file, but returns both the name of a fresh temporary file, and an output channel opened (atomically) on this file. This function is more secure than temp_file: there is no risk that the temporary file will be modified (e.g. replaced by a symbolic link) before the program opens it. The optional argument mode is a list of additional flags to control the opening of the file. It can contain one or several of Open_append, Open_binary, and Open_text. The default is [Open_text] (open in text mode). The file is created with permissions perms (defaults to readable and writable only by the file owner, 0o600).

    • raises Sys_error

      if the file could not be opened.

    • before 4.03.0

      no ?perms optional argument

    • before 3.11.2

      no ?temp_dir optional argument

    val get_temp_dir_name : unit -> string

    The name of the temporary directory: Under Unix, the value of the TMPDIR environment variable, or "/tmp" if the variable is not set. Under Windows, the value of the TEMP environment variable, or "." if the variable is not set. The temporary directory can be changed with Filename.set_temp_dir_name.

    • since 4.00.0
    val set_temp_dir_name : string -> unit

    Change the temporary directory returned by Filename.get_temp_dir_name and used by Filename.temp_file and Filename.open_temp_file. The temporary directory is a domain-local value which is inherited by child domains.

    • since 4.00.0
    val quote : string -> string

    Return a quoted version of a file name, suitable for use as one argument in a command line, escaping all meta-characters. Warning: under Windows, the output is only suitable for use with programs that follow the standard Windows quoting conventions.

    val quote_command : string -> ?stdin:string -> ?stdout:string -> diff --git a/dev/ocaml/Stdlib/Float/Array/index.html b/dev/ocaml/Stdlib/Float/Array/index.html index cbe75d17..d075c678 100644 --- a/dev/ocaml/Stdlib/Float/Array/index.html +++ b/dev/ocaml/Stdlib/Float/Array/index.html @@ -1,2 +1,13 @@ -Array (ocaml.Stdlib.Float.Array)

    Module Float.Array

    Float arrays with packed representation.

    type t = floatarray

    The type of float arrays with packed representation.

    • since 4.08.0
    val length : t -> int

    Return the length (number of elements) of the given floatarray.

    val get : t -> int -> float

    get a n returns the element number n of floatarray a.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : t -> int -> float -> unit

    set a n x modifies floatarray a in place, replacing element number n with x.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val make : int -> float -> t

    make n x returns a fresh floatarray of length n, initialized with x.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val create : int -> t

    create n returns a fresh floatarray of length n, with uninitialized data.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

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

    init n f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val append : t -> t -> t

    append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_floatarray_length.

    val concat : t list -> t

    Same as append, but concatenates a list of floatarrays.

    val sub : t -> int -> int -> t

    sub a pos len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : t -> t

    copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

    val fill : t -> int -> int -> float -> unit

    fill a pos len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : t -> int -> t -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

    val to_list : t -> float list

    to_list a returns the list of all the elements of a.

    val of_list : float list -> t

    of_list l returns a fresh floatarray containing the elements of l.

    • raises Invalid_argument

      if the length of l is greater than Sys.max_floatarray_length.

    Iterators

    val iter : (float -> unit) -> t -> unit

    iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

    val iteri : (int -> float -> unit) -> t -> unit

    Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

    val map : (float -> float) -> t -> t

    map f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

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

    Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val fold_left : ('a -> float -> 'a) -> 'a -> t -> 'a

    fold_left f x init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

    val fold_right : (float -> 'a -> 'a) -> t -> 'a -> 'a

    fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

    Iterators on two arrays

    val iter2 : (float -> float -> unit) -> t -> t -> unit

    Array.iter2 f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the floatarrays are not the same size.

    val map2 : (float -> float -> float) -> t -> t -> t

    map2 f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the floatarrays are not the same size.

    Array scanning

    val for_all : (float -> bool) -> t -> bool

    for_all f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    val exists : (float -> bool) -> t -> bool

    exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    val mem : float -> t -> bool

    mem a set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

    val mem_ieee : float -> t -> bool

    Same as mem, but uses IEEE equality instead of structural equality.

    Sorting

    val sort : (float -> float -> int) -> t -> unit

    Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : (float -> float -> int) -> t -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

    val fast_sort : (float -> float -> int) -> t -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Float arrays and Sequences

    val to_seq : t -> float Seq.t

    Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

    val to_seqi : t -> (int * float) Seq.t

    Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

    val of_seq : float Seq.t -> t

    Create an array from the generator.

    val map_to_array : (float -> 'a) -> t -> 'a array

    map_to_array f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

    val map_from_array : ('a -> float) -> 'a array -> t

    map_from_array f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

    \ No newline at end of file +Array (ocaml.Stdlib.Float.Array)

    Module Float.Array

    Float arrays with packed representation.

    type t = floatarray

    The type of float arrays with packed representation.

    • since 4.08.0
    val length : t -> int

    Return the length (number of elements) of the given floatarray.

    val get : t -> int -> float

    get a n returns the element number n of floatarray a.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : t -> int -> float -> unit

    set a n x modifies floatarray a in place, replacing element number n with x.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val make : int -> float -> t

    make n x returns a fresh floatarray of length n, initialized with x.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val create : int -> t

    create n returns a fresh floatarray of length n, with uninitialized data.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

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

    init n f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val append : t -> t -> t

    append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_floatarray_length.

    val concat : t list -> t

    Same as append, but concatenates a list of floatarrays.

    val sub : t -> int -> int -> t

    sub a pos len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : t -> t

    copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

    val fill : t -> int -> int -> float -> unit

    fill a pos len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : t -> int -> t -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

    val to_list : t -> float list

    to_list a returns the list of all the elements of a.

    val of_list : float list -> t

    of_list l returns a fresh floatarray containing the elements of l.

    • raises Invalid_argument

      if the length of l is greater than Sys.max_floatarray_length.

    Iterators

    val iter : (float -> unit) -> t -> unit

    iter f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

    val iteri : (int -> float -> unit) -> t -> unit

    Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

    val map : (float -> float) -> t -> t

    map f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

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

    Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val fold_left : ('a -> float -> 'a) -> 'a -> t -> 'a

    fold_left f x init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

    val fold_right : (float -> 'a -> 'a) -> t -> 'a -> 'a

    fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

    Iterators on two arrays

    val iter2 : (float -> float -> unit) -> t -> t -> unit

    Array.iter2 f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the floatarrays are not the same size.

    val map2 : (float -> float -> float) -> t -> t -> t

    map2 f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the floatarrays are not the same size.

    Array scanning

    val for_all : (float -> bool) -> t -> bool

    for_all f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    val exists : (float -> bool) -> t -> bool

    exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    val mem : float -> t -> bool

    mem a set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

    val mem_ieee : float -> t -> bool

    Same as mem, but uses IEEE equality instead of structural equality.

    Sorting

    val sort : (float -> float -> int) -> t -> unit

    Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : (float -> float -> int) -> t -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

    val fast_sort : (float -> float -> int) -> t -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Float arrays and Sequences

    val to_seq : t -> float Seq.t

    Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

    val to_seqi : t -> (int * float) Seq.t

    Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

    val of_seq : float Seq.t -> t

    Create an array from the generator.

    val map_to_array : (float -> 'a) -> t -> 'a array

    map_to_array f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

    val map_from_array : ('a -> float) -> 'a array -> t

    map_from_array f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

    Arrays and concurrency safety

    Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

    Atomicity

    Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

    For example, consider the following program:

    let size = 100_000_000
    +let a = Float.Array.make size 1.
    +let update a f () =
    +   Float.Array.iteri (fun i x -> Float.Array.set a i (f x)) a
    +let d1 = Domain.spawn (update a (fun x -> x +. 1.))
    +let d2 = Domain.spawn (update a (fun x ->  2. *. x +. 1.))
    +let () = Domain.join d1; Domain.join d2

    After executing this code, each field of the float array a is either 2., 3., 4. or 5.. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

    Data races

    If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

    A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

    Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

    Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location with a few exceptions.

    Tearing

    Float arrays have two supplementary caveats in the presence of data races.

    First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

    For instance, at the end of

    let zeros = Float.Array.make size 0.
    +let max_floats = Float.Array.make size Float.max_float
    +let res = Float.Array.copy zeros
    +let d1 = Domain.spawn (fun () -> Float.Array.blit zeros 0 res 0 size)
    +let d2 = Domain.spawn (fun () -> Float.Array.blit max_floats 0 res 0 size)
    +let () = Domain.join d1; Domain.join d2

    the res float array might contain values that are neither 0. nor max_float.

    Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Float/ArrayLabels/index.html b/dev/ocaml/Stdlib/Float/ArrayLabels/index.html index ec69f190..d8d68298 100644 --- a/dev/ocaml/Stdlib/Float/ArrayLabels/index.html +++ b/dev/ocaml/Stdlib/Float/ArrayLabels/index.html @@ -1,2 +1,13 @@ -ArrayLabels (ocaml.Stdlib.Float.ArrayLabels)

    Module Float.ArrayLabels

    Float arrays with packed representation (labeled functions).

    type t = floatarray

    The type of float arrays with packed representation.

    • since 4.08.0
    val length : t -> int

    Return the length (number of elements) of the given floatarray.

    val get : t -> int -> float

    get a n returns the element number n of floatarray a.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : t -> int -> float -> unit

    set a n x modifies floatarray a in place, replacing element number n with x.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val make : int -> float -> t

    make n x returns a fresh floatarray of length n, initialized with x.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val create : int -> t

    create n returns a fresh floatarray of length n, with uninitialized data.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val init : int -> f:(int -> float) -> t

    init n ~f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val append : t -> t -> t

    append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_floatarray_length.

    val concat : t list -> t

    Same as append, but concatenates a list of floatarrays.

    val sub : t -> pos:int -> len:int -> t

    sub a ~pos ~len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : t -> t

    copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

    val fill : t -> pos:int -> len:int -> float -> unit

    fill a ~pos ~len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit

    blit ~src ~src_pos ~dst ~dst_pos ~len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

    val to_list : t -> float list

    to_list a returns the list of all the elements of a.

    val of_list : float list -> t

    of_list l returns a fresh floatarray containing the elements of l.

    • raises Invalid_argument

      if the length of l is greater than Sys.max_floatarray_length.

    Iterators

    val iter : f:(float -> unit) -> t -> unit

    iter ~f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

    val iteri : f:(int -> float -> unit) -> t -> unit

    Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

    val map : f:(float -> float) -> t -> t

    map ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

    val mapi : f:(int -> float -> float) -> t -> t

    Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val fold_left : f:('a -> float -> 'a) -> init:'a -> t -> 'a

    fold_left ~f x ~init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

    val fold_right : f:(float -> 'a -> 'a) -> t -> init:'a -> 'a

    fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

    Iterators on two arrays

    val iter2 : f:(float -> float -> unit) -> t -> t -> unit

    Array.iter2 ~f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the floatarrays are not the same size.

    val map2 : f:(float -> float -> float) -> t -> t -> t

    map2 ~f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the floatarrays are not the same size.

    Array scanning

    val for_all : f:(float -> bool) -> t -> bool

    for_all ~f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    val exists : f:(float -> bool) -> t -> bool

    exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    val mem : float -> set:t -> bool

    mem a ~set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

    val mem_ieee : float -> set:t -> bool

    Same as mem, but uses IEEE equality instead of structural equality.

    Sorting

    val sort : cmp:(float -> float -> int) -> t -> unit

    Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : cmp:(float -> float -> int) -> t -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

    val fast_sort : cmp:(float -> float -> int) -> t -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Float arrays and Sequences

    val to_seq : t -> float Seq.t

    Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

    val to_seqi : t -> (int * float) Seq.t

    Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

    val of_seq : float Seq.t -> t

    Create an array from the generator.

    val map_to_array : f:(float -> 'a) -> t -> 'a array

    map_to_array ~f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

    val map_from_array : f:('a -> float) -> 'a array -> t

    map_from_array ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

    \ No newline at end of file +ArrayLabels (ocaml.Stdlib.Float.ArrayLabels)

    Module Float.ArrayLabels

    Float arrays with packed representation (labeled functions).

    type t = floatarray

    The type of float arrays with packed representation.

    • since 4.08.0
    val length : t -> int

    Return the length (number of elements) of the given floatarray.

    val get : t -> int -> float

    get a n returns the element number n of floatarray a.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val set : t -> int -> float -> unit

    set a n x modifies floatarray a in place, replacing element number n with x.

    • raises Invalid_argument

      if n is outside the range 0 to (length a - 1).

    val make : int -> float -> t

    make n x returns a fresh floatarray of length n, initialized with x.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val create : int -> t

    create n returns a fresh floatarray of length n, with uninitialized data.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val init : int -> f:(int -> float) -> t

    init n ~f returns a fresh floatarray of length n, with element number i initialized to the result of f i. In other terms, init n ~f tabulates the results of f applied to the integers 0 to n-1.

    • raises Invalid_argument

      if n < 0 or n > Sys.max_floatarray_length.

    val append : t -> t -> t

    append v1 v2 returns a fresh floatarray containing the concatenation of the floatarrays v1 and v2.

    • raises Invalid_argument

      if length v1 + length v2 > Sys.max_floatarray_length.

    val concat : t list -> t

    Same as append, but concatenates a list of floatarrays.

    val sub : t -> pos:int -> len:int -> t

    sub a ~pos ~len returns a fresh floatarray of length len, containing the elements number pos to pos + len - 1 of floatarray a.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a; that is, if pos < 0, or len < 0, or pos + len > length a.

    val copy : t -> t

    copy a returns a copy of a, that is, a fresh floatarray containing the same elements as a.

    val fill : t -> pos:int -> len:int -> float -> unit

    fill a ~pos ~len x modifies the floatarray a in place, storing x in elements number pos to pos + len - 1.

    • raises Invalid_argument

      if pos and len do not designate a valid subarray of a.

    val blit : src:t -> src_pos:int -> dst:t -> dst_pos:int -> len:int -> unit

    blit ~src ~src_pos ~dst ~dst_pos ~len copies len elements from floatarray src, starting at element number src_pos, to floatarray dst, starting at element number dst_pos. It works correctly even if src and dst are the same floatarray, and the source and destination chunks overlap.

    • raises Invalid_argument

      if src_pos and len do not designate a valid subarray of src, or if dst_pos and len do not designate a valid subarray of dst.

    val to_list : t -> float list

    to_list a returns the list of all the elements of a.

    val of_list : float list -> t

    of_list l returns a fresh floatarray containing the elements of l.

    • raises Invalid_argument

      if the length of l is greater than Sys.max_floatarray_length.

    Iterators

    val iter : f:(float -> unit) -> t -> unit

    iter ~f a applies function f in turn to all the elements of a. It is equivalent to f a.(0); f a.(1); ...; f a.(length a - 1); ().

    val iteri : f:(int -> float -> unit) -> t -> unit

    Same as iter, but the function is applied with the index of the element as first argument, and the element itself as second argument.

    val map : f:(float -> float) -> t -> t

    map ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

    val mapi : f:(int -> float -> float) -> t -> t

    Same as map, but the function is applied to the index of the element as first argument, and the element itself as second argument.

    val fold_left : f:('a -> float -> 'a) -> init:'a -> t -> 'a

    fold_left ~f x ~init computes f (... (f (f x init.(0)) init.(1)) ...) init.(n-1), where n is the length of the floatarray init.

    val fold_right : f:(float -> 'a -> 'a) -> t -> init:'a -> 'a

    fold_right f a init computes f a.(0) (f a.(1) ( ... (f a.(n-1) init) ...)), where n is the length of the floatarray a.

    Iterators on two arrays

    val iter2 : f:(float -> float -> unit) -> t -> t -> unit

    Array.iter2 ~f a b applies function f to all the elements of a and b.

    • raises Invalid_argument

      if the floatarrays are not the same size.

    val map2 : f:(float -> float -> float) -> t -> t -> t

    map2 ~f a b applies function f to all the elements of a and b, and builds a floatarray with the results returned by f: [| f a.(0) b.(0); ...; f a.(length a - 1) b.(length b - 1)|].

    • raises Invalid_argument

      if the floatarrays are not the same size.

    Array scanning

    val for_all : f:(float -> bool) -> t -> bool

    for_all ~f [|a1; ...; an|] checks if all elements of the floatarray satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an).

    val exists : f:(float -> bool) -> t -> bool

    exists f [|a1; ...; an|] checks if at least one element of the floatarray satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an).

    val mem : float -> set:t -> bool

    mem a ~set is true if and only if there is an element of set that is structurally equal to a, i.e. there is an x in set such that compare a x = 0.

    val mem_ieee : float -> set:t -> bool

    Same as mem, but uses IEEE equality instead of structural equality.

    Sorting

    val sort : cmp:(float -> float -> int) -> t -> unit

    Sort a floatarray in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see below for a complete specification). For example, Stdlib.compare is a suitable comparison function. After calling sort, the array is sorted in place in increasing order. sort is guaranteed to run in constant heap space and (at most) logarithmic stack space.

    The current implementation uses Heap Sort. It runs in constant stack space.

    Specification of the comparison function: Let a be the floatarray and cmp the comparison function. The following must be true for all x, y, z in a :

    • cmp x y > 0 if and only if cmp y x < 0
    • if cmp x y >= 0 and cmp y z >= 0 then cmp x z >= 0

    When sort returns, a contains the same elements as before, reordered in such a way that for all i and j valid indices of a :

    • cmp a.(i) a.(j) >= 0 if and only if i >= j
    val stable_sort : cmp:(float -> float -> int) -> t -> unit

    Same as sort, but the sorting algorithm is stable (i.e. elements that compare equal are kept in their original order) and not guaranteed to run in constant heap space.

    The current implementation uses Merge Sort. It uses a temporary floatarray of length n/2, where n is the length of the floatarray. It is usually faster than the current implementation of sort.

    val fast_sort : cmp:(float -> float -> int) -> t -> unit

    Same as sort or stable_sort, whichever is faster on typical input.

    Float arrays and Sequences

    val to_seq : t -> float Seq.t

    Iterate on the floatarray, in increasing order. Modifications of the floatarray during iteration will be reflected in the sequence.

    val to_seqi : t -> (int * float) Seq.t

    Iterate on the floatarray, in increasing order, yielding indices along elements. Modifications of the floatarray during iteration will be reflected in the sequence.

    val of_seq : float Seq.t -> t

    Create an array from the generator.

    val map_to_array : f:(float -> 'a) -> t -> 'a array

    map_to_array ~f a applies function f to all the elements of a, and builds an array with the results returned by f: [| f a.(0); f a.(1); ...; f a.(length a - 1) |].

    val map_from_array : f:('a -> float) -> 'a array -> t

    map_from_array ~f a applies function f to all the elements of a, and builds a floatarray with the results returned by f.

    Arrays and concurrency safety

    Care must be taken when concurrently accessing float arrays from multiple domains: accessing an array will never crash a program, but unsynchronized accesses might yield surprising (non-sequentially-consistent) results.

    Atomicity

    Every float array operation that accesses more than one array element is not atomic. This includes iteration, scanning, sorting, splitting and combining arrays.

    For example, consider the following program:

    let size = 100_000_000
    +let a = Float.ArrayLabels.make size 1.
    +let update a f () =
    +   Float.ArrayLabels.iteri ~f:(fun i x -> Float.Array.set a i (f x)) a
    +let d1 = Domain.spawn (update a (fun x -> x +. 1.))
    +let d2 = Domain.spawn (update a (fun x ->  2. *. x +. 1.))
    +let () = Domain.join d1; Domain.join d2

    After executing this code, each field of the float array a is either 2., 3., 4. or 5.. If atomicity is required, then the user must implement their own synchronization (for example, using Mutex.t).

    Data races

    If two domains only access disjoint parts of the array, then the observed behaviour is the equivalent to some sequential interleaving of the operations from the two domains.

    A data race is said to occur when two domains access the same array element without synchronization and at least one of the accesses is a write. In the absence of data races, the observed behaviour is equivalent to some sequential interleaving of the operations from different domains.

    Whenever possible, data races should be avoided by using synchronization to mediate the accesses to the array elements.

    Indeed, in the presence of data races, programs will not crash but the observed behaviour may not be equivalent to any sequential interleaving of operations from different domains. Nevertheless, even in the presence of data races, a read operation will return the value of some prior write to that location with a few exceptions.

    Tearing

    Float arrays have two supplementary caveats in the presence of data races.

    First, the blit operation might copy an array byte-by-byte. Data races between such a blit operation and another operation might produce surprising values due to tearing: partial writes interleaved with other operations can create float values that would not exist with a sequential execution.

    For instance, at the end of

    let zeros = Float.Array.make size 0.
    +let max_floats = Float.Array.make size Float.max_float
    +let res = Float.Array.copy zeros
    +let d1 = Domain.spawn (fun () -> Float.Array.blit zeros 0 res 0 size)
    +let d2 = Domain.spawn (fun () -> Float.Array.blit max_floats 0 res 0 size)
    +let () = Domain.join d1; Domain.join d2

    the res float array might contain values that are neither 0. nor max_float.

    Second, on 32-bit architectures, getting or setting a field involves two separate memory accesses. In the presence of data races, the user may observe tearing on any operation.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Format/index.html b/dev/ocaml/Stdlib/Format/index.html index 8612aa84..fe3e9375 100644 --- a/dev/ocaml/Stdlib/Format/index.html +++ b/dev/ocaml/Stdlib/Format/index.html @@ -1,5 +1,5 @@ -Format (ocaml.Stdlib.Format)

    Module Stdlib.Format

    Pretty-printing.

    This module implements a pretty-printing facility to format values within 'pretty-printing boxes' and 'semantic tags' combined with a set of printf-like functions. The pretty-printer splits lines at specified break hints, and indents lines according to the box structure. Similarly, semantic tags can be used to decouple text presentation from its contents.

    This pretty-printing facility is implemented as an overlay on top of abstract formatters which provide basic output functions. Some formatters are predefined, notably:

    Most functions in the Format module come in two variants: a short version that operates on std_formatter and the generic version prefixed by pp_ that takes a formatter as its first argument.

    More formatters can be created with formatter_of_out_channel, formatter_of_buffer, formatter_of_symbolic_output_buffer or using custom formatters.

    Introduction

    You may consider this module as providing an extension to the printf facility to provide automatic line splitting. The addition of pretty-printing annotations to your regular printf format strings gives you fancy indentation and line breaks. Pretty-printing annotations are described below in the documentation of the function Format.fprintf.

    You may also use the explicit pretty-printing box management and printing functions provided by this module. This style is more basic but more verbose than the concise fprintf format strings.

    For instance, the sequence open_box 0; print_string "x ="; print_space (); +Format (ocaml.Stdlib.Format)

    Module Stdlib.Format

    Pretty-printing.

    This module implements a pretty-printing facility to format values within 'pretty-printing boxes' and 'semantic tags' combined with a set of printf-like functions. The pretty-printer splits lines at specified break hints, and indents lines according to the box structure. Similarly, semantic tags can be used to decouple text presentation from its contents.

    This pretty-printing facility is implemented as an overlay on top of abstract formatters which provide basic output functions. Some formatters are predefined, notably:

    Most functions in the Format module come in two variants: a short version that operates on the current domain's standard formatter as obtained using get_std_formatter and the generic version prefixed by pp_ that takes a formatter as its first argument. For the version that operates on the current domain's standard formatter, the call to get_std_formatter is delayed until the last argument is received.

    More formatters can be created with formatter_of_out_channel, formatter_of_buffer, formatter_of_symbolic_output_buffer or using custom formatters.

    Warning: Since formatters contain mutable state, it is not thread-safe to use the same formatter on multiple domains in parallel without synchronization.

    If multiple domains write to the same output channel using the predefined formatters (as obtained by get_std_formatter or get_err_formatter), the output from the domains will be interleaved with each other at points where the formatters are flushed, such as with print_flush. This synchronization is not performed by formatters obtained from formatter_of_out_channel (on the standard out channels or others).

    Introduction

    You may consider this module as providing an extension to the printf facility to provide automatic line splitting. The addition of pretty-printing annotations to your regular printf format strings gives you fancy indentation and line breaks. Pretty-printing annotations are described below in the documentation of the function Format.fprintf.

    You may also use the explicit pretty-printing box management and printing functions provided by this module. This style is more basic but more verbose than the concise fprintf format strings.

    For instance, the sequence open_box 0; print_string "x ="; print_space (); print_int 1; close_box (); print_newline () that prints x = 1 within a pretty-printing box, can be abbreviated as printf "@[%s@ %i@]@." "x =" 1, or even shorter printf "@[x =@ %i@]@." 1.

    Rule of thumb for casual users of this library:

    • use simple pretty-printing boxes (as obtained by open_box 0);
    • use simple break hints as obtained by print_cut () that outputs a simple break hint, or by print_space () that outputs a space indicating a break hint;
    • once a pretty-printing box is open, display its material with basic printing functions (e. g. print_int and print_string);
    • when the material for a pretty-printing box has been printed, call close_box () to close the box;
    • at the end of pretty-printing, flush the pretty-printer to display all the remaining material, e.g. evaluate print_newline ().

    The behavior of pretty-printing commands is unspecified if there is no open pretty-printing box. Each box opened by one of the open_ functions below must be closed using close_box for proper formatting. Otherwise, some of the material printed in the boxes may not be output, or may be formatted incorrectly.

    In case of interactive use, each phrase is executed in the initial state of the standard pretty-printer: after each phrase execution, the interactive system closes all open pretty-printing boxes, flushes all pending text, and resets the standard pretty-printer.

    Warning: mixing calls to pretty-printing functions of this module with calls to Stdlib low level output functions is error prone.

    The pretty-printing functions output material that is delayed in the pretty-printer queue and stacks in order to compute proper line splitting. In contrast, basic I/O output functions write directly in their output device. As a consequence, the output of a basic I/O function may appear before the output of a pretty-printing function that has been called before. For instance, Stdlib.print_string "<"; Format.print_string "PRETTY"; @@ -15,7 +15,7 @@ c; ]

    You can do this as follows:

    printf "@[<v 0>[@;<0 2>@[<v 0>a;@,b;@,c@]%t]@]@\n"
       (pp_print_custom_break ~fits:("", 0, "") ~breaks:(";", 0, ""))
    • since 4.08.0
    val pp_force_newline : formatter -> unit -> unit
    val force_newline : unit -> unit

    Force a new line in the current pretty-printing box.

    The pretty-printer must split the line at this point,

    Not the normal way of pretty-printing, since imperative line splitting may interfere with current line counters and box size calculation. Using break hints within an enclosing vertical box is a better alternative.

    val pp_print_if_newline : formatter -> unit -> unit
    val print_if_newline : unit -> unit

    Execute the next formatting command if the preceding line has just been split. Otherwise, ignore the next formatting command.

    Pretty-printing termination

    val pp_print_flush : formatter -> unit -> unit
    val print_flush : unit -> unit

    End of pretty-printing: resets the pretty-printer to initial state.

    All open pretty-printing boxes are closed, all pending text is printed. In addition, the pretty-printer low level output device is flushed to ensure that all pending text is really displayed.

    Note: never use print_flush in the normal course of a pretty-printing routine, since the pretty-printer uses a complex buffering machinery to properly indent the output; manually flushing those buffers at random would conflict with the pretty-printer strategy and result to poor rendering.

    Only consider using print_flush when displaying all pending material is mandatory (for instance in case of interactive use when you want the user to read some text) and when resetting the pretty-printer state will not disturb further pretty-printing.

    Warning: If the output device of the pretty-printer is an output channel, repeated calls to print_flush means repeated calls to Stdlib.flush to flush the out channel; these explicit flush calls could foil the buffering strategy of output channels and could dramatically impact efficiency.

    val pp_print_newline : formatter -> unit -> unit
    val print_newline : unit -> unit

    End of pretty-printing: resets the pretty-printer to initial state.

    All open pretty-printing boxes are closed, all pending text is printed.

    Equivalent to print_flush followed by a new line. See corresponding words of caution for print_flush.

    Note: this is not the normal way to output a new line; the preferred method is using break hints within a vertical pretty-printing box.

    Margin

    val pp_set_margin : formatter -> int -> unit
    val set_margin : int -> unit

    pp_set_margin ppf d sets the right margin to d (in characters): the pretty-printer splits lines that overflow the right margin according to the break hints given. Setting the margin to d means that the formatting engine aims at printing at most d-1 characters per line. Nothing happens if d is smaller than 2. If d is too large, the right margin is set to the maximum admissible value (which is greater than 10 ^ 9). If d is less than the current maximum indentation limit, the maximum indentation limit is decreased while trying to preserve a minimal ratio max_indent/margin>=50% and if possible the current difference margin - max_indent.

    See also pp_set_geometry.

    val pp_get_margin : formatter -> unit -> int
    val get_margin : unit -> int

    Returns the position of the right margin.

    Maximum indentation limit

    val pp_set_max_indent : formatter -> int -> unit
    val set_max_indent : int -> unit

    pp_set_max_indent ppf d sets the maximum indentation limit of lines to d (in characters): once this limit is reached, new pretty-printing boxes are rejected to the left, unless the enclosing box fully fits on the current line. As an illustration,

    set_margin 10; set_max_indent 5; printf "@[123456@[7@]89A@]@." 

    yields

    123456
    -789A

    because the nested box "@[7@]" is opened after the maximum indentation limit (7>5) and its parent box does not fit on the current line. Either decreasing the length of the parent box to make it fit on a line:

    printf "@[123456@[7@]89@]@." 

    or opening an intermediary box before the maximum indentation limit which fits on the current line

    printf "@[123@[456@[7@]89@]A@]@." 

    avoids the rejection to the left of the inner boxes and print respectively "123456789" and "123456789A" . Note also that vertical boxes never fit on a line whereas horizontal boxes always fully fit on the current line. Opening a box may split a line whereas the contents may have fit. If this behavior is problematic, it can be curtailed by setting the maximum indentation limit to margin - 1. Note that setting the maximum indentation limit to margin is invalid.

    Nothing happens if d is smaller than 2.

    If d is too large, the limit is set to the maximum admissible value (which is greater than 10 ^ 9).

    If d is greater or equal than the current margin, it is ignored, and the current maximum indentation limit is kept.

    See also pp_set_geometry.

    val pp_get_max_indent : formatter -> unit -> int
    val get_max_indent : unit -> int

    Return the maximum indentation limit (in characters).

    Geometry

    Geometric functions can be used to manipulate simultaneously the coupled variables, margin and maxixum indentation limit.

    type geometry = {
    1. max_indent : int;
    2. margin : int;
    }
    val check_geometry : geometry -> bool

    Check if the formatter geometry is valid: 1 < max_indent < margin

    val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit
    val set_geometry : max_indent:int -> margin:int -> unit
    val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit
    val safe_set_geometry : max_indent:int -> margin:int -> unit

    pp_set_geometry ppf ~max_indent ~margin sets both the margin and maximum indentation limit for ppf.

    When 1 < max_indent < margin, pp_set_geometry ppf ~max_indent ~margin is equivalent to pp_set_margin ppf margin; pp_set_max_indent ppf max_indent; and avoids the subtly incorrect pp_set_max_indent ppf max_indent; pp_set_margin ppf margin;

    Outside of this domain, pp_set_geometry raises an invalid argument exception whereas pp_safe_set_geometry does nothing.

    • since 4.08.0
    val pp_update_geometry : formatter -> (geometry -> geometry) -> unit

    pp_update_geometry ppf (fun geo -> { geo with ... }) lets you update a formatter's geometry in a way that is robust to extension of the geometry record with new fields.

    Raises an invalid argument exception if the returned geometry does not satisfy check_geometry.

    • since 4.11.0
    val update_geometry : (geometry -> geometry) -> unit
    val pp_get_geometry : formatter -> unit -> geometry
    val get_geometry : unit -> geometry

    Return the current geometry of the formatter

    • since 4.08.0

    Maximum formatting depth

    The maximum formatting depth is the maximum number of pretty-printing boxes simultaneously open.

    Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

    val pp_set_max_boxes : formatter -> int -> unit
    val set_max_boxes : int -> unit

    pp_set_max_boxes ppf max sets the maximum number of pretty-printing boxes simultaneously open.

    Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

    Nothing happens if max is smaller than 2.

    val pp_get_max_boxes : formatter -> unit -> int
    val get_max_boxes : unit -> int

    Returns the maximum number of pretty-printing boxes allowed before ellipsis.

    val pp_over_max_boxes : formatter -> unit -> bool
    val over_max_boxes : unit -> bool

    Tests if the maximum number of pretty-printing boxes allowed have already been opened.

    Tabulation boxes

    A tabulation box prints material on lines divided into cells of fixed length. A tabulation box provides a simple way to display vertical columns of left adjusted text.

    This box features command set_tab to define cell boundaries, and command print_tab to move from cell to cell and split the line when there is no more cells to print on the line.

    Note: printing within tabulation box is line directed, so arbitrary line splitting inside a tabulation box leads to poor rendering. Yet, controlled use of tabulation boxes allows simple printing of columns within module Format.

    val pp_open_tbox : formatter -> unit -> unit
    val open_tbox : unit -> unit

    open_tbox () opens a new tabulation box.

    This box prints lines separated into cells of fixed width.

    Inside a tabulation box, special tabulation markers defines points of interest on the line (for instance to delimit cell boundaries). Function Format.set_tab sets a tabulation marker at insertion point.

    A tabulation box features specific tabulation breaks to move to next tabulation marker or split the line. Function Format.print_tbreak prints a tabulation break.

    val pp_close_tbox : formatter -> unit -> unit
    val close_tbox : unit -> unit

    Closes the most recently opened tabulation box.

    val pp_set_tab : formatter -> unit -> unit
    val set_tab : unit -> unit

    Sets a tabulation marker at current insertion point.

    val pp_print_tab : formatter -> unit -> unit
    val print_tab : unit -> unit

    print_tab () emits a 'next' tabulation break hint: if not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right, or the pretty-printer splits the line and insertion point moves to the leftmost tabulation marker.

    It is equivalent to print_tbreak 0 0.

    val pp_print_tbreak : formatter -> int -> int -> unit
    val print_tbreak : int -> int -> unit

    print_tbreak nspaces offset emits a 'full' tabulation break hint.

    If not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right and the pretty-printer prints nspaces spaces.

    If there is no next tabulation marker on the right, the pretty-printer splits the line at this point, then insertion point moves to the leftmost tabulation marker of the box.

    If the pretty-printer splits the line, offset is added to the current indentation.

    Ellipsis

    val pp_set_ellipsis_text : formatter -> string -> unit
    val set_ellipsis_text : string -> unit

    Set the text of the ellipsis printed when too many pretty-printing boxes are open (a single dot, ., by default).

    val pp_get_ellipsis_text : formatter -> unit -> string
    val get_ellipsis_text : unit -> string

    Return the text of the ellipsis.

    Semantic tags

    type stag = ..

    Semantic tags (or simply tags) are user's defined annotations to associate user's specific operations to printed entities.

    Common usage of semantic tags is text decoration to get specific font or text size rendering for a display device, or marking delimitation of entities (e.g. HTML or TeX elements or terminal escape sequences). More sophisticated usage of semantic tags could handle dynamic modification of the pretty-printer behavior to properly print the material within some specific tags. For instance, we can define an RGB tag like so:

    type stag += RGB of {r:int;g:int;b:int}

    In order to properly delimit printed entities, a semantic tag must be opened before and closed after the entity. Semantic tags must be properly nested like parentheses using pp_open_stag and pp_close_stag.

    Tag specific operations occur any time a tag is opened or closed, At each occurrence, two kinds of operations are performed tag-marking and tag-printing:

    • The tag-marking operation is the simpler tag specific operation: it simply writes a tag specific string into the output device of the formatter. Tag-marking does not interfere with line-splitting computation.
    • The tag-printing operation is the more involved tag specific operation: it can print arbitrary material to the formatter. Tag-printing is tightly linked to the current pretty-printer operations.

    Roughly speaking, tag-marking is commonly used to get a better rendering of texts in the rendering device, while tag-printing allows fine tuning of printing routines to print the same entity differently according to the semantic tags (i.e. print additional material or even omit parts of the output).

    More precisely: when a semantic tag is opened or closed then both and successive 'tag-printing' and 'tag-marking' operations occur:

    • Tag-printing a semantic tag means calling the formatter specific function print_open_stag (resp. print_close_stag) with the name of the tag as argument: that tag-printing function can then print any regular material to the formatter (so that this material is enqueued as usual in the formatter queue for further line splitting computation).
    • Tag-marking a semantic tag means calling the formatter specific function mark_open_stag (resp. mark_close_stag) with the name of the tag as argument: that tag-marking function can then return the 'tag-opening marker' (resp. `tag-closing marker') for direct output into the output device of the formatter.

    Being written directly into the output device of the formatter, semantic tag marker strings are not considered as part of the printing material that drives line splitting (in other words, the length of the strings corresponding to tag markers is considered as zero for line splitting).

    Thus, semantic tag handling is in some sense transparent to pretty-printing and does not interfere with usual indentation. Hence, a single pretty-printing routine can output both simple 'verbatim' material or richer decorated output depending on the treatment of tags. By default, tags are not active, hence the output is not decorated with tag information. Once set_tags is set to true, the pretty-printer engine honors tags and decorates the output accordingly.

    Default tag-marking functions behave the HTML way: string tags are enclosed in "<" and ">" while other tags are ignored; hence, opening marker for tag string "t" is "<t>" and closing marker is "</t>".

    Default tag-printing functions just do nothing.

    Tag-marking and tag-printing functions are user definable and can be set by calling set_formatter_stag_functions.

    Semantic tag operations may be set on or off with set_tags. Tag-marking operations may be set on or off with set_mark_tags. Tag-printing operations may be set on or off with set_print_tags.

    • since 4.08.0
    type tag = string
    type stag +=
    1. | String_tag of tag
      (*

      String_tag s is a string tag s. String tags can be inserted either by explicitly using the constructor String_tag or by using the dedicated format syntax "@{<s> ... @}".

      • since 4.08.0
      *)
    val pp_open_stag : formatter -> stag -> unit
    val open_stag : stag -> unit

    pp_open_stag ppf t opens the semantic tag named t.

    The print_open_stag tag-printing function of the formatter is called with t as argument; then the opening tag marker for t, as given by mark_open_stag t, is written into the output device of the formatter.

    • since 4.08.0
    val pp_close_stag : formatter -> unit -> unit
    val close_stag : unit -> unit

    pp_close_stag ppf () closes the most recently opened semantic tag t.

    The closing tag marker, as given by mark_close_stag t, is written into the output device of the formatter; then the print_close_stag tag-printing function of the formatter is called with t as argument.

    • since 4.08.0
    val pp_set_tags : formatter -> bool -> unit
    val set_tags : bool -> unit

    pp_set_tags ppf b turns on or off the treatment of semantic tags (default is off).

    val pp_set_print_tags : formatter -> bool -> unit
    val set_print_tags : bool -> unit

    pp_set_print_tags ppf b turns on or off the tag-printing operations.

    val pp_set_mark_tags : formatter -> bool -> unit
    val set_mark_tags : bool -> unit

    pp_set_mark_tags ppf b turns on or off the tag-marking operations.

    val pp_get_print_tags : formatter -> unit -> bool
    val get_print_tags : unit -> bool

    Return the current status of tag-printing operations.

    val pp_get_mark_tags : formatter -> unit -> bool
    val get_mark_tags : unit -> bool

    Return the current status of tag-marking operations.

    val pp_set_formatter_out_channel : formatter -> out_channel -> unit

    Redirecting the standard formatter output

    val set_formatter_out_channel : out_channel -> unit

    Redirect the standard pretty-printer output to the given channel. (All the output functions of the standard formatter are set to the default output functions printing to the given channel.)

    set_formatter_out_channel is equivalent to pp_set_formatter_out_channel std_formatter.

    val pp_set_formatter_output_functions : +789A

    because the nested box "@[7@]" is opened after the maximum indentation limit (7>5) and its parent box does not fit on the current line. Either decreasing the length of the parent box to make it fit on a line:

    printf "@[123456@[7@]89@]@." 

    or opening an intermediary box before the maximum indentation limit which fits on the current line

    printf "@[123@[456@[7@]89@]A@]@." 

    avoids the rejection to the left of the inner boxes and print respectively "123456789" and "123456789A" . Note also that vertical boxes never fit on a line whereas horizontal boxes always fully fit on the current line. Opening a box may split a line whereas the contents may have fit. If this behavior is problematic, it can be curtailed by setting the maximum indentation limit to margin - 1. Note that setting the maximum indentation limit to margin is invalid.

    Nothing happens if d is smaller than 2.

    If d is too large, the limit is set to the maximum admissible value (which is greater than 10 ^ 9).

    If d is greater or equal than the current margin, it is ignored, and the current maximum indentation limit is kept.

    See also pp_set_geometry.

    val pp_get_max_indent : formatter -> unit -> int
    val get_max_indent : unit -> int

    Return the maximum indentation limit (in characters).

    Geometry

    Geometric functions can be used to manipulate simultaneously the coupled variables, margin and maxixum indentation limit.

    type geometry = {
    1. max_indent : int;
    2. margin : int;
    }
    • since 4.08
    val check_geometry : geometry -> bool

    Check if the formatter geometry is valid: 1 < max_indent < margin

    • since 4.08
    val pp_set_geometry : formatter -> max_indent:int -> margin:int -> unit
    val set_geometry : max_indent:int -> margin:int -> unit
    val pp_safe_set_geometry : formatter -> max_indent:int -> margin:int -> unit
    val safe_set_geometry : max_indent:int -> margin:int -> unit

    pp_set_geometry ppf ~max_indent ~margin sets both the margin and maximum indentation limit for ppf.

    When 1 < max_indent < margin, pp_set_geometry ppf ~max_indent ~margin is equivalent to pp_set_margin ppf margin; pp_set_max_indent ppf max_indent; and avoids the subtly incorrect pp_set_max_indent ppf max_indent; pp_set_margin ppf margin;

    Outside of this domain, pp_set_geometry raises an invalid argument exception whereas pp_safe_set_geometry does nothing.

    • since 4.08.0
    val pp_update_geometry : formatter -> (geometry -> geometry) -> unit

    pp_update_geometry ppf (fun geo -> { geo with ... }) lets you update a formatter's geometry in a way that is robust to extension of the geometry record with new fields.

    Raises an invalid argument exception if the returned geometry does not satisfy check_geometry.

    • since 4.11.0
    val update_geometry : (geometry -> geometry) -> unit
    val pp_get_geometry : formatter -> unit -> geometry
    val get_geometry : unit -> geometry

    Return the current geometry of the formatter

    • since 4.08.0

    Maximum formatting depth

    The maximum formatting depth is the maximum number of pretty-printing boxes simultaneously open.

    Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

    val pp_set_max_boxes : formatter -> int -> unit
    val set_max_boxes : int -> unit

    pp_set_max_boxes ppf max sets the maximum number of pretty-printing boxes simultaneously open.

    Material inside boxes nested deeper is printed as an ellipsis (more precisely as the text returned by get_ellipsis_text ()).

    Nothing happens if max is smaller than 2.

    val pp_get_max_boxes : formatter -> unit -> int
    val get_max_boxes : unit -> int

    Returns the maximum number of pretty-printing boxes allowed before ellipsis.

    val pp_over_max_boxes : formatter -> unit -> bool
    val over_max_boxes : unit -> bool

    Tests if the maximum number of pretty-printing boxes allowed have already been opened.

    Tabulation boxes

    A tabulation box prints material on lines divided into cells of fixed length. A tabulation box provides a simple way to display vertical columns of left adjusted text.

    This box features command set_tab to define cell boundaries, and command print_tab to move from cell to cell and split the line when there is no more cells to print on the line.

    Note: printing within tabulation box is line directed, so arbitrary line splitting inside a tabulation box leads to poor rendering. Yet, controlled use of tabulation boxes allows simple printing of columns within module Format.

    val pp_open_tbox : formatter -> unit -> unit
    val open_tbox : unit -> unit

    open_tbox () opens a new tabulation box.

    This box prints lines separated into cells of fixed width.

    Inside a tabulation box, special tabulation markers defines points of interest on the line (for instance to delimit cell boundaries). Function Format.set_tab sets a tabulation marker at insertion point.

    A tabulation box features specific tabulation breaks to move to next tabulation marker or split the line. Function Format.print_tbreak prints a tabulation break.

    val pp_close_tbox : formatter -> unit -> unit
    val close_tbox : unit -> unit

    Closes the most recently opened tabulation box.

    val pp_set_tab : formatter -> unit -> unit
    val set_tab : unit -> unit

    Sets a tabulation marker at current insertion point.

    val pp_print_tab : formatter -> unit -> unit
    val print_tab : unit -> unit

    print_tab () emits a 'next' tabulation break hint: if not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right, or the pretty-printer splits the line and insertion point moves to the leftmost tabulation marker.

    It is equivalent to print_tbreak 0 0.

    val pp_print_tbreak : formatter -> int -> int -> unit
    val print_tbreak : int -> int -> unit

    print_tbreak nspaces offset emits a 'full' tabulation break hint.

    If not already set on a tabulation marker, the insertion point moves to the first tabulation marker on the right and the pretty-printer prints nspaces spaces.

    If there is no next tabulation marker on the right, the pretty-printer splits the line at this point, then insertion point moves to the leftmost tabulation marker of the box.

    If the pretty-printer splits the line, offset is added to the current indentation.

    Ellipsis

    val pp_set_ellipsis_text : formatter -> string -> unit
    val set_ellipsis_text : string -> unit

    Set the text of the ellipsis printed when too many pretty-printing boxes are open (a single dot, ., by default).

    val pp_get_ellipsis_text : formatter -> unit -> string
    val get_ellipsis_text : unit -> string

    Return the text of the ellipsis.

    Semantic tags

    type stag = ..

    Semantic tags (or simply tags) are user's defined annotations to associate user's specific operations to printed entities.

    Common usage of semantic tags is text decoration to get specific font or text size rendering for a display device, or marking delimitation of entities (e.g. HTML or TeX elements or terminal escape sequences). More sophisticated usage of semantic tags could handle dynamic modification of the pretty-printer behavior to properly print the material within some specific tags. For instance, we can define an RGB tag like so:

    type stag += RGB of {r:int;g:int;b:int}

    In order to properly delimit printed entities, a semantic tag must be opened before and closed after the entity. Semantic tags must be properly nested like parentheses using pp_open_stag and pp_close_stag.

    Tag specific operations occur any time a tag is opened or closed, At each occurrence, two kinds of operations are performed tag-marking and tag-printing:

    • The tag-marking operation is the simpler tag specific operation: it simply writes a tag specific string into the output device of the formatter. Tag-marking does not interfere with line-splitting computation.
    • The tag-printing operation is the more involved tag specific operation: it can print arbitrary material to the formatter. Tag-printing is tightly linked to the current pretty-printer operations.

    Roughly speaking, tag-marking is commonly used to get a better rendering of texts in the rendering device, while tag-printing allows fine tuning of printing routines to print the same entity differently according to the semantic tags (i.e. print additional material or even omit parts of the output).

    More precisely: when a semantic tag is opened or closed then both and successive 'tag-printing' and 'tag-marking' operations occur:

    • Tag-printing a semantic tag means calling the formatter specific function print_open_stag (resp. print_close_stag) with the name of the tag as argument: that tag-printing function can then print any regular material to the formatter (so that this material is enqueued as usual in the formatter queue for further line splitting computation).
    • Tag-marking a semantic tag means calling the formatter specific function mark_open_stag (resp. mark_close_stag) with the name of the tag as argument: that tag-marking function can then return the 'tag-opening marker' (resp. `tag-closing marker') for direct output into the output device of the formatter.

    Being written directly into the output device of the formatter, semantic tag marker strings are not considered as part of the printing material that drives line splitting (in other words, the length of the strings corresponding to tag markers is considered as zero for line splitting).

    Thus, semantic tag handling is in some sense transparent to pretty-printing and does not interfere with usual indentation. Hence, a single pretty-printing routine can output both simple 'verbatim' material or richer decorated output depending on the treatment of tags. By default, tags are not active, hence the output is not decorated with tag information. Once set_tags is set to true, the pretty-printer engine honors tags and decorates the output accordingly.

    Default tag-marking functions behave the HTML way: string tags are enclosed in "<" and ">" while other tags are ignored; hence, opening marker for tag string "t" is "<t>" and closing marker is "</t>".

    Default tag-printing functions just do nothing.

    Tag-marking and tag-printing functions are user definable and can be set by calling set_formatter_stag_functions.

    Semantic tag operations may be set on or off with set_tags. Tag-marking operations may be set on or off with set_mark_tags. Tag-printing operations may be set on or off with set_print_tags.

    • since 4.08.0
    type tag = string
    type stag +=
    1. | String_tag of tag
      (*

      String_tag s is a string tag s. String tags can be inserted either by explicitly using the constructor String_tag or by using the dedicated format syntax "@{<s> ... @}".

      • since 4.08.0
      *)
    val pp_open_stag : formatter -> stag -> unit
    val open_stag : stag -> unit

    pp_open_stag ppf t opens the semantic tag named t.

    The print_open_stag tag-printing function of the formatter is called with t as argument; then the opening tag marker for t, as given by mark_open_stag t, is written into the output device of the formatter.

    • since 4.08.0
    val pp_close_stag : formatter -> unit -> unit
    val close_stag : unit -> unit

    pp_close_stag ppf () closes the most recently opened semantic tag t.

    The closing tag marker, as given by mark_close_stag t, is written into the output device of the formatter; then the print_close_stag tag-printing function of the formatter is called with t as argument.

    • since 4.08.0
    val pp_set_tags : formatter -> bool -> unit
    val set_tags : bool -> unit

    pp_set_tags ppf b turns on or off the treatment of semantic tags (default is off).

    val pp_set_print_tags : formatter -> bool -> unit
    val set_print_tags : bool -> unit

    pp_set_print_tags ppf b turns on or off the tag-printing operations.

    val pp_set_mark_tags : formatter -> bool -> unit
    val set_mark_tags : bool -> unit

    pp_set_mark_tags ppf b turns on or off the tag-marking operations.

    val pp_get_print_tags : formatter -> unit -> bool
    val get_print_tags : unit -> bool

    Return the current status of tag-printing operations.

    val pp_get_mark_tags : formatter -> unit -> bool
    val get_mark_tags : unit -> bool

    Return the current status of tag-marking operations.

    val pp_set_formatter_out_channel : formatter -> out_channel -> unit

    Redirecting the standard formatter output

    val set_formatter_out_channel : out_channel -> unit

    Redirect the standard pretty-printer output to the given channel. (All the output functions of the standard formatter are set to the default output functions printing to the given channel.)

    set_formatter_out_channel is equivalent to pp_set_formatter_out_channel std_formatter.

    val pp_set_formatter_output_functions : formatter -> (string -> int -> int -> unit) -> (unit -> unit) -> @@ -39,12 +39,17 @@ unit
    val set_formatter_stag_functions : formatter_stag_functions -> unit

    pp_set_formatter_stag_functions ppf tag_funs changes the meaning of opening and closing semantic tag operations to use the functions in tag_funs when printing on ppf.

    When opening a semantic tag with name t, the string t is passed to the opening tag-marking function (the mark_open_stag field of the record tag_funs), that must return the opening tag marker for that name. When the next call to close_stag () happens, the semantic tag name t is sent back to the closing tag-marking function (the mark_close_stag field of record tag_funs), that must return a closing tag marker for that name.

    The print_ field of the record contains the tag-printing functions that are called at tag opening and tag closing time, to output regular material in the pretty-printer queue.

    • since 4.08.0
    val pp_get_formatter_stag_functions : formatter -> unit -> - formatter_stag_functions
    val get_formatter_stag_functions : unit -> formatter_stag_functions

    Return the current semantic tag operation functions of the standard pretty-printer.

    • since 4.08.0

    Defining formatters

    Defining new formatters permits unrelated output of material in parallel on several output devices. All the parameters of a formatter are local to the formatter: right margin, maximum indentation limit, maximum number of pretty-printing boxes simultaneously open, ellipsis, and so on, are specific to each formatter and may be fixed independently.

    For instance, given a Buffer.t buffer b, formatter_of_buffer b returns a new formatter using buffer b as its output device. Similarly, given a Stdlib.out_channel output channel oc, formatter_of_out_channel oc returns a new formatter using channel oc as its output device.

    Alternatively, given out_funs, a complete set of output functions for a formatter, then formatter_of_out_functions out_funs computes a new formatter using those functions for output.

    val formatter_of_out_channel : out_channel -> formatter

    formatter_of_out_channel oc returns a new formatter writing to the corresponding output channel oc.

    val std_formatter : formatter

    The standard formatter to write to standard output.

    It is defined as formatter_of_out_channel Stdlib.stdout.

    val err_formatter : formatter

    A formatter to write to standard error.

    It is defined as formatter_of_out_channel Stdlib.stderr.

    val formatter_of_buffer : Buffer.t -> formatter

    formatter_of_buffer b returns a new formatter writing to buffer b. At the end of pretty-printing, the formatter must be flushed using pp_print_flush or pp_print_newline, to print all the pending material into the buffer.

    val stdbuf : Buffer.t

    The string buffer in which str_formatter writes.

    val str_formatter : formatter

    A formatter to output to the stdbuf string buffer.

    str_formatter is defined as formatter_of_buffer stdbuf.

    val flush_str_formatter : unit -> string

    Returns the material printed with str_formatter, flushes the formatter and resets the corresponding buffer.

    val make_formatter : + formatter_stag_functions
    val get_formatter_stag_functions : unit -> formatter_stag_functions

    Return the current semantic tag operation functions of the standard pretty-printer.

    • since 4.08.0

    Defining formatters

    Defining new formatters permits unrelated output of material in parallel on several output devices. All the parameters of a formatter are local to the formatter: right margin, maximum indentation limit, maximum number of pretty-printing boxes simultaneously open, ellipsis, and so on, are specific to each formatter and may be fixed independently.

    For instance, given a Buffer.t buffer b, formatter_of_buffer b returns a new formatter using buffer b as its output device. Similarly, given a Stdlib.out_channel output channel oc, formatter_of_out_channel oc returns a new formatter using channel oc as its output device.

    Alternatively, given out_funs, a complete set of output functions for a formatter, then formatter_of_out_functions out_funs computes a new formatter using those functions for output.

    val formatter_of_out_channel : out_channel -> formatter

    formatter_of_out_channel oc returns a new formatter writing to the corresponding output channel oc.

    val synchronized_formatter_of_out_channel : + out_channel -> + formatter Domain.DLS.key

    synchronized_formatter_of_out_channel oc returns the key to the domain-local state that holds the domain-local formatter for writing to the corresponding output channel oc.

    When the formatter is used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

    • alert unstable
    val std_formatter : formatter

    The initial domain's standard formatter to write to standard output.

    It is defined as formatter_of_out_channel Stdlib.stdout.

    val get_std_formatter : unit -> formatter

    get_std_formatter () returns the current domain's standard formatter used to write to standard output.

    • since 5.0
    val err_formatter : formatter

    The initial domain's formatter to write to standard error.

    It is defined as formatter_of_out_channel Stdlib.stderr.

    val get_err_formatter : unit -> formatter

    get_err_formatter () returns the current domain's formatter used to write to standard error.

    • since 5.0
    val formatter_of_buffer : Buffer.t -> formatter

    formatter_of_buffer b returns a new formatter writing to buffer b. At the end of pretty-printing, the formatter must be flushed using pp_print_flush or pp_print_newline, to print all the pending material into the buffer.

    val stdbuf : Buffer.t

    The initial domain's string buffer in which str_formatter writes.

    val get_stdbuf : unit -> Buffer.t

    get_stdbuf () returns the current domain's string buffer in which the current domain's string formatter writes.

    • since 5.0
    val str_formatter : formatter

    The initial domain's formatter to output to the stdbuf string buffer.

    str_formatter is defined as formatter_of_buffer stdbuf.

    val get_str_formatter : unit -> formatter

    The current domain's formatter to output to the current domains string buffer.

    • since 5.0
    val flush_str_formatter : unit -> string

    Returns the material printed with str_formatter of the current domain, flushes the formatter and resets the corresponding buffer.

    val make_formatter : (string -> int -> int -> unit) -> (unit -> unit) -> formatter

    make_formatter out flush returns a new formatter that outputs with function out, and flushes with function flush.

    For instance,

    make_formatter
       (Stdlib.output oc)
    -  (fun () -> Stdlib.flush oc)

    returns a formatter to the Stdlib.out_channel oc.

    val formatter_of_out_functions : formatter_out_functions -> formatter

    formatter_of_out_functions out_funs returns a new formatter that writes with the set of output functions out_funs.

    See definition of type formatter_out_functions for the meaning of argument out_funs.

    • since 4.06.0

    Symbolic pretty-printing

    Symbolic pretty-printing is pretty-printing using a symbolic formatter, i.e. a formatter that outputs symbolic pretty-printing items.

    When using a symbolic formatter, all regular pretty-printing activities occur but output material is symbolic and stored in a buffer of output items. At the end of pretty-printing, flushing the output buffer allows post-processing of symbolic output before performing low level output operations.

    In practice, first define a symbolic output buffer b using:

    • let sob = make_symbolic_output_buffer (). Then define a symbolic formatter with:
    • let ppf = formatter_of_symbolic_output_buffer sob

    Use symbolic formatter ppf as usual, and retrieve symbolic items at end of pretty-printing by flushing symbolic output buffer sob with:

    • flush_symbolic_output_buffer sob.
    type symbolic_output_item =
    1. | Output_flush
      (*

      symbolic flush command

      *)
    2. | Output_newline
      (*

      symbolic newline command

      *)
    3. | Output_string of string
      (*

      Output_string s: symbolic output for string s

      *)
    4. | Output_spaces of int
      (*

      Output_spaces n: symbolic command to output n spaces

      *)
    5. | Output_indent of int
      (*

      Output_indent i: symbolic indentation of size i

      *)

    Items produced by symbolic pretty-printers

    • since 4.06.0
    type symbolic_output_buffer

    The output buffer of a symbolic pretty-printer.

    • since 4.06.0
    val make_symbolic_output_buffer : unit -> symbolic_output_buffer

    make_symbolic_output_buffer () returns a fresh buffer for symbolic output.

    • since 4.06.0
    val clear_symbolic_output_buffer : symbolic_output_buffer -> unit

    clear_symbolic_output_buffer sob resets buffer sob.

    • since 4.06.0
    val get_symbolic_output_buffer : + (fun () -> Stdlib.flush oc)

    returns a formatter to the Stdlib.out_channel oc.

    val make_synchronized_formatter : + (string -> int -> int -> unit) -> + (unit -> unit) -> + formatter Domain.DLS.key

    make_synchronized_formatter out flush returns the key to the domain-local state that holds the domain-local formatter that outputs with function out, and flushes with function flush.

    When the formatter is used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

    • since 5.0
    • alert unstable
    val formatter_of_out_functions : formatter_out_functions -> formatter

    formatter_of_out_functions out_funs returns a new formatter that writes with the set of output functions out_funs.

    See definition of type formatter_out_functions for the meaning of argument out_funs.

    • since 4.06.0

    Symbolic pretty-printing

    Symbolic pretty-printing is pretty-printing using a symbolic formatter, i.e. a formatter that outputs symbolic pretty-printing items.

    When using a symbolic formatter, all regular pretty-printing activities occur but output material is symbolic and stored in a buffer of output items. At the end of pretty-printing, flushing the output buffer allows post-processing of symbolic output before performing low level output operations.

    In practice, first define a symbolic output buffer b using:

    • let sob = make_symbolic_output_buffer (). Then define a symbolic formatter with:
    • let ppf = formatter_of_symbolic_output_buffer sob

    Use symbolic formatter ppf as usual, and retrieve symbolic items at end of pretty-printing by flushing symbolic output buffer sob with:

    • flush_symbolic_output_buffer sob.
    type symbolic_output_item =
    1. | Output_flush
      (*

      symbolic flush command

      *)
    2. | Output_newline
      (*

      symbolic newline command

      *)
    3. | Output_string of string
      (*

      Output_string s: symbolic output for string s

      *)
    4. | Output_spaces of int
      (*

      Output_spaces n: symbolic command to output n spaces

      *)
    5. | Output_indent of int
      (*

      Output_indent i: symbolic indentation of size i

      *)

    Items produced by symbolic pretty-printers

    • since 4.06.0
    type symbolic_output_buffer

    The output buffer of a symbolic pretty-printer.

    • since 4.06.0
    val make_symbolic_output_buffer : unit -> symbolic_output_buffer

    make_symbolic_output_buffer () returns a fresh buffer for symbolic output.

    • since 4.06.0
    val clear_symbolic_output_buffer : symbolic_output_buffer -> unit

    clear_symbolic_output_buffer sob resets buffer sob.

    • since 4.06.0
    val get_symbolic_output_buffer : symbolic_output_buffer -> symbolic_output_item list

    get_symbolic_output_buffer sob returns the contents of buffer sob.

    • since 4.06.0
    val flush_symbolic_output_buffer : symbolic_output_buffer -> @@ -78,7 +83,7 @@ formatter -> ('a, 'b) Either.t -> unit

    pp_print_either ~left ~right ppf e prints e on ppf using left if e is Either.Left _ and right if e is Either.Right _.

    • since 4.13

    Formatted pretty-printing

    Module Format provides a complete set of printf like functions for pretty-printing using format string specifications.

    Specific annotations may be added in the format strings to give pretty-printing commands to the pretty-printing engine.

    Those annotations are introduced in the format strings using the @ character. For instance, @ means a space break, @, means a cut, @[ opens a new box, and @] closes the last open box.

    val fprintf : formatter -> ('a, formatter, unit) format -> 'a

    fprintf ff fmt arg1 ... argN formats the arguments arg1 to argN according to the format string fmt, and outputs the resulting string on the formatter ff.

    The format string fmt is a character string which contains three types of objects: plain characters and conversion specifications as specified in the Printf module, and pretty-printing indications specific to the Format module.

    The pretty-printing indication characters are introduced by a @ character, and their meanings are:

    • @[: open a pretty-printing box. The type and offset of the box may be optionally specified with the following syntax: the < character, followed by an optional box type indication, then an optional integer offset, and the closing > character. Pretty-printing box type is one of h, v, hv, b, or hov. 'h' stands for an 'horizontal' pretty-printing box, 'v' stands for a 'vertical' pretty-printing box, 'hv' stands for an 'horizontal/vertical' pretty-printing box, 'b' stands for an 'horizontal-or-vertical' pretty-printing box demonstrating indentation, 'hov' stands a simple 'horizontal-or-vertical' pretty-printing box. For instance, @[<hov 2> opens an 'horizontal-or-vertical' pretty-printing box with indentation 2 as obtained with open_hovbox 2. For more details about pretty-printing boxes, see the various box opening functions open_*box.
    • @]: close the most recently opened pretty-printing box.
    • @,: output a 'cut' break hint, as with print_cut ().
    • @ : output a 'space' break hint, as with print_space ().
    • @;: output a 'full' break hint as with print_break. The nspaces and offset parameters of the break hint may be optionally specified with the following syntax: the < character, followed by an integer nspaces value, then an integer offset, and a closing > character. If no parameters are provided, the good break defaults to a 'space' break hint.
    • @.: flush the pretty-printer and split the line, as with print_newline ().
    • @<n>: print the following item as if it were of length n. Hence, printf "@<0>%s" arg prints arg as a zero length string. If @<n> is not followed by a conversion specification, then the following character of the format is printed as if it were of length n.
    • @\{: open a semantic tag. The name of the tag may be optionally specified with the following syntax: the < character, followed by an optional string specification, and the closing > character. The string specification is any character string that does not contain the closing character '>'. If omitted, the tag name defaults to the empty string. For more details about semantic tags, see the functions open_stag and close_stag.
    • @\}: close the most recently opened semantic tag.
    • @?: flush the pretty-printer as with print_flush (). This is equivalent to the conversion %!.
    • @\n: force a newline, as with force_newline (), not the normal way of pretty-printing, you should prefer using break hints inside a vertical pretty-printing box.

    Note: To prevent the interpretation of a @ character as a pretty-printing indication, escape it with a % character. Old quotation mode @@ is deprecated since it is not compatible with formatted input interpretation of character '@'.

    Example: printf "@[%s@ %d@]@." "x =" 1 is equivalent to open_box (); print_string "x ="; print_space (); - print_int 1; close_box (); print_newline (). It prints x = 1 within a pretty-printing 'horizontal-or-vertical' box.

    val printf : ('a, formatter, unit) format -> 'a

    Same as fprintf above, but output on std_formatter.

    val eprintf : ('a, formatter, unit) format -> 'a

    Same as fprintf above, but output on err_formatter.

    val sprintf : ('a, unit, string) format -> 'a

    Same as printf above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. Note that the pretty-printer queue is flushed at the end of each call to sprintf.

    In case of multiple and related calls to sprintf to output material on a single string, you should consider using fprintf with the predefined formatter str_formatter and call flush_str_formatter () to get the final result.

    Alternatively, you can use Format.fprintf with a formatter writing to a buffer of your own: flushing the formatter and the buffer at the end of pretty-printing returns the desired string.

    val asprintf : ('a, formatter, unit, string) format4 -> 'a

    Same as printf above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. The type of asprintf is general enough to interact nicely with %a conversions.

    • since 4.01.0
    val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a

    Same as fprintf, except the formatter is the last argument. dprintf "..." a b c is a function of type formatter -> unit which can be given to a format specifier %t.

    This can be used as a replacement for asprintf to delay formatting decisions. Using the string returned by asprintf in a formatting context forces formatting decisions to be taken in isolation, and the final string may be created prematurely. dprintf allows delay of formatting decisions until the final formatting context is known. For example:

    let t = Format.dprintf "%i@ %i@ %i" 1 2 3 in
    +   print_int 1; close_box (); print_newline (). It prints x = 1 within a pretty-printing 'horizontal-or-vertical' box.

    val printf : ('a, formatter, unit) format -> 'a

    Same as fprintf above, but output on get_std_formatter ().

    It is defined similarly to fun fmt -> fprintf (get_std_formatter ()) fmt but delays calling get_std_formatter until after the final argument required by the format is received. When used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

    val eprintf : ('a, formatter, unit) format -> 'a

    Same as fprintf above, but output on get_err_formatter ().

    It is defined similarly to fun fmt -> fprintf (get_err_formatter ()) fmt but delays calling get_err_formatter until after the final argument required by the format is received. When used with multiple domains, the output from the domains will be interleaved with each other at points where the formatter is flushed, such as with print_flush.

    val sprintf : ('a, unit, string) format -> 'a

    Same as printf above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. Note that the pretty-printer queue is flushed at the end of each call to sprintf.

    In case of multiple and related calls to sprintf to output material on a single string, you should consider using fprintf with the predefined formatter str_formatter and call flush_str_formatter () to get the final result.

    Alternatively, you can use Format.fprintf with a formatter writing to a buffer of your own: flushing the formatter and the buffer at the end of pretty-printing returns the desired string.

    val asprintf : ('a, formatter, unit, string) format4 -> 'a

    Same as printf above, but instead of printing on a formatter, returns a string containing the result of formatting the arguments. The type of asprintf is general enough to interact nicely with %a conversions.

    • since 4.01.0
    val dprintf : ('a, formatter, unit, formatter -> unit) format4 -> 'a

    Same as fprintf, except the formatter is the last argument. dprintf "..." a b c is a function of type formatter -> unit which can be given to a format specifier %t.

    This can be used as a replacement for asprintf to delay formatting decisions. Using the string returned by asprintf in a formatting context forces formatting decisions to be taken in isolation, and the final string may be created prematurely. dprintf allows delay of formatting decisions until the final formatting context is known. For example:

    let t = Format.dprintf "%i@ %i@ %i" 1 2 3 in
     ...
     Format.printf "@[<v>%t@]" t
    • since 4.08.0
    val ifprintf : formatter -> ('a, formatter, unit) format -> 'a

    Same as fprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

    • since 3.10.0

    Formatted Pretty-Printing with continuations.

    val kfprintf : (formatter -> 'a) -> @@ -91,44 +96,4 @@ Format.printf "@[<v>%t@]" t

    Same as kfprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

    • since 3.12.0
    val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b

    Same as sprintf above, but instead of returning the string, passes it to the first argument.

    val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b

    Same as asprintf above, but instead of returning the string, passes it to the first argument.

    • since 4.03

    Deprecated

    val bprintf : Buffer.t -> ('a, formatter, unit) format -> 'a
    • deprecated

      This function is error prone. Do not use it. This function is neither compositional nor incremental, since it flushes the pretty-printer queue at each call.

      If you need to print to some buffer b, you must first define a formatter writing to b, using let to_b = formatter_of_buffer b; then use regular calls to Format.fprintf with formatter to_b.

    val kprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b
    • deprecated

      An alias for ksprintf.

    val set_all_formatter_output_functions : - out:(string -> int -> int -> unit) -> - flush:(unit -> unit) -> - newline:(unit -> unit) -> - spaces:(int -> unit) -> - unit
    • deprecated

      Subsumed by set_formatter_out_functions.

    val get_all_formatter_output_functions : - unit -> - (string -> - int -> - int -> - unit) - * (unit -> - unit) - * (unit -> - unit) - * (int -> - unit)
    • deprecated

      Subsumed by get_formatter_out_functions.

    val pp_set_all_formatter_output_functions : - formatter -> - out:(string -> int -> int -> unit) -> - flush:(unit -> unit) -> - newline:(unit -> unit) -> - spaces:(int -> unit) -> - unit
    • deprecated

      Subsumed by pp_set_formatter_out_functions.

    val pp_get_all_formatter_output_functions : - formatter -> - unit -> - (string -> - int -> - int -> - unit) - * (unit -> - unit) - * (unit -> - unit) - * (int -> - unit)
    • deprecated

      Subsumed by pp_get_formatter_out_functions.

    String tags

    val pp_open_tag : formatter -> tag -> unit
    val open_tag : tag -> unit
    val pp_close_tag : formatter -> unit -> unit
    val close_tag : unit -> unit
    type formatter_tag_functions = {
    1. mark_open_tag : tag -> string;
    2. mark_close_tag : tag -> string;
    3. print_open_tag : tag -> unit;
    4. print_close_tag : tag -> unit;
    }
    val pp_set_formatter_tag_functions : - formatter -> - formatter_tag_functions -> - unit

    This function will erase non-string tag formatting functions.

    val set_formatter_tag_functions : formatter_tag_functions -> unit
    val pp_get_formatter_tag_functions : - formatter -> - unit -> - formatter_tag_functions
    val get_formatter_tag_functions : unit -> formatter_tag_functions
    \ No newline at end of file + 'b

    Same as kfprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

    • since 3.12.0
    val ksprintf : (string -> 'a) -> ('b, unit, string, 'a) format4 -> 'b

    Same as sprintf above, but instead of returning the string, passes it to the first argument.

    val kasprintf : (string -> 'a) -> ('b, formatter, unit, 'a) format4 -> 'b

    Same as asprintf above, but instead of returning the string, passes it to the first argument.

    • since 4.03
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Gc/index.html b/dev/ocaml/Stdlib/Gc/index.html index 0978e85f..acf8193d 100644 --- a/dev/ocaml/Stdlib/Gc/index.html +++ b/dev/ocaml/Stdlib/Gc/index.html @@ -1,2 +1,2 @@ -Gc (ocaml.Stdlib.Gc)

    Module Stdlib.Gc

    Memory management control and statistics; finalised values.

    type stat = {
    1. minor_words : float;
      (*

      Number of words allocated in the minor heap since the program was started.

      *)
    2. promoted_words : float;
      (*

      Number of words allocated in the minor heap that survived a minor collection and were moved to the major heap since the program was started.

      *)
    3. major_words : float;
      (*

      Number of words allocated in the major heap, including the promoted words, since the program was started.

      *)
    4. minor_collections : int;
      (*

      Number of minor collections since the program was started.

      *)
    5. major_collections : int;
      (*

      Number of major collection cycles completed since the program was started.

      *)
    6. heap_words : int;
      (*

      Total size of the major heap, in words.

      *)
    7. heap_chunks : int;
      (*

      Number of contiguous pieces of memory that make up the major heap.

      *)
    8. live_words : int;
      (*

      Number of words of live data in the major heap, including the header words.

      Note that "live" words refers to every word in the major heap that isn't currently known to be collectable, which includes words that have become unreachable by the program after the start of the previous gc cycle. It is typically much simpler and more predictable to call Gc.full_major (or Gc.compact) then computing gc stats, as then "live" words has the simple meaning of "reachable by the program". One caveat is that a single call to Gc.full_major will not reclaim values that have a finaliser from Gc.finalise (this does not apply to Gc.finalise_last). If this caveat matters, simply call Gc.full_major twice instead of once.

      *)
    9. live_blocks : int;
      (*

      Number of live blocks in the major heap.

      See live_words for a caveat about what "live" means.

      *)
    10. free_words : int;
      (*

      Number of words in the free list.

      *)
    11. free_blocks : int;
      (*

      Number of blocks in the free list.

      *)
    12. largest_free : int;
      (*

      Size (in words) of the largest block in the free list.

      *)
    13. fragments : int;
      (*

      Number of wasted words due to fragmentation. These are 1-words free blocks placed between two live blocks. They are not available for allocation.

      *)
    14. compactions : int;
      (*

      Number of heap compactions since the program was started.

      *)
    15. top_heap_words : int;
      (*

      Maximum size reached by the major heap, in words.

      *)
    16. stack_size : int;
      (*

      Current size of the stack, in words.

      • since 3.12.0
      *)
    17. forced_major_collections : int;
      (*

      Number of forced full major collections completed since the program was started.

      • since 4.12.0
      *)
    }

    The memory management counters are returned in a stat record.

    The total amount of memory allocated by the program since it was started is (in words) minor_words + major_words - promoted_words. Multiply by the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get the number of bytes.

    type control = {
    1. mutable minor_heap_size : int;
      (*

      The size (in words) of the minor heap. Changing this parameter will trigger a minor collection. Default: 256k.

      *)
    2. mutable major_heap_increment : int;
      (*

      How much to add to the major heap when increasing it. If this number is less than or equal to 1000, it is a percentage of the current heap size (i.e. setting it to 100 will double the heap size at each increase). If it is more than 1000, it is a fixed number of words that will be added to the heap. Default: 15.

      *)
    3. mutable space_overhead : int;
      (*

      The major GC speed is computed from this parameter. This is the memory that will be "wasted" because the GC does not immediately collect unreachable blocks. It is expressed as a percentage of the memory used for live data. The GC will work more (use more CPU time and collect blocks more eagerly) if space_overhead is smaller. Default: 120.

      *)
    4. mutable verbose : int;
      (*

      This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:

      • 0x001 Start and end of major GC cycle.
      • 0x002 Minor collection and major GC slice.
      • 0x004 Growing and shrinking of the heap.
      • 0x008 Resizing of stacks and memory manager tables.
      • 0x010 Heap compaction.
      • 0x020 Change of GC parameters.
      • 0x040 Computation of major GC slice size.
      • 0x080 Calling of finalisation functions.
      • 0x100 Bytecode executable and shared library search at start-up.
      • 0x200 Computation of compaction-triggering condition.
      • 0x400 Output GC statistics at program exit. Default: 0.
      *)
    5. mutable max_overhead : int;
      (*

      Heap compaction is triggered when the estimated amount of "wasted" memory is more than max_overhead percent of the amount of live data. If max_overhead is set to 0, heap compaction is triggered at the end of each major GC cycle (this setting is intended for testing purposes only). If max_overhead >= 1000000, compaction is never triggered. If compaction is permanently disabled, it is strongly suggested to set allocation_policy to 2. Default: 500.

      *)
    6. mutable stack_limit : int;
      (*

      The maximum size of the stack (in words). This is only relevant to the byte-code runtime, as the native code runtime uses the operating system's stack. Default: 1024k.

      *)
    7. mutable allocation_policy : int;
      (*

      The policy used for allocating in the major heap. Possible values are 0, 1 and 2.

      • 0 is the next-fit policy, which is usually fast but can result in fragmentation, increasing memory consumption.
      • 1 is the first-fit policy, which avoids fragmentation but has corner cases (in certain realistic workloads) where it is sensibly slower.
      • 2 is the best-fit policy, which is fast and avoids fragmentation. In our experiments it is faster and uses less memory than both next-fit and first-fit. (since OCaml 4.10)

      The default is best-fit.

      On one example that was known to be bad for next-fit and first-fit, next-fit takes 28s using 855Mio of memory, first-fit takes 47s using 566Mio of memory, best-fit takes 27s using 545Mio of memory.

      Note: If you change to next-fit, you may need to reduce the space_overhead setting, for example using 80 instead of the default 120 which is tuned for best-fit. Otherwise, your program will need more memory.

      Note: changing the allocation policy at run-time forces a heap compaction, which is a lengthy operation unless the heap is small (e.g. at the start of the program).

      Default: 2.

      • since 3.11.0
      *)
    8. window_size : int;
      (*

      The size of the window used by the major GC for smoothing out variations in its workload. This is an integer between 1 and 50. Default: 1.

      • since 4.03.0
      *)
    9. custom_major_ratio : int;
      (*

      Target ratio of floating garbage to major heap size for out-of-heap memory held by custom values located in the major heap. The GC speed is adjusted to try to use this much memory for dead values that are not yet collected. Expressed as a percentage of major heap size. The default value keeps the out-of-heap floating garbage about the same size as the in-heap overhead. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 44.

      • since 4.08.0
      *)
    10. custom_minor_ratio : int;
      (*

      Bound on floating garbage for out-of-heap memory held by custom values in the minor heap. A minor GC is triggered when this much memory is held by custom values located in the minor heap. Expressed as a percentage of minor heap size. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 100.

      • since 4.08.0
      *)
    11. custom_minor_max_size : int;
      (*

      Maximum amount of out-of-heap memory for each custom value allocated in the minor heap. When a custom value is allocated on the minor heap and holds more than this many bytes, only this value is counted against custom_minor_ratio and the rest is directly counted against custom_major_ratio. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 8192 bytes.

      • since 4.08.0
      *)
    }

    The GC parameters are given as a control record. Note that these parameters can also be initialised by setting the OCAMLRUNPARAM environment variable. See the documentation of ocamlrun.

    val stat : unit -> stat

    Return the current values of the memory management counters in a stat record. This function examines every heap block to get the statistics.

    val quick_stat : unit -> stat

    Same as stat except that live_words, live_blocks, free_words, free_blocks, largest_free, and fragments are set to 0. This function is much faster than stat because it does not need to go through the heap.

    val counters : unit -> float * float * float

    Return (minor_words, promoted_words, major_words). This function is as fast as quick_stat.

    val minor_words : unit -> float

    Number of words allocated in the minor heap since the program was started. This number is accurate in byte-code programs, but only an approximation in programs compiled to native code.

    In native code this function does not allocate.

    • since 4.04
    val get : unit -> control

    Return the current values of the GC parameters in a control record.

    val set : control -> unit

    set r changes the GC parameters according to the control record r. The normal usage is: Gc.set { (Gc.get()) with Gc.verbose = 0x00d }

    val minor : unit -> unit

    Trigger a minor collection.

    val major_slice : int -> int

    major_slice n Do a minor collection and a slice of major collection. n is the size of the slice: the GC will do enough work to free (on average) n words of memory. If n = 0, the GC will try to do enough work to ensure that the next automatic slice has no work to do. This function returns an unspecified integer (currently: 0).

    val major : unit -> unit

    Do a minor collection and finish the current major collection cycle.

    val full_major : unit -> unit

    Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks.

    val compact : unit -> unit

    Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.

    val print_stat : out_channel -> unit

    Print the current values of the memory management counters (in human-readable form) into the channel argument.

    val allocated_bytes : unit -> float

    Return the total number of bytes allocated since the program was started. It is returned as a float to avoid overflow problems with int on 32-bit machines.

    val get_minor_free : unit -> int

    Return the current size of the free space inside the minor heap.

    • since 4.03.0
    val get_bucket : int -> int

    get_bucket n returns the current size of the n-th future bucket of the GC smoothing system. The unit is one millionth of a full GC.

    • raises Invalid_argument

      if n is negative, return 0 if n is larger than the smoothing window.

    • since 4.03.0
    val get_credit : unit -> int

    get_credit () returns the current size of the "work done in advance" counter of the GC smoothing system. The unit is one millionth of a full GC.

    • since 4.03.0
    val huge_fallback_count : unit -> int

    Return the number of times we tried to map huge pages and had to fall back to small pages. This is always 0 if OCAMLRUNPARAM contains H=1.

    • since 4.03.0
    val finalise : ('a -> unit) -> 'a -> unit

    finalise f v registers f as a finalisation function for v. v must be heap-allocated. f will be called with v as argument at some point between the first time v becomes unreachable (including through weak pointers) and the time v is collected by the GC. Several functions can be registered for the same value, or even several instances of the same function. Each instance will be called once (or never, if the program terminates before v becomes unreachable).

    The GC will call the finalisation functions in the order of deallocation. When several values become unreachable at the same time (i.e. during the same GC cycle), the finalisation functions will be called in the reverse order of the corresponding calls to finalise. If finalise is called in the same order as the values are allocated, that means each value is finalised before the values it depends upon. Of course, this becomes false if additional dependencies are introduced by assignments.

    In the presence of multiple OCaml threads it should be assumed that any particular finaliser may be executed in any of the threads.

    Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected:

    • let v = ... in Gc.finalise (fun _ -> ...v...) v

    Instead you should make sure that v is not in the closure of the finalisation function by writing:

    • let f = fun x -> ... let v = ... in Gc.finalise f v

    The f function can use all features of OCaml, including assignments that make the value reachable again. It can also loop forever (in this case, the other finalisation functions will not be called during the execution of f, unless it calls finalise_release). It can call finalise on v or other values to register other functions or even itself. It can raise an exception; in this case the exception will interrupt whatever the program was doing when the function was called.

    finalise will raise Invalid_argument if v is not guaranteed to be heap-allocated. Some examples of values that are not heap-allocated are integers, constant constructors, booleans, the empty array, the empty list, the unit value. The exact list of what is heap-allocated or not is implementation-dependent. Some constant values can be heap-allocated but never deallocated during the lifetime of the program, for example a list of integer constants; this is also implementation-dependent. Note that values of types float are sometimes allocated and sometimes not, so finalising them is unsafe, and finalise will also raise Invalid_argument for them. Values of type 'a Lazy.t (for any 'a) are like float in this respect, except that the compiler sometimes optimizes them in a way that prevents finalise from detecting them. In this case, it will not raise Invalid_argument, but you should still avoid calling finalise on lazy values.

    The results of calling String.make, Bytes.make, Bytes.create, Array.make, and Stdlib.ref are guaranteed to be heap-allocated and non-constant except when the length argument is 0.

    val finalise_last : (unit -> unit) -> 'a -> unit

    same as finalise except the value is not given as argument. So you can't use the given value for the computation of the finalisation function. The benefit is that the function is called after the value is unreachable for the last time instead of the first time. So contrary to finalise the value will never be reachable again or used again. In particular every weak pointer and ephemeron that contained this value as key or data is unset before running the finalisation function. Moreover the finalisation functions attached with finalise are always called before the finalisation functions attached with finalise_last.

    • since 4.04
    val finalise_release : unit -> unit

    A finalisation function may call finalise_release to tell the GC that it can launch the next finalisation function without waiting for the current one to return.

    type alarm

    An alarm is a piece of data that calls a user function at the end of each major GC cycle. The following functions are provided to create and delete alarms.

    val create_alarm : (unit -> unit) -> alarm

    create_alarm f will arrange for f to be called at the end of each major GC cycle, starting with the current cycle or the next one. A value of type alarm is returned that you can use to call delete_alarm.

    val delete_alarm : alarm -> unit

    delete_alarm a will stop the calls to the function associated to a. Calling delete_alarm a again has no effect.

    val eventlog_pause : unit -> unit

    eventlog_pause () will pause the collection of traces in the runtime. Traces are collected if the program is linked to the instrumented runtime and started with the environment variable OCAML_EVENTLOG_ENABLED. Events are flushed to disk after pausing, and no new events will be recorded until eventlog_resume is called.

    • since 4.11
    val eventlog_resume : unit -> unit

    eventlog_resume () will resume the collection of traces in the runtime. Traces are collected if the program is linked to the instrumented runtime and started with the environment variable OCAML_EVENTLOG_ENABLED. This call can be used after calling eventlog_pause, or if the program was started with OCAML_EVENTLOG_ENABLED=p. (which pauses the collection of traces before the first event.)

    • since 4.11
    module Memprof : sig ... end

    Memprof is a sampling engine for allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

    \ No newline at end of file +Gc (ocaml.Stdlib.Gc)

    Module Stdlib.Gc

    Memory management control and statistics; finalised values.

    type stat = {
    1. minor_words : float;
      (*

      Number of words allocated in the minor heap since the program was started.

      *)
    2. promoted_words : float;
      (*

      Number of words allocated in the minor heap that survived a minor collection and were moved to the major heap since the program was started.

      *)
    3. major_words : float;
      (*

      Number of words allocated in the major heap, including the promoted words, since the program was started.

      *)
    4. minor_collections : int;
      (*

      Number of minor collections since the program was started.

      *)
    5. major_collections : int;
      (*

      Number of major collection cycles completed since the program was started.

      *)
    6. heap_words : int;
      (*

      Total size of the major heap, in words.

      *)
    7. heap_chunks : int;
      (*

      Number of contiguous pieces of memory that make up the major heap.

      *)
    8. live_words : int;
      (*

      Number of words of live data in the major heap, including the header words.

      Note that "live" words refers to every word in the major heap that isn't currently known to be collectable, which includes words that have become unreachable by the program after the start of the previous gc cycle. It is typically much simpler and more predictable to call Gc.full_major (or Gc.compact) then computing gc stats, as then "live" words has the simple meaning of "reachable by the program". One caveat is that a single call to Gc.full_major will not reclaim values that have a finaliser from Gc.finalise (this does not apply to Gc.finalise_last). If this caveat matters, simply call Gc.full_major twice instead of once.

      *)
    9. live_blocks : int;
      (*

      Number of live blocks in the major heap.

      See live_words for a caveat about what "live" means.

      *)
    10. free_words : int;
      (*

      Number of words in the free list.

      *)
    11. free_blocks : int;
      (*

      Number of blocks in the free list.

      *)
    12. largest_free : int;
      (*

      Size (in words) of the largest block in the free list.

      *)
    13. fragments : int;
      (*

      Number of wasted words due to fragmentation. These are 1-words free blocks placed between two live blocks. They are not available for allocation.

      *)
    14. compactions : int;
      (*

      Number of heap compactions since the program was started.

      *)
    15. top_heap_words : int;
      (*

      Maximum size reached by the major heap, in words.

      *)
    16. stack_size : int;
      (*

      Current size of the stack, in words.

      • since 3.12.0
      *)
    17. forced_major_collections : int;
      (*

      Number of forced full major collections completed since the program was started.

      • since 4.12.0
      *)
    }

    The memory management counters are returned in a stat record. These counters give values for the whole program.

    The total amount of memory allocated by the program since it was started is (in words) minor_words + major_words - promoted_words. Multiply by the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get the number of bytes.

    type control = {
    1. minor_heap_size : int;
      (*

      The size (in words) of the minor heap. Changing this parameter will trigger a minor collection. The total size of the minor heap used by this program is the sum of the heap sizes of the active domains. Default: 256k.

      *)
    2. major_heap_increment : int;
      (*

      How much to add to the major heap when increasing it. If this number is less than or equal to 1000, it is a percentage of the current heap size (i.e. setting it to 100 will double the heap size at each increase). If it is more than 1000, it is a fixed number of words that will be added to the heap. Default: 15.

      *)
    3. space_overhead : int;
      (*

      The major GC speed is computed from this parameter. This is the memory that will be "wasted" because the GC does not immediately collect unreachable blocks. It is expressed as a percentage of the memory used for live data. The GC will work more (use more CPU time and collect blocks more eagerly) if space_overhead is smaller. Default: 120.

      *)
    4. verbose : int;
      (*

      This value controls the GC messages on standard error output. It is a sum of some of the following flags, to print messages on the corresponding events:

      • 0x001 Start and end of major GC cycle.
      • 0x002 Minor collection and major GC slice.
      • 0x004 Growing and shrinking of the heap.
      • 0x008 Resizing of stacks and memory manager tables.
      • 0x010 Heap compaction.
      • 0x020 Change of GC parameters.
      • 0x040 Computation of major GC slice size.
      • 0x080 Calling of finalisation functions.
      • 0x100 Bytecode executable and shared library search at start-up.
      • 0x200 Computation of compaction-triggering condition.
      • 0x400 Output GC statistics at program exit. Default: 0.
      *)
    5. max_overhead : int;
      (*

      Heap compaction is triggered when the estimated amount of "wasted" memory is more than max_overhead percent of the amount of live data. If max_overhead is set to 0, heap compaction is triggered at the end of each major GC cycle (this setting is intended for testing purposes only). If max_overhead >= 1000000, compaction is never triggered. If compaction is permanently disabled, it is strongly suggested to set allocation_policy to 2. Default: 500.

      *)
    6. stack_limit : int;
      (*

      The maximum size of the fiber stacks (in words). Default: 1024k.

      *)
    7. allocation_policy : int;
      (*

      The policy used for allocating in the major heap. Possible values are 0, 1 and 2.

      • 0 is the next-fit policy, which is usually fast but can result in fragmentation, increasing memory consumption.
      • 1 is the first-fit policy, which avoids fragmentation but has corner cases (in certain realistic workloads) where it is sensibly slower.
      • 2 is the best-fit policy, which is fast and avoids fragmentation. In our experiments it is faster and uses less memory than both next-fit and first-fit. (since OCaml 4.10)

      The default is best-fit.

      On one example that was known to be bad for next-fit and first-fit, next-fit takes 28s using 855Mio of memory, first-fit takes 47s using 566Mio of memory, best-fit takes 27s using 545Mio of memory.

      Note: If you change to next-fit, you may need to reduce the space_overhead setting, for example using 80 instead of the default 120 which is tuned for best-fit. Otherwise, your program will need more memory.

      Note: changing the allocation policy at run-time forces a heap compaction, which is a lengthy operation unless the heap is small (e.g. at the start of the program).

      Default: 2.

      • since 3.11.0
      *)
    8. window_size : int;
      (*

      The size of the window used by the major GC for smoothing out variations in its workload. This is an integer between 1 and 50. Default: 1.

      • since 4.03.0
      *)
    9. custom_major_ratio : int;
      (*

      Target ratio of floating garbage to major heap size for out-of-heap memory held by custom values located in the major heap. The GC speed is adjusted to try to use this much memory for dead values that are not yet collected. Expressed as a percentage of major heap size. The default value keeps the out-of-heap floating garbage about the same size as the in-heap overhead. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 44.

      • since 4.08.0
      *)
    10. custom_minor_ratio : int;
      (*

      Bound on floating garbage for out-of-heap memory held by custom values in the minor heap. A minor GC is triggered when this much memory is held by custom values located in the minor heap. Expressed as a percentage of minor heap size. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 100.

      • since 4.08.0
      *)
    11. custom_minor_max_size : int;
      (*

      Maximum amount of out-of-heap memory for each custom value allocated in the minor heap. When a custom value is allocated on the minor heap and holds more than this many bytes, only this value is counted against custom_minor_ratio and the rest is directly counted against custom_major_ratio. Note: this only applies to values allocated with caml_alloc_custom_mem (e.g. bigarrays). Default: 8192 bytes.

      • since 4.08.0
      *)
    }

    The GC parameters are given as a control record. Note that these parameters can also be initialised by setting the OCAMLRUNPARAM environment variable. See the documentation of ocamlrun.

    val stat : unit -> stat

    Return the current values of the memory management counters in a stat record that represent the program's total memory stats. This function causes a full major collection.

    val quick_stat : unit -> stat

    Same as stat except that live_words, live_blocks, free_words, free_blocks, largest_free, and fragments are set to 0. Due to per-domain buffers it may only represent the state of the program's total memory usage since the last minor collection. This function is much faster than stat because it does not need to trigger a full major collection.

    val counters : unit -> float * float * float

    Return (minor_words, promoted_words, major_words) for the current domain or potentially previous domains. This function is as fast as quick_stat.

    val minor_words : unit -> float

    Number of words allocated in the minor heap by this domain or potentially previous domains. This number is accurate in byte-code programs, but only an approximation in programs compiled to native code.

    In native code this function does not allocate.

    • since 4.04
    val get : unit -> control

    Return the current values of the GC parameters in a control record.

    • alert unsynchronized_access GC parameters are a mutable global state.
    val set : control -> unit

    set r changes the GC parameters according to the control record r. The normal usage is: Gc.set { (Gc.get()) with Gc.verbose = 0x00d }

    • alert unsynchronized_access GC parameters are a mutable global state.
    val minor : unit -> unit

    Trigger a minor collection.

    val major_slice : int -> int

    major_slice n Do a minor collection and a slice of major collection. n is the size of the slice: the GC will do enough work to free (on average) n words of memory. If n = 0, the GC will try to do enough work to ensure that the next automatic slice has no work to do. This function returns an unspecified integer (currently: 0).

    val major : unit -> unit

    Do a minor collection and finish the current major collection cycle.

    val full_major : unit -> unit

    Do a minor collection, finish the current major collection cycle, and perform a complete new cycle. This will collect all currently unreachable blocks.

    val compact : unit -> unit

    Perform a full major collection and compact the heap. Note that heap compaction is a lengthy operation.

    val print_stat : out_channel -> unit

    Print the current values of the memory management counters (in human-readable form) of the total program into the channel argument.

    val allocated_bytes : unit -> float

    Return the number of bytes allocated by this domain and potentially a previous domain. It is returned as a float to avoid overflow problems with int on 32-bit machines.

    val get_minor_free : unit -> int

    Return the current size of the free space inside the minor heap of this domain.

    • since 4.03.0
    val finalise : ('a -> unit) -> 'a -> unit

    finalise f v registers f as a finalisation function for v. v must be heap-allocated. f will be called with v as argument at some point between the first time v becomes unreachable (including through weak pointers) and the time v is collected by the GC. Several functions can be registered for the same value, or even several instances of the same function. Each instance will be called once (or never, if the program terminates before v becomes unreachable).

    The GC will call the finalisation functions in the order of deallocation. When several values become unreachable at the same time (i.e. during the same GC cycle), the finalisation functions will be called in the reverse order of the corresponding calls to finalise. If finalise is called in the same order as the values are allocated, that means each value is finalised before the values it depends upon. Of course, this becomes false if additional dependencies are introduced by assignments.

    In the presence of multiple OCaml threads it should be assumed that any particular finaliser may be executed in any of the threads.

    Anything reachable from the closure of finalisation functions is considered reachable, so the following code will not work as expected:

    • let v = ... in Gc.finalise (fun _ -> ...v...) v

    Instead you should make sure that v is not in the closure of the finalisation function by writing:

    • let f = fun x -> ... let v = ... in Gc.finalise f v

    The f function can use all features of OCaml, including assignments that make the value reachable again. It can also loop forever (in this case, the other finalisation functions will not be called during the execution of f, unless it calls finalise_release). It can call finalise on v or other values to register other functions or even itself. It can raise an exception; in this case the exception will interrupt whatever the program was doing when the function was called.

    finalise will raise Invalid_argument if v is not guaranteed to be heap-allocated. Some examples of values that are not heap-allocated are integers, constant constructors, booleans, the empty array, the empty list, the unit value. The exact list of what is heap-allocated or not is implementation-dependent. Some constant values can be heap-allocated but never deallocated during the lifetime of the program, for example a list of integer constants; this is also implementation-dependent. Note that values of types float are sometimes allocated and sometimes not, so finalising them is unsafe, and finalise will also raise Invalid_argument for them. Values of type 'a Lazy.t (for any 'a) are like float in this respect, except that the compiler sometimes optimizes them in a way that prevents finalise from detecting them. In this case, it will not raise Invalid_argument, but you should still avoid calling finalise on lazy values.

    The results of calling String.make, Bytes.make, Bytes.create, Array.make, and Stdlib.ref are guaranteed to be heap-allocated and non-constant except when the length argument is 0.

    val finalise_last : (unit -> unit) -> 'a -> unit

    same as finalise except the value is not given as argument. So you can't use the given value for the computation of the finalisation function. The benefit is that the function is called after the value is unreachable for the last time instead of the first time. So contrary to finalise the value will never be reachable again or used again. In particular every weak pointer and ephemeron that contained this value as key or data is unset before running the finalisation function. Moreover the finalisation functions attached with finalise are always called before the finalisation functions attached with finalise_last.

    • since 4.04
    val finalise_release : unit -> unit

    A finalisation function may call finalise_release to tell the GC that it can launch the next finalisation function without waiting for the current one to return.

    type alarm

    An alarm is a piece of data that calls a user function at the end of each major GC cycle. The following functions are provided to create and delete alarms.

    val create_alarm : (unit -> unit) -> alarm

    create_alarm f will arrange for f to be called at the end of each major GC cycle, starting with the current cycle or the next one. A value of type alarm is returned that you can use to call delete_alarm.

    val delete_alarm : alarm -> unit

    delete_alarm a will stop the calls to the function associated to a. Calling delete_alarm a again has no effect.

    val eventlog_pause : unit -> unit
    • deprecated Use Runtime_events.pause instead.
    val eventlog_resume : unit -> unit
    • deprecated Use Runtime_events.resume instead.
    module Memprof : sig ... end

    Memprof is a sampling engine for allocated memory words. Every allocated word has a probability of being sampled equal to a configurable sampling rate. Once a block is sampled, it becomes tracked. A tracked block triggers a user-defined callback as soon as it is allocated, promoted or deallocated.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Genlex/index.html b/dev/ocaml/Stdlib/Genlex/index.html deleted file mode 100644 index 5c94d5dc..00000000 --- a/dev/ocaml/Stdlib/Genlex/index.html +++ /dev/null @@ -1,9 +0,0 @@ - -Genlex (ocaml.Stdlib.Genlex)

    Module Stdlib.Genlex

    • deprecated Use the camlp-streams library instead.

    A generic lexical analyzer.

    This module implements a simple 'standard' lexical analyzer, presented as a function from character streams to token streams. It implements roughly the lexical conventions of OCaml, but is parameterized by the set of keywords of your language.

    Example: a lexer suitable for a desk calculator is obtained by

    let lexer = make_lexer ["+"; "-"; "*"; "/"; "let"; "="; "("; ")"]

    The associated parser would be a function from token stream to, for instance, int, and would have rules such as:

    let rec parse_expr = parser
    -  | [< n1 = parse_atom; n2 = parse_remainder n1 >] -> n2
    -and parse_atom = parser
    -  | [< 'Int n >] -> n
    -  | [< 'Kwd "("; n = parse_expr; 'Kwd ")" >] -> n
    -and parse_remainder n1 = parser
    -  | [< 'Kwd "+"; n2 = parse_expr >] -> n1 + n2
    -  | [< >] -> n1

    One should notice that the use of the parser keyword and associated notation for streams are only available through camlp4 extensions. This means that one has to preprocess its sources e. g. by using the "-pp" command-line switch of the compilers.

    type token =
    1. | Kwd of string
    2. | Ident of string
    3. | Int of int
    4. | Float of float
    5. | String of string
    6. | Char of char

    The type of tokens. The lexical classes are: Int and Float for integer and floating-point numbers; String for string literals, enclosed in double quotes; Char for character literals, enclosed in single quotes; Ident for identifiers (either sequences of letters, digits, underscores and quotes, or sequences of 'operator characters' such as +, *, etc); and Kwd for keywords (either identifiers or single 'special characters' such as (, }, etc).

    val make_lexer : string list -> char Stream.t -> token Stream.t

    Construct the lexer function. The first argument is the list of keywords. An identifier s is returned as Kwd s if s belongs to this list, and as Ident s otherwise. A special character s is returned as Kwd s if s belongs to this list, and cause a lexical error (exception Stream.Error with the offending lexeme as its parameter) otherwise. Blanks and newlines are skipped. Comments delimited by (* and *) are skipped as well, and can be nested. A Stream.Failure exception is raised if end of stream is unexpectedly reached.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/argument-1-H/index.html b/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/argument-1-H/index.html index 6989c345..38714135 100644 --- a/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/argument-1-H/index.html +++ b/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/argument-1-H/index.html @@ -1,2 +1,2 @@ -H (ocaml.Stdlib.Hashtbl.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +H (ocaml.Stdlib.Hashtbl.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/index.html b/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/index.html index 8b382484..7010d928 100644 --- a/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/index.html +++ b/dev/ocaml/Stdlib/Hashtbl/MakeSeeded/index.html @@ -1,2 +1,2 @@ -MakeSeeded (ocaml.Stdlib.Hashtbl.MakeSeeded)

    Module Hashtbl.MakeSeeded

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    • since 4.00.0

    Parameters

    Signature

    type key = H.t
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    • since 4.05.0
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • since 4.03.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    val length : 'a t -> int
    val stats : 'a t -> statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • since 4.07
    val to_seq_keys : _ t -> key Seq.t
    • since 4.07
    val to_seq_values : 'a t -> 'a Seq.t
    • since 4.07
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t
    • since 4.07
    \ No newline at end of file +MakeSeeded (ocaml.Stdlib.Hashtbl.MakeSeeded)

    Module Hashtbl.MakeSeeded

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    • since 4.00.0

    Parameters

    Signature

    type key = H.t
    type !'a t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key -> 'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    • since 4.05.0
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key -> 'a -> unit
    val mem : 'a t -> key -> bool
    val iter : (key -> 'a -> unit) -> 'a t -> unit
    val filter_map_inplace : (key -> 'a -> 'a option) -> 'a t -> unit
    • since 4.03.0
    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
    val length : 'a t -> int
    val stats : 'a t -> statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • since 4.07
    val to_seq_keys : _ t -> key Seq.t
    • since 4.07
    val to_seq_values : 'a t -> 'a Seq.t
    • since 4.07
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t
    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Hashtbl/index.html b/dev/ocaml/Stdlib/Hashtbl/index.html index 6998ade7..721a87d6 100644 --- a/dev/ocaml/Stdlib/Hashtbl/index.html +++ b/dev/ocaml/Stdlib/Hashtbl/index.html @@ -1,5 +1,5 @@ -Hashtbl (ocaml.Stdlib.Hashtbl)

    Module Stdlib.Hashtbl

    Hash tables and hash functions.

    Hash tables are hashed association tables, with in-place modification.

    Generic interface

    type (!'a, !'b) t

    The type of hash tables from type 'a to type 'b.

    val create : ?random:bool -> int -> ('a, 'b) t

    Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

    The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

    A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

    A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

    If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

    • before 4.00.0

      the ~random parameter was not present and all hash tables were created in non-randomized mode.

    val clear : ('a, 'b) t -> unit

    Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

    val reset : ('a, 'b) t -> unit

    Empty a hash table and shrink the size of the bucket table to its initial size.

    • since 4.00.0
    val copy : ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable.

    val add : ('a, 'b) t -> 'a -> 'b -> unit

    Hashtbl.add tbl key data adds a binding of key to data in table tbl. Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

    val find : ('a, 'b) t -> 'a -> 'b

    Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

    val find_opt : ('a, 'b) t -> 'a -> 'b option

    Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

    • since 4.05
    val find_all : ('a, 'b) t -> 'a -> 'b list

    Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

    val mem : ('a, 'b) t -> 'a -> bool

    Hashtbl.mem tbl x checks if x is bound in tbl.

    val remove : ('a, 'b) t -> 'a -> unit

    Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

    val replace : ('a, 'b) t -> 'a -> 'b -> unit

    Hashtbl.replace tbl key data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

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

    Hashtbl.iter f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit

    Hashtbl.filter_map_inplace f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

    Other comments for iter apply as well.

    • since 4.03.0
    val fold : ('a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c

    Hashtbl.fold f tbl init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val length : ('a, 'b) t -> int

    Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

    val randomize : unit -> unit

    After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

    It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time.

    Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

    • since 4.00.0
    val is_randomized : unit -> bool

    Return true if the tables are currently created in randomized mode by default, false otherwise.

    • since 4.03.0
    val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

    rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

    • since 4.12.0
    type statistics = {
    1. num_bindings : int;
      (*

      Number of bindings present in the table. Same value as returned by length.

      *)
    2. num_buckets : int;
      (*

      Number of buckets in the table.

      *)
    3. max_bucket_length : int;
      (*

      Maximal number of bindings per bucket.

      *)
    4. bucket_histogram : int array;
      (*

      Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

      *)
    }
    • since 4.00.0
    val stats : ('a, 'b) t -> statistics

    Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

    • since 4.00.0

    Hash tables and Sequences

    val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

    Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

    The behavior is not specified if the hash table is modified during the iteration.

    • since 4.07
    val to_seq_keys : ('a, _) t -> 'a Seq.t

    Same as Seq.map fst (to_seq m)

    • since 4.07
    val to_seq_values : (_, 'b) t -> 'b Seq.t

    Same as Seq.map snd (to_seq m)

    • since 4.07
    val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using add

    • since 4.07
    val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using replace

    • since 4.07
    val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

    Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

    • since 4.07

    Functorial interface

    The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

    For instance, one might want to specialize a table for integer keys:

    module IntHash =
    +Hashtbl (ocaml.Stdlib.Hashtbl)

    Module Stdlib.Hashtbl

    Hash tables and hash functions.

    Hash tables are hashed association tables, with in-place modification.

    Unsynchronized accesses

    Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

    Generic interface

    type (!'a, !'b) t

    The type of hash tables from type 'a to type 'b.

    val create : ?random:bool -> int -> ('a, 'b) t

    Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

    The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

    A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

    A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

    If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

    • before 4.00.0

      the ~random parameter was not present and all hash tables were created in non-randomized mode.

    val clear : ('a, 'b) t -> unit

    Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

    val reset : ('a, 'b) t -> unit

    Empty a hash table and shrink the size of the bucket table to its initial size.

    • since 4.00.0
    val copy : ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable.

    val add : ('a, 'b) t -> 'a -> 'b -> unit

    Hashtbl.add tbl key data adds a binding of key to data in table tbl. Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

    val find : ('a, 'b) t -> 'a -> 'b

    Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

    val find_opt : ('a, 'b) t -> 'a -> 'b option

    Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

    • since 4.05
    val find_all : ('a, 'b) t -> 'a -> 'b list

    Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

    val mem : ('a, 'b) t -> 'a -> bool

    Hashtbl.mem tbl x checks if x is bound in tbl.

    val remove : ('a, 'b) t -> 'a -> unit

    Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

    val replace : ('a, 'b) t -> 'a -> 'b -> unit

    Hashtbl.replace tbl key data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

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

    Hashtbl.iter f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val filter_map_inplace : ('a -> 'b -> 'b option) -> ('a, 'b) t -> unit

    Hashtbl.filter_map_inplace f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

    Other comments for iter apply as well.

    • since 4.03.0
    val fold : ('a -> 'b -> 'c -> 'c) -> ('a, 'b) t -> 'c -> 'c

    Hashtbl.fold f tbl init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val length : ('a, 'b) t -> int

    Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

    val randomize : unit -> unit

    After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

    It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time before any domains are created.

    Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

    • since 4.00.0
    val is_randomized : unit -> bool

    Return true if the tables are currently created in randomized mode by default, false otherwise.

    • since 4.03.0
    val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

    rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

    • since 4.12.0
    type statistics = {
    1. num_bindings : int;
      (*

      Number of bindings present in the table. Same value as returned by length.

      *)
    2. num_buckets : int;
      (*

      Number of buckets in the table.

      *)
    3. max_bucket_length : int;
      (*

      Maximal number of bindings per bucket.

      *)
    4. bucket_histogram : int array;
      (*

      Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

      *)
    }
    • since 4.00.0
    val stats : ('a, 'b) t -> statistics

    Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

    • since 4.00.0

    Hash tables and Sequences

    val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

    Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

    The behavior is not specified if the hash table is modified during the iteration.

    • since 4.07
    val to_seq_keys : ('a, _) t -> 'a Seq.t

    Same as Seq.map fst (to_seq m)

    • since 4.07
    val to_seq_values : (_, 'b) t -> 'b Seq.t

    Same as Seq.map snd (to_seq m)

    • since 4.07
    val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using add

    • since 4.07
    val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using replace

    • since 4.07
    val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

    Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

    • since 4.07

    Functorial interface

    The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

    For instance, one might want to specialize a table for integer keys:

    module IntHash =
       struct
         type t = int
         let equal i j = i=j
    @@ -10,4 +10,4 @@ module IntHashtbl = Hashtbl.Make(IntHash)
     
     let h = IntHashtbl.create 17 in
     IntHashtbl.add h 12 "hello"

    This creates a new module IntHashtbl, with a new type 'a - IntHashtbl.t of tables from int to 'a. In this example, h contains string values so its type is string IntHashtbl.t.

    Note that the new type 'a IntHashtbl.t is not compatible with the type ('a,'b) Hashtbl.t of the generic interface. For example, Hashtbl.length h would not type-check, you must use IntHashtbl.length.

    module type HashedType = sig ... end

    The input signature of the functor Make.

    module type S = sig ... end

    The output signature of the functor Make.

    module Make (H : HashedType) : S with type key = H.t

    Functor building an implementation of the hashtable structure. The functor Hashtbl.Make returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument H instead of generic equality and hashing. Since the hash function is not seeded, the create operation of the result structure always returns non-randomized hash tables.

    module type SeededHashedType = sig ... end

    The input signature of the functor MakeSeeded.

    module type SeededS = sig ... end

    The output signature of the functor MakeSeeded.

    module MakeSeeded (H : SeededHashedType) : SeededS with type key = H.t

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    The polymorphic hash functions

    val hash : 'a -> int

    Hashtbl.hash x associates a nonnegative integer to any value of any type. It is guaranteed that if x = y or Stdlib.compare x y = 0, then hash x = hash y. Moreover, hash always terminates, even on cyclic structures.

    val seeded_hash : int -> 'a -> int

    A variant of hash that is further parameterized by an integer seed.

    • since 4.00.0
    val hash_param : int -> int -> 'a -> int

    Hashtbl.hash_param meaningful total x computes a hash value for x, with the same properties as for hash. The two extra integer parameters meaningful and total give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure x, stopping after meaningful meaningful nodes were encountered, or total nodes (meaningful or not) were encountered. If total as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of meaningful and total means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters meaningful and total govern the tradeoff between accuracy and speed. As default choices, hash and seeded_hash take meaningful = 10 and total = 100.

    val seeded_hash_param : int -> int -> int -> 'a -> int

    A variant of hash_param that is further parameterized by an integer seed. Usage: Hashtbl.seeded_hash_param meaningful total seed x.

    • since 4.00.0
    \ No newline at end of file + IntHashtbl.t
    of tables from int to 'a. In this example, h contains string values so its type is string IntHashtbl.t.

    Note that the new type 'a IntHashtbl.t is not compatible with the type ('a,'b) Hashtbl.t of the generic interface. For example, Hashtbl.length h would not type-check, you must use IntHashtbl.length.

    module type HashedType = sig ... end

    The input signature of the functor Make.

    module type S = sig ... end

    The output signature of the functor Make.

    module Make (H : HashedType) : S with type key = H.t

    Functor building an implementation of the hashtable structure. The functor Hashtbl.Make returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument H instead of generic equality and hashing. Since the hash function is not seeded, the create operation of the result structure always returns non-randomized hash tables.

    module type SeededHashedType = sig ... end

    The input signature of the functor MakeSeeded.

    module type SeededS = sig ... end

    The output signature of the functor MakeSeeded.

    module MakeSeeded (H : SeededHashedType) : SeededS with type key = H.t

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    The polymorphic hash functions

    val hash : 'a -> int

    Hashtbl.hash x associates a nonnegative integer to any value of any type. It is guaranteed that if x = y or Stdlib.compare x y = 0, then hash x = hash y. Moreover, hash always terminates, even on cyclic structures.

    val seeded_hash : int -> 'a -> int

    A variant of hash that is further parameterized by an integer seed.

    • since 4.00.0
    val hash_param : int -> int -> 'a -> int

    Hashtbl.hash_param meaningful total x computes a hash value for x, with the same properties as for hash. The two extra integer parameters meaningful and total give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure x, stopping after meaningful meaningful nodes were encountered, or total nodes (meaningful or not) were encountered. If total as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of meaningful and total means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters meaningful and total govern the tradeoff between accuracy and speed. As default choices, hash and seeded_hash take meaningful = 10 and total = 100.

    val seeded_hash_param : int -> int -> int -> 'a -> int

    A variant of hash_param that is further parameterized by an integer seed. Usage: Hashtbl.seeded_hash_param meaningful total seed x.

    • since 4.00.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Hashtbl/module-type-SeededHashedType/index.html b/dev/ocaml/Stdlib/Hashtbl/module-type-SeededHashedType/index.html index d6d0c144..4612902b 100644 --- a/dev/ocaml/Stdlib/Hashtbl/module-type-SeededHashedType/index.html +++ b/dev/ocaml/Stdlib/Hashtbl/module-type-SeededHashedType/index.html @@ -1,2 +1,2 @@ -SeededHashedType (ocaml.Stdlib.Hashtbl.SeededHashedType)

    Module type Hashtbl.SeededHashedType

    The input signature of the functor MakeSeeded.

    • since 4.00.0
    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +SeededHashedType (ocaml.Stdlib.Hashtbl.SeededHashedType)

    Module type Hashtbl.SeededHashedType

    The input signature of the functor MakeSeeded.

    • since 4.00.0
    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/In_channel/index.html b/dev/ocaml/Stdlib/In_channel/index.html index a27d2695..eeea39a3 100644 --- a/dev/ocaml/Stdlib/In_channel/index.html +++ b/dev/ocaml/Stdlib/In_channel/index.html @@ -1,3 +1,3 @@ In_channel (ocaml.Stdlib.In_channel)

    Module Stdlib.In_channel

    Input channels.

    • since 4.14.0
    type t = in_channel

    The type of input channel.

    type open_flag = open_flag =
    1. | Open_rdonly
      (*

      open for reading.

      *)
    2. | Open_wronly
      (*

      open for writing.

      *)
    3. | Open_append
      (*

      open for appending: always write at end of file.

      *)
    4. | Open_creat
      (*

      create the file if it does not exist.

      *)
    5. | Open_trunc
      (*

      empty the file if it already exists.

      *)
    6. | Open_excl
      (*

      fail if Open_creat and the file already exists.

      *)
    7. | Open_binary
      (*

      open in binary mode (no conversion).

      *)
    8. | Open_text
      (*

      open in text mode (may perform conversions).

      *)
    9. | Open_nonblock
      (*

      open in non-blocking mode.

      *)

    Opening modes for open_gen.

    val stdin : t

    The standard input for the process.

    val open_bin : string -> t

    Open the named file for reading, and return a new input channel on that file, positioned at the beginning of the file.

    val open_text : string -> t

    Same as open_bin, but the file is opened in text mode, so that newline translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like open_bin.

    val open_gen : open_flag list -> int -> string -> t

    open_gen mode perm filename opens the named file for reading, as described above. The extra arguments mode and perm specify the opening mode and file permissions. open_text and open_bin are special cases of this function.

    val with_open_bin : string -> (t -> 'a) -> 'a

    with_open_bin fn f opens a channel ic on file fn and returns f - ic. After f returns, either with a value or by raising an exception, ic is guaranteed to be closed.

    val with_open_text : string -> (t -> 'a) -> 'a

    Like with_open_bin, but the channel is opened in text mode (see open_text).

    val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

    Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

    val seek : t -> int64 -> unit

    seek chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

    val pos : t -> int64

    Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

    val length : t -> int64

    Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

    val close : t -> unit

    Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close, which does nothing when applied to an already closed channel.

    val close_noerr : t -> unit

    Same as close, but ignore all errors.

    val input_char : t -> char option

    Read one character from the given input channel. Returns None if there are no more characters to read.

    val input_byte : t -> int option

    Same as input_char, but return the 8-bit integer representing the character. Returns None if the end of file was reached.

    val input_line : t -> string option

    input_line ic reads characters from ic until a newline or the end of file is reached. Returns the string of all characters read, without the newline (if any). Returns None if the end of the file has been reached. In particular, this will be the case if the last line of input is empty.

    A newline is the character \n unless the file is open in text mode and Sys.win32 is true in which case it is the sequence of characters \r\n.

    val input : t -> bytes -> int -> int -> int

    input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached.

    Use really_input to read exactly len characters.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val really_input : t -> bytes -> int -> int -> unit option

    really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

    Returns None if the end of file is reached before len characters have been read.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val really_input_string : t -> int -> string option

    really_input_string ic len reads len characters from channel ic and returns them in a new string. Returns None if the end of file is reached before len characters have been read.

    val input_all : t -> string

    input_all ic reads all remaining data from ic.

    val set_binary_mode : t -> bool -> unit

    set_binary_mode ic true sets the channel ic to binary mode: no translations take place during input.

    set_binary_mode ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n.

    This function has no effect under operating systems that do not distinguish between text mode and binary mode.

    \ No newline at end of file + ic. After f returns, either with a value or by raising an exception, ic is guaranteed to be closed.

    val with_open_text : string -> (t -> 'a) -> 'a

    Like with_open_bin, but the channel is opened in text mode (see open_text).

    val with_open_gen : open_flag list -> int -> string -> (t -> 'a) -> 'a

    Like with_open_bin, but can specify the opening mode and file permission, in case the file must be created (see open_gen).

    val seek : t -> int64 -> unit

    seek chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

    val pos : t -> int64

    Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos, then going back to this position using seek will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

    val length : t -> int64

    Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

    val close : t -> unit

    Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close, which does nothing when applied to an already closed channel.

    val close_noerr : t -> unit

    Same as close, but ignore all errors.

    val input_char : t -> char option

    Read one character from the given input channel. Returns None if there are no more characters to read.

    val input_byte : t -> int option

    Same as input_char, but return the 8-bit integer representing the character. Returns None if the end of file was reached.

    val input_line : t -> string option

    input_line ic reads characters from ic until a newline or the end of file is reached. Returns the string of all characters read, without the newline (if any). Returns None if the end of the file has been reached. In particular, this will be the case if the last line of input is empty.

    A newline is the character \n unless the file is open in text mode and Sys.win32 is true in which case it is the sequence of characters \r\n.

    val input : t -> bytes -> int -> int -> int

    input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached.

    Use really_input to read exactly len characters.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val really_input : t -> bytes -> int -> int -> unit option

    really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

    Returns None if the end of file is reached before len characters have been read.

    If the same channel is read concurrently by multiple threads, the bytes read by really_input are not guaranteed to be contiguous.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val really_input_string : t -> int -> string option

    really_input_string ic len reads len characters from channel ic and returns them in a new string. Returns None if the end of file is reached before len characters have been read.

    If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

    val input_all : t -> string

    input_all ic reads all remaining data from ic.

    If the same channel is read concurrently by multiple threads, the returned string is not guaranteed to contain contiguous characters from the input.

    val set_binary_mode : t -> bool -> unit

    set_binary_mode ic true sets the channel ic to binary mode: no translations take place during input.

    set_binary_mode ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n.

    This function has no effect under operating systems that do not distinguish between text mode and binary mode.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Int32/index.html b/dev/ocaml/Stdlib/Int32/index.html index b2f211e7..84a105d1 100644 --- a/dev/ocaml/Stdlib/Int32/index.html +++ b/dev/ocaml/Stdlib/Int32/index.html @@ -1,4 +1,4 @@ Int32 (ocaml.Stdlib.Int32)

    Module Stdlib.Int32

    32-bit integers.

    This module provides operations on the type int32 of signed 32-bit integers. Unlike the built-in int type, the type int32 is guaranteed to be exactly 32-bit wide on all platforms. All arithmetic operations over int32 are taken modulo 232.

    Performance notice: values of type int32 occupy more memory space than values of type int, and arithmetic operations on int32 are generally slower than those on int. Use int32 only when the application requires exact 32-bit arithmetic.

    Literals for 32-bit integers are suffixed by l:

    let zero: int32 = 0l
     let one: int32 = 1l
    -let m_one: int32 = -1l
    val zero : int32

    The 32-bit integer 0.

    val one : int32

    The 32-bit integer 1.

    val minus_one : int32

    The 32-bit integer -1.

    val neg : int32 -> int32

    Unary negation.

    val add : int32 -> int32 -> int32

    Addition.

    val sub : int32 -> int32 -> int32

    Subtraction.

    val mul : int32 -> int32 -> int32

    Multiplication.

    val div : int32 -> int32 -> int32

    Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

    • raises Division_by_zero

      if the second argument is zero.

    val unsigned_div : int32 -> int32 -> int32

    Same as div, except that arguments and result are interpreted as unsigned 32-bit integers.

    • since 4.08.0
    val rem : int32 -> int32 -> int32

    Integer remainder. If y is not zero, the result of Int32.rem x y satisfies the following property: x = Int32.add (Int32.mul (Int32.div x y) y) (Int32.rem x y). If y = 0, Int32.rem x y raises Division_by_zero.

    val unsigned_rem : int32 -> int32 -> int32

    Same as rem, except that arguments and result are interpreted as unsigned 32-bit integers.

    • since 4.08.0
    val succ : int32 -> int32

    Successor. Int32.succ x is Int32.add x Int32.one.

    val pred : int32 -> int32

    Predecessor. Int32.pred x is Int32.sub x Int32.one.

    val abs : int32 -> int32

    Return the absolute value of its argument.

    val max_int : int32

    The greatest representable 32-bit integer, 231 - 1.

    val min_int : int32

    The smallest representable 32-bit integer, -231.

    val logand : int32 -> int32 -> int32

    Bitwise logical and.

    val logor : int32 -> int32 -> int32

    Bitwise logical or.

    val logxor : int32 -> int32 -> int32

    Bitwise logical exclusive or.

    val lognot : int32 -> int32

    Bitwise logical negation.

    val shift_left : int32 -> int -> int32

    Int32.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= 32.

    val shift_right : int32 -> int -> int32

    Int32.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 32.

    val shift_right_logical : int32 -> int -> int32

    Int32.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 32.

    val of_int : int -> int32

    Convert the given integer (type int) to a 32-bit integer (type int32). On 64-bit platforms, the argument is taken modulo 232.

    val to_int : int32 -> int

    Convert the given 32-bit integer (type int32) to an integer (type int). On 32-bit platforms, the 32-bit integer is taken modulo 231, i.e. the high-order bit is lost during the conversion. On 64-bit platforms, the conversion is exact.

    val unsigned_to_int : int32 -> int option

    Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

    • since 4.08.0
    val of_float : float -> int32

    Convert the given floating-point number to a 32-bit integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Int32.min_int, Int32.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

    val to_float : int32 -> float

    Convert the given 32-bit integer to a floating-point number.

    val of_string : string -> int32

    Convert the given string to a 32-bit integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*Int32.max_int+1]. If the input exceeds Int32.max_int it is converted to the signed integer Int32.min_int + input - Int32.max_int - 1.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    • raises Failure

      if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int32.

    val of_string_opt : string -> int32 option

    Same as of_string, but return None instead of raising.

    • since 4.05
    val to_string : int32 -> string

    Return the string representation of its argument, in signed decimal.

    val bits_of_float : float -> int32

    Return the internal representation of the given float according to the IEEE 754 floating-point 'single format' bit layout. Bit 31 of the result represents the sign of the float; bits 30 to 23 represent the (biased) exponent; bits 22 to 0 represent the mantissa.

    val float_of_bits : int32 -> float

    Return the floating-point number whose internal representation, according to the IEEE 754 floating-point 'single format' bit layout, is the given int32.

    type t = int32

    An alias for the type of 32-bit integers.

    val compare : t -> t -> int

    The comparison function for 32-bit integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Int32 to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned 32-bit integers.

    • since 4.08.0
    val equal : t -> t -> bool

    The equal function for int32s.

    • since 4.03.0
    val min : t -> t -> t

    Return the smaller of the two arguments.

    • since 4.13.0
    val max : t -> t -> t

    Return the greater of the two arguments.

    • since 4.13.0
    \ No newline at end of file +let m_one: int32 = -1l
    val zero : int32

    The 32-bit integer 0.

    val one : int32

    The 32-bit integer 1.

    val minus_one : int32

    The 32-bit integer -1.

    val neg : int32 -> int32

    Unary negation.

    val add : int32 -> int32 -> int32

    Addition.

    val sub : int32 -> int32 -> int32

    Subtraction.

    val mul : int32 -> int32 -> int32

    Multiplication.

    val div : int32 -> int32 -> int32

    Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

    • raises Division_by_zero

      if the second argument is zero.

    val unsigned_div : int32 -> int32 -> int32

    Same as div, except that arguments and result are interpreted as unsigned 32-bit integers.

    • since 4.08.0
    val rem : int32 -> int32 -> int32

    Integer remainder. If y is not zero, the result of Int32.rem x y satisfies the following property: x = Int32.add (Int32.mul (Int32.div x y) y) (Int32.rem x y). If y = 0, Int32.rem x y raises Division_by_zero.

    val unsigned_rem : int32 -> int32 -> int32

    Same as rem, except that arguments and result are interpreted as unsigned 32-bit integers.

    • since 4.08.0
    val succ : int32 -> int32

    Successor. Int32.succ x is Int32.add x Int32.one.

    val pred : int32 -> int32

    Predecessor. Int32.pred x is Int32.sub x Int32.one.

    val abs : int32 -> int32

    abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

    val max_int : int32

    The greatest representable 32-bit integer, 231 - 1.

    val min_int : int32

    The smallest representable 32-bit integer, -231.

    val logand : int32 -> int32 -> int32

    Bitwise logical and.

    val logor : int32 -> int32 -> int32

    Bitwise logical or.

    val logxor : int32 -> int32 -> int32

    Bitwise logical exclusive or.

    val lognot : int32 -> int32

    Bitwise logical negation.

    val shift_left : int32 -> int -> int32

    Int32.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= 32.

    val shift_right : int32 -> int -> int32

    Int32.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 32.

    val shift_right_logical : int32 -> int -> int32

    Int32.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 32.

    val of_int : int -> int32

    Convert the given integer (type int) to a 32-bit integer (type int32). On 64-bit platforms, the argument is taken modulo 232.

    val to_int : int32 -> int

    Convert the given 32-bit integer (type int32) to an integer (type int). On 32-bit platforms, the 32-bit integer is taken modulo 231, i.e. the high-order bit is lost during the conversion. On 64-bit platforms, the conversion is exact.

    val unsigned_to_int : int32 -> int option

    Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

    • since 4.08.0
    val of_float : float -> int32

    Convert the given floating-point number to a 32-bit integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Int32.min_int, Int32.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

    val to_float : int32 -> float

    Convert the given 32-bit integer to a floating-point number.

    val of_string : string -> int32

    Convert the given string to a 32-bit integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*Int32.max_int+1]. If the input exceeds Int32.max_int it is converted to the signed integer Int32.min_int + input - Int32.max_int - 1.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    • raises Failure

      if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int32.

    val of_string_opt : string -> int32 option

    Same as of_string, but return None instead of raising.

    • since 4.05
    val to_string : int32 -> string

    Return the string representation of its argument, in signed decimal.

    val bits_of_float : float -> int32

    Return the internal representation of the given float according to the IEEE 754 floating-point 'single format' bit layout. Bit 31 of the result represents the sign of the float; bits 30 to 23 represent the (biased) exponent; bits 22 to 0 represent the mantissa.

    val float_of_bits : int32 -> float

    Return the floating-point number whose internal representation, according to the IEEE 754 floating-point 'single format' bit layout, is the given int32.

    type t = int32

    An alias for the type of 32-bit integers.

    val compare : t -> t -> int

    The comparison function for 32-bit integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Int32 to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned 32-bit integers.

    • since 4.08.0
    val equal : t -> t -> bool

    The equal function for int32s.

    • since 4.03.0
    val min : t -> t -> t

    Return the smaller of the two arguments.

    • since 4.13.0
    val max : t -> t -> t

    Return the greater of the two arguments.

    • since 4.13.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Int64/index.html b/dev/ocaml/Stdlib/Int64/index.html index cf49d1b3..f332843a 100644 --- a/dev/ocaml/Stdlib/Int64/index.html +++ b/dev/ocaml/Stdlib/Int64/index.html @@ -1,4 +1,4 @@ Int64 (ocaml.Stdlib.Int64)

    Module Stdlib.Int64

    64-bit integers.

    This module provides operations on the type int64 of signed 64-bit integers. Unlike the built-in int type, the type int64 is guaranteed to be exactly 64-bit wide on all platforms. All arithmetic operations over int64 are taken modulo 264

    Performance notice: values of type int64 occupy more memory space than values of type int, and arithmetic operations on int64 are generally slower than those on int. Use int64 only when the application requires exact 64-bit arithmetic.

    Literals for 64-bit integers are suffixed by L:

    let zero: int64 = 0L
     let one: int64 = 1L
    -let m_one: int64 = -1L
    val zero : int64

    The 64-bit integer 0.

    val one : int64

    The 64-bit integer 1.

    val minus_one : int64

    The 64-bit integer -1.

    val neg : int64 -> int64

    Unary negation.

    val add : int64 -> int64 -> int64

    Addition.

    val sub : int64 -> int64 -> int64

    Subtraction.

    val mul : int64 -> int64 -> int64

    Multiplication.

    val div : int64 -> int64 -> int64

    Integer division.

    • raises Division_by_zero

      if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

    val unsigned_div : int64 -> int64 -> int64

    Same as div, except that arguments and result are interpreted as unsigned 64-bit integers.

    • since 4.08.0
    val rem : int64 -> int64 -> int64

    Integer remainder. If y is not zero, the result of Int64.rem x y satisfies the following property: x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y). If y = 0, Int64.rem x y raises Division_by_zero.

    val unsigned_rem : int64 -> int64 -> int64

    Same as rem, except that arguments and result are interpreted as unsigned 64-bit integers.

    • since 4.08.0
    val succ : int64 -> int64

    Successor. Int64.succ x is Int64.add x Int64.one.

    val pred : int64 -> int64

    Predecessor. Int64.pred x is Int64.sub x Int64.one.

    val abs : int64 -> int64

    Return the absolute value of its argument.

    val max_int : int64

    The greatest representable 64-bit integer, 263 - 1.

    val min_int : int64

    The smallest representable 64-bit integer, -263.

    val logand : int64 -> int64 -> int64

    Bitwise logical and.

    val logor : int64 -> int64 -> int64

    Bitwise logical or.

    val logxor : int64 -> int64 -> int64

    Bitwise logical exclusive or.

    val lognot : int64 -> int64

    Bitwise logical negation.

    val shift_left : int64 -> int -> int64

    Int64.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= 64.

    val shift_right : int64 -> int -> int64

    Int64.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64.

    val shift_right_logical : int64 -> int -> int64

    Int64.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 64.

    val of_int : int -> int64

    Convert the given integer (type int) to a 64-bit integer (type int64).

    val to_int : int64 -> int

    Convert the given 64-bit integer (type int64) to an integer (type int). On 64-bit platforms, the 64-bit integer is taken modulo 263, i.e. the high-order bit is lost during the conversion. On 32-bit platforms, the 64-bit integer is taken modulo 231, i.e. the top 33 bits are lost during the conversion.

    val unsigned_to_int : int64 -> int option

    Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

    • since 4.08.0
    val of_float : float -> int64

    Convert the given floating-point number to a 64-bit integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Int64.min_int, Int64.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

    val to_float : int64 -> float

    Convert the given 64-bit integer to a floating-point number.

    val of_int32 : int32 -> int64

    Convert the given 32-bit integer (type int32) to a 64-bit integer (type int64).

    val to_int32 : int64 -> int32

    Convert the given 64-bit integer (type int64) to a 32-bit integer (type int32). The 64-bit integer is taken modulo 232, i.e. the top 32 bits are lost during the conversion.

    val of_nativeint : nativeint -> int64

    Convert the given native integer (type nativeint) to a 64-bit integer (type int64).

    val to_nativeint : int64 -> nativeint

    Convert the given 64-bit integer (type int64) to a native integer. On 32-bit platforms, the 64-bit integer is taken modulo 232. On 64-bit platforms, the conversion is exact.

    val of_string : string -> int64

    Convert the given string to a 64-bit integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*Int64.max_int+1]. If the input exceeds Int64.max_int it is converted to the signed integer Int64.min_int + input - Int64.max_int - 1.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    • raises Failure

      if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int64.

    val of_string_opt : string -> int64 option

    Same as of_string, but return None instead of raising.

    • since 4.05
    val to_string : int64 -> string

    Return the string representation of its argument, in decimal.

    val bits_of_float : float -> int64

    Return the internal representation of the given float according to the IEEE 754 floating-point 'double format' bit layout. Bit 63 of the result represents the sign of the float; bits 62 to 52 represent the (biased) exponent; bits 51 to 0 represent the mantissa.

    val float_of_bits : int64 -> float

    Return the floating-point number whose internal representation, according to the IEEE 754 floating-point 'double format' bit layout, is the given int64.

    type t = int64

    An alias for the type of 64-bit integers.

    val compare : t -> t -> int

    The comparison function for 64-bit integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Int64 to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned 64-bit integers.

    • since 4.08.0
    val equal : t -> t -> bool

    The equal function for int64s.

    • since 4.03.0
    val min : t -> t -> t

    Return the smaller of the two arguments.

    • since 4.13.0
    val max : t -> t -> t

    Return the greater of the two arguments.

    • since 4.13.0
    \ No newline at end of file +let m_one: int64 = -1L
    val zero : int64

    The 64-bit integer 0.

    val one : int64

    The 64-bit integer 1.

    val minus_one : int64

    The 64-bit integer -1.

    val neg : int64 -> int64

    Unary negation.

    val add : int64 -> int64 -> int64

    Addition.

    val sub : int64 -> int64 -> int64

    Subtraction.

    val mul : int64 -> int64 -> int64

    Multiplication.

    val div : int64 -> int64 -> int64

    Integer division.

    • raises Division_by_zero

      if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

    val unsigned_div : int64 -> int64 -> int64

    Same as div, except that arguments and result are interpreted as unsigned 64-bit integers.

    • since 4.08.0
    val rem : int64 -> int64 -> int64

    Integer remainder. If y is not zero, the result of Int64.rem x y satisfies the following property: x = Int64.add (Int64.mul (Int64.div x y) y) (Int64.rem x y). If y = 0, Int64.rem x y raises Division_by_zero.

    val unsigned_rem : int64 -> int64 -> int64

    Same as rem, except that arguments and result are interpreted as unsigned 64-bit integers.

    • since 4.08.0
    val succ : int64 -> int64

    Successor. Int64.succ x is Int64.add x Int64.one.

    val pred : int64 -> int64

    Predecessor. Int64.pred x is Int64.sub x Int64.one.

    val abs : int64 -> int64

    abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

    val max_int : int64

    The greatest representable 64-bit integer, 263 - 1.

    val min_int : int64

    The smallest representable 64-bit integer, -263.

    val logand : int64 -> int64 -> int64

    Bitwise logical and.

    val logor : int64 -> int64 -> int64

    Bitwise logical or.

    val logxor : int64 -> int64 -> int64

    Bitwise logical exclusive or.

    val lognot : int64 -> int64

    Bitwise logical negation.

    val shift_left : int64 -> int -> int64

    Int64.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= 64.

    val shift_right : int64 -> int -> int64

    Int64.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= 64.

    val shift_right_logical : int64 -> int -> int64

    Int64.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= 64.

    val of_int : int -> int64

    Convert the given integer (type int) to a 64-bit integer (type int64).

    val to_int : int64 -> int

    Convert the given 64-bit integer (type int64) to an integer (type int). On 64-bit platforms, the 64-bit integer is taken modulo 263, i.e. the high-order bit is lost during the conversion. On 32-bit platforms, the 64-bit integer is taken modulo 231, i.e. the top 33 bits are lost during the conversion.

    val unsigned_to_int : int64 -> int option

    Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

    • since 4.08.0
    val of_float : float -> int64

    Convert the given floating-point number to a 64-bit integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Int64.min_int, Int64.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

    val to_float : int64 -> float

    Convert the given 64-bit integer to a floating-point number.

    val of_int32 : int32 -> int64

    Convert the given 32-bit integer (type int32) to a 64-bit integer (type int64).

    val to_int32 : int64 -> int32

    Convert the given 64-bit integer (type int64) to a 32-bit integer (type int32). The 64-bit integer is taken modulo 232, i.e. the top 32 bits are lost during the conversion.

    val of_nativeint : nativeint -> int64

    Convert the given native integer (type nativeint) to a 64-bit integer (type int64).

    val to_nativeint : int64 -> nativeint

    Convert the given 64-bit integer (type int64) to a native integer. On 32-bit platforms, the 64-bit integer is taken modulo 232. On 64-bit platforms, the conversion is exact.

    val of_string : string -> int64

    Convert the given string to a 64-bit integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*Int64.max_int+1]. If the input exceeds Int64.max_int it is converted to the signed integer Int64.min_int + input - Int64.max_int - 1.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    • raises Failure

      if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int64.

    val of_string_opt : string -> int64 option

    Same as of_string, but return None instead of raising.

    • since 4.05
    val to_string : int64 -> string

    Return the string representation of its argument, in decimal.

    val bits_of_float : float -> int64

    Return the internal representation of the given float according to the IEEE 754 floating-point 'double format' bit layout. Bit 63 of the result represents the sign of the float; bits 62 to 52 represent the (biased) exponent; bits 51 to 0 represent the mantissa.

    val float_of_bits : int64 -> float

    Return the floating-point number whose internal representation, according to the IEEE 754 floating-point 'double format' bit layout, is the given int64.

    type t = int64

    An alias for the type of 64-bit integers.

    val compare : t -> t -> int

    The comparison function for 64-bit integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Int64 to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned 64-bit integers.

    • since 4.08.0
    val equal : t -> t -> bool

    The equal function for int64s.

    • since 4.03.0
    val min : t -> t -> t

    Return the smaller of the two arguments.

    • since 4.13.0
    val max : t -> t -> t

    Return the greater of the two arguments.

    • since 4.13.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Lazy/index.html b/dev/ocaml/Stdlib/Lazy/index.html index 4223522f..eefc4cff 100644 --- a/dev/ocaml/Stdlib/Lazy/index.html +++ b/dev/ocaml/Stdlib/Lazy/index.html @@ -1,5 +1,5 @@ -Lazy (ocaml.Stdlib.Lazy)

    Module Stdlib.Lazy

    Deferred computations.

    type 'a t = 'a CamlinternalLazy.t

    A value of type 'a Lazy.t is a deferred computation, called a suspension, that has a result of type 'a. The special expression syntax lazy (expr) makes a suspension of the computation of expr, without computing expr itself yet. "Forcing" the suspension will then compute expr and return its result. Matching a suspension with the special pattern syntax lazy(pattern) also computes the underlying expression and tries to bind it to pattern:

    let lazy_option_map f x =
    +Lazy (ocaml.Stdlib.Lazy)

    Module Stdlib.Lazy

    Deferred computations.

    type 'a t = 'a CamlinternalLazy.t

    A value of type 'a Lazy.t is a deferred computation, called a suspension, that has a result of type 'a. The special expression syntax lazy (expr) makes a suspension of the computation of expr, without computing expr itself yet. "Forcing" the suspension will then compute expr and return its result. Matching a suspension with the special pattern syntax lazy(pattern) also computes the underlying expression and tries to bind it to pattern:

    let lazy_option_map f x =
     match x with
     | lazy (Some x) -> Some (Lazy.force f x)
    -| _ -> None

    Note: If lazy patterns appear in multiple cases in a pattern-matching, lazy expressions may be forced even outside of the case ultimately selected by the pattern matching. In the example above, the suspension x is always computed.

    Note: lazy_t is the built-in type constructor used by the compiler for the lazy keyword. You should not use it directly. Always use Lazy.t instead.

    Note: Lazy.force is not thread-safe. If you use this module in a multi-threaded program, you will need to add some locks.

    Note: if the program is compiled with the -rectypes option, ill-founded recursive definitions of the form let rec x = lazy x or let rec x = lazy(lazy(...(lazy x))) are accepted by the type-checker and lead, when forced, to ill-formed values that trigger infinite loops in the garbage collector and other parts of the run-time system. Without the -rectypes option, such ill-founded recursive definitions are rejected by the type-checker.

    exception Undefined
    val force : 'a t -> 'a

    force x forces the suspension x and returns its result. If x has already been forced, Lazy.force x returns the same value again without recomputing it. If it raised an exception, the same exception is raised again.

    • raises Undefined

      if the forcing of x tries to force x itself recursively.

    Iterators

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

    map f x returns a suspension that, when forced, forces x and applies f to its value.

    It is equivalent to lazy (f (Lazy.force x)).

    • since 4.13.0

    Reasoning on already-forced suspensions

    val is_val : 'a t -> bool

    is_val x returns true if x has already been forced and did not raise an exception.

    • since 4.00.0
    val from_val : 'a -> 'a t

    from_val v evaluates v first (as any function would) and returns an already-forced suspension of its result. It is the same as let x = v in lazy x, but uses dynamic tests to optimize suspension creation in some cases.

    • since 4.00.0
    val map_val : ('a -> 'b) -> 'a t -> 'b t

    map_val f x applies f directly if x is already forced, otherwise it behaves as map f x.

    When x is already forced, this behavior saves the construction of a suspension, but on the other hand it performs more work eagerly that may not be useful if you never force the function result.

    If f raises an exception, it will be raised immediately when is_val x, or raised only when forcing the thunk otherwise.

    If map_val f x does not raise an exception, then is_val (map_val f x) is equal to is_val x.

    • since 4.13.0

    Advanced

    The following definitions are for advanced uses only; they require familiary with the lazy compilation scheme to be used appropriately.

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

    from_fun f is the same as lazy (f ()) but slightly more efficient.

    It should only be used if the function f is already defined. In particular it is always less efficient to write from_fun (fun () -> expr) than lazy expr.

    • since 4.00.0
    val force_val : 'a t -> 'a

    force_val x forces the suspension x and returns its result. If x has already been forced, force_val x returns the same value again without recomputing it.

    If the computation of x raises an exception, it is unspecified whether force_val x raises the same exception or Undefined.

    • raises Undefined

      if the forcing of x tries to force x itself recursively.

    Deprecated

    val lazy_from_fun : (unit -> 'a) -> 'a t
    • deprecated

      synonym for from_fun.

    val lazy_from_val : 'a -> 'a t
    • deprecated

      synonym for from_val.

    val lazy_is_val : 'a t -> bool
    • deprecated

      synonym for is_val.

    \ No newline at end of file +| _ -> None

    Note: If lazy patterns appear in multiple cases in a pattern-matching, lazy expressions may be forced even outside of the case ultimately selected by the pattern matching. In the example above, the suspension x is always computed.

    Note: lazy_t is the built-in type constructor used by the compiler for the lazy keyword. You should not use it directly. Always use Lazy.t instead.

    Note: Lazy.force is not concurrency-safe. If you use this module with multiple fibers, systhreads or domains, then you will need to add some locks. The module however ensures memory-safety, and hence, concurrently accessing this module will not lead to a crash but the behaviour is unspecified.

    Note: if the program is compiled with the -rectypes option, ill-founded recursive definitions of the form let rec x = lazy x or let rec x = lazy(lazy(...(lazy x))) are accepted by the type-checker and lead, when forced, to ill-formed values that trigger infinite loops in the garbage collector and other parts of the run-time system. Without the -rectypes option, such ill-founded recursive definitions are rejected by the type-checker.

    exception Undefined

    Raised when forcing a suspension concurrently from multiple fibers, systhreads or domains, or when the suspension tries to force itself recursively.

    val force : 'a t -> 'a

    force x forces the suspension x and returns its result. If x has already been forced, Lazy.force x returns the same value again without recomputing it. If it raised an exception, the same exception is raised again.

    Iterators

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

    map f x returns a suspension that, when forced, forces x and applies f to its value.

    It is equivalent to lazy (f (Lazy.force x)).

    • since 4.13.0

    Reasoning on already-forced suspensions

    val is_val : 'a t -> bool

    is_val x returns true if x has already been forced and did not raise an exception.

    • since 4.00.0
    val from_val : 'a -> 'a t

    from_val v evaluates v first (as any function would) and returns an already-forced suspension of its result. It is the same as let x = v in lazy x, but uses dynamic tests to optimize suspension creation in some cases.

    • since 4.00.0
    val map_val : ('a -> 'b) -> 'a t -> 'b t

    map_val f x applies f directly if x is already forced, otherwise it behaves as map f x.

    When x is already forced, this behavior saves the construction of a suspension, but on the other hand it performs more work eagerly that may not be useful if you never force the function result.

    If f raises an exception, it will be raised immediately when is_val x, or raised only when forcing the thunk otherwise.

    If map_val f x does not raise an exception, then is_val (map_val f x) is equal to is_val x.

    • since 4.13.0

    Advanced

    The following definitions are for advanced uses only; they require familiary with the lazy compilation scheme to be used appropriately.

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

    from_fun f is the same as lazy (f ()) but slightly more efficient.

    It should only be used if the function f is already defined. In particular it is always less efficient to write from_fun (fun () -> expr) than lazy expr.

    • since 4.00.0
    val force_val : 'a t -> 'a

    force_val x forces the suspension x and returns its result. If x has already been forced, force_val x returns the same value again without recomputing it.

    If the computation of x raises an exception, it is unspecified whether force_val x raises the same exception or Undefined.

    • raises Undefined

      if the forcing of x tries to force x itself recursively.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/List/index.html b/dev/ocaml/Stdlib/List/index.html index 43e990c8..0e55a87e 100644 --- a/dev/ocaml/Stdlib/List/index.html +++ b/dev/ocaml/Stdlib/List/index.html @@ -1,2 +1,2 @@ -List (ocaml.Stdlib.List)

    Module Stdlib.List

    List operations.

    Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

    The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a list =
    1. | []
    2. | :: of 'a * 'a list

    An alias for the type of lists.

    val length : 'a list -> int

    Return the length (number of elements) of the given list.

    val compare_lengths : 'a list -> 'b list -> int

    Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

    • since 4.05.0
    val compare_length_with : 'a list -> int -> int

    Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

    • since 4.05.0
    val cons : 'a -> 'a list -> 'a list

    cons x xs is x :: xs

    • since 4.03.0 (4.05.0 in ListLabels)
    val hd : 'a list -> 'a

    Return the first element of the given list.

    • raises Failure

      if the list is empty.

    val tl : 'a list -> 'a list

    Return the given list without its first element.

    • raises Failure

      if the list is empty.

    val nth : 'a list -> int -> 'a

    Return the n-th element of the given list. The first element (head of the list) is at position 0.

    • raises Failure

      if the list is too short.

    • raises Invalid_argument

      if n is negative.

    val nth_opt : 'a list -> int -> 'a option

    Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

    • raises Invalid_argument

      if n is negative.

    • since 4.05
    val rev : 'a list -> 'a list

    List reversal.

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

    init len f is f 0; f 1; ...; f (len-1), evaluated left to right.

    • raises Invalid_argument

      if len < 0.

    • since 4.06.0
    val append : 'a list -> 'a list -> 'a list

    Concatenate two lists. Same function as the infix operator @. Not tail-recursive (length of the first argument). The @ operator is not tail-recursive either.

    val rev_append : 'a list -> 'a list -> 'a list

    rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2, but rev_append is tail-recursive and more efficient.

    val concat : 'a list list -> 'a list

    Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

    val flatten : 'a list list -> 'a list

    Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

    Comparison

    val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool

    equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

    Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

    • since 4.12.0
    val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int

    compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

    • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
    • the empty list [] is strictly smaller than non-empty lists

    Note: the cmp function will be called even if the lists have different lengths.

    • since 4.12.0

    Iterators

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

    iter f [a1; ...; an] applies function f in turn to a1; ...; an. It is equivalent to begin f a1; f a2; ...; f an; () end.

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

    Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

    • since 4.00.0
    val map : ('a -> 'b) -> 'a list -> 'b list

    map f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f. Not tail-recursive.

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

    Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. Not tail-recursive.

    • since 4.00.0
    val rev_map : ('a -> 'b) -> 'a list -> 'b list

    rev_map f l gives the same result as rev (map f l), but is tail-recursive and more efficient.

    val filter_map : ('a -> 'b option) -> 'a list -> 'b list

    filter_map f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

    • since 4.08.0
    val concat_map : ('a -> 'b list) -> 'a list -> 'b list

    concat_map f l gives the same result as concat (map f l). Tail-recursive.

    • since 4.10.0
    val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list

    fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

    • since 4.11.0
    val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a

    fold_left f init [b1; ...; bn] is f (... (f (f init b1) b2) ...) bn.

    val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b

    fold_right f [a1; ...; an] init is f a1 (f a2 (... (f an init) ...)). Not tail-recursive.

    Iterators on two lists

    val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit

    iter2 f [a1; ...; an] [b1; ...; bn] calls in turn f a1 b1; ...; f an bn.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

    map2 f [a1; ...; an] [b1; ...; bn] is [f a1 b1; ...; f an bn].

    • raises Invalid_argument

      if the two lists are determined to have different lengths. Not tail-recursive.

    val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

    rev_map2 f l1 l2 gives the same result as rev (map2 f l1 l2), but is tail-recursive and more efficient.

    val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a

    fold_left2 f init [a1; ...; an] [b1; ...; bn] is f (... (f (f init a1 b1) a2 b2) ...) an bn.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c

    fold_right2 f [a1; ...; an] [b1; ...; bn] init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

    • raises Invalid_argument

      if the two lists are determined to have different lengths. Not tail-recursive.

    List scanning

    val for_all : ('a -> bool) -> 'a list -> bool

    for_all f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

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

    exists f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

    val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

    Same as for_all, but for a two-argument predicate.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

    Same as exists, but for a two-argument predicate.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val mem : 'a -> 'a list -> bool

    mem a set is true if and only if a is equal to an element of set.

    val memq : 'a -> 'a list -> bool

    Same as mem, but uses physical equality instead of structural equality to compare list elements.

    List searching

    val find : ('a -> bool) -> 'a list -> 'a

    find f l returns the first element of the list l that satisfies the predicate f.

    • raises Not_found

      if there is no value that satisfies f in the list l.

    val find_opt : ('a -> bool) -> 'a list -> 'a option

    find f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

    • since 4.05
    val find_map : ('a -> 'b option) -> 'a list -> 'b option

    find_map f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

    • since 4.10.0
    val filter : ('a -> bool) -> 'a list -> 'a list

    filter f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

    val find_all : ('a -> bool) -> 'a list -> 'a list

    find_all is another name for filter.

    val filteri : (int -> 'a -> bool) -> 'a list -> 'a list

    Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

    • since 4.11.0
    val partition : ('a -> bool) -> 'a list -> 'a list * 'a list

    partition f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

    val partition_map : ('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

    partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

    • if f x is Left y1, then y1 is in l1, and
    • if f x is Right y2, then y2 is in l2.

    The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

    In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

    • since 4.12.0

    Association lists

    val assoc : 'a -> ('a * 'b) list -> 'b

    assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

    • raises Not_found

      if there is no value associated with a in the list l.

    val assoc_opt : 'a -> ('a * 'b) list -> 'b option

    assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

    • since 4.05
    val assq : 'a -> ('a * 'b) list -> 'b

    Same as assoc, but uses physical equality instead of structural equality to compare keys.

    val assq_opt : 'a -> ('a * 'b) list -> 'b option

    Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

    • since 4.05.0
    val mem_assoc : 'a -> ('a * 'b) list -> bool

    Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

    val mem_assq : 'a -> ('a * 'b) list -> bool

    Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

    val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

    remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

    val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

    Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

    Lists of pairs

    val split : ('a * 'b) list -> 'a list * 'b list

    Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

    val combine : 'a list -> 'b list -> ('a * 'b) list

    Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

    • raises Invalid_argument

      if the two lists have different lengths. Not tail-recursive.

    Sorting

    val sort : ('a -> 'a -> int) -> 'a list -> 'a list

    Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

    The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

    val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list

    Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

    The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

    val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list

    Same as sort or stable_sort, whichever is faster on typical input.

    val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list

    Same as sort, but also remove duplicates.

    • since 4.02.0 (4.03.0 in ListLabels)
    val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

    Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

    Lists and Sequences

    val to_seq : 'a list -> 'a Seq.t

    Iterate on the list.

    • since 4.07
    val of_seq : 'a Seq.t -> 'a list

    Create a list from a sequence.

    • since 4.07
    \ No newline at end of file +List (ocaml.Stdlib.List)

    Module Stdlib.List

    List operations.

    Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

    The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a list =
    1. | []
    2. | :: of 'a * 'a list

    An alias for the type of lists.

    val length : 'a list -> int

    Return the length (number of elements) of the given list.

    val compare_lengths : 'a list -> 'b list -> int

    Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

    • since 4.05.0
    val compare_length_with : 'a list -> int -> int

    Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

    • since 4.05.0
    val cons : 'a -> 'a list -> 'a list

    cons x xs is x :: xs

    • since 4.03.0 (4.05.0 in ListLabels)
    val hd : 'a list -> 'a

    Return the first element of the given list.

    • raises Failure

      if the list is empty.

    val tl : 'a list -> 'a list

    Return the given list without its first element.

    • raises Failure

      if the list is empty.

    val nth : 'a list -> int -> 'a

    Return the n-th element of the given list. The first element (head of the list) is at position 0.

    • raises Failure

      if the list is too short.

    • raises Invalid_argument

      if n is negative.

    val nth_opt : 'a list -> int -> 'a option

    Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

    • raises Invalid_argument

      if n is negative.

    • since 4.05
    val rev : 'a list -> 'a list

    List reversal.

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

    init len f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

    • raises Invalid_argument

      if len < 0.

    • since 4.06.0
    val append : 'a list -> 'a list -> 'a list

    Concatenate two lists. Same function as the infix operator @. Not tail-recursive (length of the first argument). The @ operator is not tail-recursive either.

    val rev_append : 'a list -> 'a list -> 'a list

    rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2, but rev_append is tail-recursive and more efficient.

    val concat : 'a list list -> 'a list

    Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

    val flatten : 'a list list -> 'a list

    Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

    Comparison

    val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool

    equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

    Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

    • since 4.12.0
    val compare : ('a -> 'a -> int) -> 'a list -> 'a list -> int

    compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

    • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
    • the empty list [] is strictly smaller than non-empty lists

    Note: the cmp function will be called even if the lists have different lengths.

    • since 4.12.0

    Iterators

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

    iter f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

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

    Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

    • since 4.00.0
    val map : ('a -> 'b) -> 'a list -> 'b list

    map f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f. Not tail-recursive.

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

    Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. Not tail-recursive.

    • since 4.00.0
    val rev_map : ('a -> 'b) -> 'a list -> 'b list

    rev_map f l gives the same result as rev (map f l), but is tail-recursive and more efficient.

    val filter_map : ('a -> 'b option) -> 'a list -> 'b list

    filter_map f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

    • since 4.08.0
    val concat_map : ('a -> 'b list) -> 'a list -> 'b list

    concat_map f l gives the same result as concat (map f l). Tail-recursive.

    • since 4.10.0
    val fold_left_map : ('a -> 'b -> 'a * 'c) -> 'a -> 'b list -> 'a * 'c list

    fold_left_map is a combination of fold_left and map that threads an accumulator through calls to f.

    • since 4.11.0
    val fold_left : ('a -> 'b -> 'a) -> 'a -> 'b list -> 'a

    fold_left f init [b1; ...; bn] is f (... (f (f init b1) b2) ...) bn.

    val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b

    fold_right f [a1; ...; an] init is f a1 (f a2 (... (f an init) ...)). Not tail-recursive.

    Iterators on two lists

    val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit

    iter2 f [a1; ...; an] [b1; ...; bn] calls in turn f a1 b1; ...; f an bn.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

    map2 f [a1; ...; an] [b1; ...; bn] is [f a1 b1; ...; f an bn].

    • raises Invalid_argument

      if the two lists are determined to have different lengths. Not tail-recursive.

    val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list

    rev_map2 f l1 l2 gives the same result as rev (map2 f l1 l2), but is tail-recursive and more efficient.

    val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b list -> 'c list -> 'a

    fold_left2 f init [a1; ...; an] [b1; ...; bn] is f (... (f (f init a1 b1) a2 b2) ...) an bn.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c

    fold_right2 f [a1; ...; an] [b1; ...; bn] init is f a1 b1 (f a2 b2 (... (f an bn init) ...)).

    • raises Invalid_argument

      if the two lists are determined to have different lengths. Not tail-recursive.

    List scanning

    val for_all : ('a -> bool) -> 'a list -> bool

    for_all f [a1; ...; an] checks if all elements of the list satisfy the predicate f. That is, it returns (f a1) && (f a2) && ... && (f an) for a non-empty list and true if the list is empty.

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

    exists f [a1; ...; an] checks if at least one element of the list satisfies the predicate f. That is, it returns (f a1) || (f a2) || ... || (f an) for a non-empty list and false if the list is empty.

    val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

    Same as for_all, but for a two-argument predicate.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool

    Same as exists, but for a two-argument predicate.

    • raises Invalid_argument

      if the two lists are determined to have different lengths.

    val mem : 'a -> 'a list -> bool

    mem a set is true if and only if a is equal to an element of set.

    val memq : 'a -> 'a list -> bool

    Same as mem, but uses physical equality instead of structural equality to compare list elements.

    List searching

    val find : ('a -> bool) -> 'a list -> 'a

    find f l returns the first element of the list l that satisfies the predicate f.

    • raises Not_found

      if there is no value that satisfies f in the list l.

    val find_opt : ('a -> bool) -> 'a list -> 'a option

    find f l returns the first element of the list l that satisfies the predicate f. Returns None if there is no value that satisfies f in the list l.

    • since 4.05
    val find_map : ('a -> 'b option) -> 'a list -> 'b option

    find_map f l applies f to the elements of l in order, and returns the first result of the form Some v, or None if none exist.

    • since 4.10.0
    val filter : ('a -> bool) -> 'a list -> 'a list

    filter f l returns all the elements of the list l that satisfy the predicate f. The order of the elements in the input list is preserved.

    val find_all : ('a -> bool) -> 'a list -> 'a list

    find_all is another name for filter.

    val filteri : (int -> 'a -> bool) -> 'a list -> 'a list

    Same as filter, but the predicate is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

    • since 4.11.0
    val partition : ('a -> bool) -> 'a list -> 'a list * 'a list

    partition f l returns a pair of lists (l1, l2), where l1 is the list of all the elements of l that satisfy the predicate f, and l2 is the list of all the elements of l that do not satisfy f. The order of the elements in the input list is preserved.

    val partition_map : ('a -> ('b, 'c) Either.t) -> 'a list -> 'b list * 'c list

    partition_map f l returns a pair of lists (l1, l2) such that, for each element x of the input list l:

    • if f x is Left y1, then y1 is in l1, and
    • if f x is Right y2, then y2 is in l2.

    The output elements are included in l1 and l2 in the same relative order as the corresponding input elements in l.

    In particular, partition_map (fun x -> if f x then Left x else Right x) l is equivalent to partition f l.

    • since 4.12.0

    Association lists

    val assoc : 'a -> ('a * 'b) list -> 'b

    assoc a l returns the value associated with key a in the list of pairs l. That is, assoc a [ ...; (a,b); ...] = b if (a,b) is the leftmost binding of a in list l.

    • raises Not_found

      if there is no value associated with a in the list l.

    val assoc_opt : 'a -> ('a * 'b) list -> 'b option

    assoc_opt a l returns the value associated with key a in the list of pairs l. That is, assoc_opt a [ ...; (a,b); ...] = Some b if (a,b) is the leftmost binding of a in list l. Returns None if there is no value associated with a in the list l.

    • since 4.05
    val assq : 'a -> ('a * 'b) list -> 'b

    Same as assoc, but uses physical equality instead of structural equality to compare keys.

    val assq_opt : 'a -> ('a * 'b) list -> 'b option

    Same as assoc_opt, but uses physical equality instead of structural equality to compare keys.

    • since 4.05.0
    val mem_assoc : 'a -> ('a * 'b) list -> bool

    Same as assoc, but simply return true if a binding exists, and false if no bindings exist for the given key.

    val mem_assq : 'a -> ('a * 'b) list -> bool

    Same as mem_assoc, but uses physical equality instead of structural equality to compare keys.

    val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list

    remove_assoc a l returns the list of pairs l without the first pair with key a, if any. Not tail-recursive.

    val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list

    Same as remove_assoc, but uses physical equality instead of structural equality to compare keys. Not tail-recursive.

    Lists of pairs

    val split : ('a * 'b) list -> 'a list * 'b list

    Transform a list of pairs into a pair of lists: split [(a1,b1); ...; (an,bn)] is ([a1; ...; an], [b1; ...; bn]). Not tail-recursive.

    val combine : 'a list -> 'b list -> ('a * 'b) list

    Transform a pair of lists into a list of pairs: combine [a1; ...; an] [b1; ...; bn] is [(a1,b1); ...; (an,bn)].

    • raises Invalid_argument

      if the two lists have different lengths. Not tail-recursive.

    Sorting

    val sort : ('a -> 'a -> int) -> 'a list -> 'a list

    Sort a list in increasing order according to a comparison function. The comparison function must return 0 if its arguments compare as equal, a positive integer if the first is greater, and a negative integer if the first is smaller (see Array.sort for a complete specification). For example, Stdlib.compare is a suitable comparison function. The resulting list is sorted in increasing order. sort is guaranteed to run in constant heap space (in addition to the size of the result list) and logarithmic stack space.

    The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

    val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list

    Same as sort, but the sorting algorithm is guaranteed to be stable (i.e. elements that compare equal are kept in their original order).

    The current implementation uses Merge Sort. It runs in constant heap space and logarithmic stack space.

    val fast_sort : ('a -> 'a -> int) -> 'a list -> 'a list

    Same as sort or stable_sort, whichever is faster on typical input.

    val sort_uniq : ('a -> 'a -> int) -> 'a list -> 'a list

    Same as sort, but also remove duplicates.

    • since 4.02.0 (4.03.0 in ListLabels)
    val merge : ('a -> 'a -> int) -> 'a list -> 'a list -> 'a list

    Merge two lists: Assuming that l1 and l2 are sorted according to the comparison function cmp, merge cmp l1 l2 will return a sorted list containing all the elements of l1 and l2. If several elements compare equal, the elements of l1 will be before the elements of l2. Not tail-recursive (sum of the lengths of the arguments).

    Lists and Sequences

    val to_seq : 'a list -> 'a Seq.t

    Iterate on the list.

    • since 4.07
    val of_seq : 'a Seq.t -> 'a list

    Create a list from a sequence.

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/ListLabels/index.html b/dev/ocaml/Stdlib/ListLabels/index.html index 4ed2377d..6151352d 100644 --- a/dev/ocaml/Stdlib/ListLabels/index.html +++ b/dev/ocaml/Stdlib/ListLabels/index.html @@ -1,5 +1,5 @@ -ListLabels (ocaml.Stdlib.ListLabels)

    Module Stdlib.ListLabels

    List operations.

    Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

    The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a list =
    1. | []
    2. | :: of 'a * 'a list

    An alias for the type of lists.

    val length : 'a list -> int

    Return the length (number of elements) of the given list.

    val compare_lengths : 'a list -> 'b list -> int

    Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

    • since 4.05.0
    val compare_length_with : 'a list -> len:int -> int

    Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

    • since 4.05.0
    val cons : 'a -> 'a list -> 'a list

    cons x xs is x :: xs

    • since 4.05.0
    val hd : 'a list -> 'a

    Return the first element of the given list.

    • raises Failure

      if the list is empty.

    val tl : 'a list -> 'a list

    Return the given list without its first element.

    • raises Failure

      if the list is empty.

    val nth : 'a list -> int -> 'a

    Return the n-th element of the given list. The first element (head of the list) is at position 0.

    • raises Failure

      if the list is too short.

    • raises Invalid_argument

      if n is negative.

    val nth_opt : 'a list -> int -> 'a option

    Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

    • raises Invalid_argument

      if n is negative.

    • since 4.05
    val rev : 'a list -> 'a list

    List reversal.

    val init : len:int -> f:(int -> 'a) -> 'a list

    init ~len ~f is f 0; f 1; ...; f (len-1), evaluated left to right.

    • raises Invalid_argument

      if len < 0.

    • since 4.06.0
    val append : 'a list -> 'a list -> 'a list

    Concatenate two lists. Same function as the infix operator @. Not tail-recursive (length of the first argument). The @ operator is not tail-recursive either.

    val rev_append : 'a list -> 'a list -> 'a list

    rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2, but rev_append is tail-recursive and more efficient.

    val concat : 'a list list -> 'a list

    Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

    val flatten : 'a list list -> 'a list

    Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

    Comparison

    val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool

    equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

    Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

    • since 4.12.0
    val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int

    compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

    • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
    • the empty list [] is strictly smaller than non-empty lists

    Note: the cmp function will be called even if the lists have different lengths.

    • since 4.12.0

    Iterators

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

    iter ~f [a1; ...; an] applies function f in turn to a1; ...; an. It is equivalent to begin f a1; f a2; ...; f an; () end.

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

    Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

    • since 4.00.0
    val map : f:('a -> 'b) -> 'a list -> 'b list

    map ~f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f. Not tail-recursive.

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

    Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. Not tail-recursive.

    • since 4.00.0
    val rev_map : f:('a -> 'b) -> 'a list -> 'b list

    rev_map ~f l gives the same result as rev (map f l), but is tail-recursive and more efficient.

    val filter_map : f:('a -> 'b option) -> 'a list -> 'b list

    filter_map ~f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

    • since 4.08.0
    val concat_map : f:('a -> 'b list) -> 'a list -> 'b list

    concat_map ~f l gives the same result as concat (map f l). Tail-recursive.

    • since 4.10.0
    val fold_left_map : +ListLabels (ocaml.Stdlib.ListLabels)

    Module Stdlib.ListLabels

    List operations.

    Some functions are flagged as not tail-recursive. A tail-recursive function uses constant stack space, while a non-tail-recursive function uses stack space proportional to the length of its list argument, which can be a problem with very long lists. When the function takes several list arguments, an approximate formula giving stack usage (in some unspecified constant unit) is shown in parentheses.

    The above considerations can usually be ignored if your lists are not longer than about 10000 elements.

    The labeled version of this module can be used as described in the StdLabels module.

    type 'a t = 'a list =
    1. | []
    2. | :: of 'a * 'a list

    An alias for the type of lists.

    val length : 'a list -> int

    Return the length (number of elements) of the given list.

    val compare_lengths : 'a list -> 'b list -> int

    Compare the lengths of two lists. compare_lengths l1 l2 is equivalent to compare (length l1) (length l2), except that the computation stops after reaching the end of the shortest list.

    • since 4.05.0
    val compare_length_with : 'a list -> len:int -> int

    Compare the length of a list to an integer. compare_length_with l len is equivalent to compare (length l) len, except that the computation stops after at most len iterations on the list.

    • since 4.05.0
    val cons : 'a -> 'a list -> 'a list

    cons x xs is x :: xs

    • since 4.05.0
    val hd : 'a list -> 'a

    Return the first element of the given list.

    • raises Failure

      if the list is empty.

    val tl : 'a list -> 'a list

    Return the given list without its first element.

    • raises Failure

      if the list is empty.

    val nth : 'a list -> int -> 'a

    Return the n-th element of the given list. The first element (head of the list) is at position 0.

    • raises Failure

      if the list is too short.

    • raises Invalid_argument

      if n is negative.

    val nth_opt : 'a list -> int -> 'a option

    Return the n-th element of the given list. The first element (head of the list) is at position 0. Return None if the list is too short.

    • raises Invalid_argument

      if n is negative.

    • since 4.05
    val rev : 'a list -> 'a list

    List reversal.

    val init : len:int -> f:(int -> 'a) -> 'a list

    init ~len ~f is [f 0; f 1; ...; f (len-1)], evaluated left to right.

    • raises Invalid_argument

      if len < 0.

    • since 4.06.0
    val append : 'a list -> 'a list -> 'a list

    Concatenate two lists. Same function as the infix operator @. Not tail-recursive (length of the first argument). The @ operator is not tail-recursive either.

    val rev_append : 'a list -> 'a list -> 'a list

    rev_append l1 l2 reverses l1 and concatenates it with l2. This is equivalent to (rev l1) @ l2, but rev_append is tail-recursive and more efficient.

    val concat : 'a list list -> 'a list

    Concatenate a list of lists. The elements of the argument are all concatenated together (in the same order) to give the result. Not tail-recursive (length of the argument + length of the longest sub-list).

    val flatten : 'a list list -> 'a list

    Same as concat. Not tail-recursive (length of the argument + length of the longest sub-list).

    Comparison

    val equal : eq:('a -> 'a -> bool) -> 'a list -> 'a list -> bool

    equal eq [a1; ...; an] [b1; ..; bm] holds when the two input lists have the same length, and for each pair of elements ai, bi at the same position we have eq ai bi.

    Note: the eq function may be called even if the lists have different length. If you know your equality function is costly, you may want to check compare_lengths first.

    • since 4.12.0
    val compare : cmp:('a -> 'a -> int) -> 'a list -> 'a list -> int

    compare cmp [a1; ...; an] [b1; ...; bm] performs a lexicographic comparison of the two input lists, using the same 'a -> 'a -> int interface as Stdlib.compare:

    • a1 :: l1 is smaller than a2 :: l2 (negative result) if a1 is smaller than a2, or if they are equal (0 result) and l1 is smaller than l2
    • the empty list [] is strictly smaller than non-empty lists

    Note: the cmp function will be called even if the lists have different lengths.

    • since 4.12.0

    Iterators

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

    iter ~f [a1; ...; an] applies function f in turn to [a1; ...; an]. It is equivalent to f a1; f a2; ...; f an.

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

    Same as iter, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument.

    • since 4.00.0
    val map : f:('a -> 'b) -> 'a list -> 'b list

    map ~f [a1; ...; an] applies function f to a1, ..., an, and builds the list [f a1; ...; f an] with the results returned by f. Not tail-recursive.

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

    Same as map, but the function is applied to the index of the element as first argument (counting from 0), and the element itself as second argument. Not tail-recursive.

    • since 4.00.0
    val rev_map : f:('a -> 'b) -> 'a list -> 'b list

    rev_map ~f l gives the same result as rev (map f l), but is tail-recursive and more efficient.

    val filter_map : f:('a -> 'b option) -> 'a list -> 'b list

    filter_map ~f l applies f to every element of l, filters out the None elements and returns the list of the arguments of the Some elements.

    • since 4.08.0
    val concat_map : f:('a -> 'b list) -> 'a list -> 'b list

    concat_map ~f l gives the same result as concat (map f l). Tail-recursive.

    • since 4.10.0
    val fold_left_map : f:('a -> 'b -> 'a * 'c) -> init:'a -> 'b list -> diff --git a/dev/ocaml/Stdlib/Map/Make/index.html b/dev/ocaml/Stdlib/Map/Make/index.html index 80950de1..cfae9c19 100644 --- a/dev/ocaml/Stdlib/Map/Make/index.html +++ b/dev/ocaml/Stdlib/Map/Make/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Map/module-type-S/index.html b/dev/ocaml/Stdlib/Map/module-type-S/index.html index 856c9bb4..c0cf6cb5 100644 --- a/dev/ocaml/Stdlib/Map/module-type-S/index.html +++ b/dev/ocaml/Stdlib/Map/module-type-S/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/argument-1-H/index.html b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/argument-1-H/index.html index 6d769785..38f4ad19 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/argument-1-H/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/argument-1-H/index.html @@ -1,2 +1,2 @@ -H (ocaml.Stdlib.MoreLabels.Hashtbl.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +H (ocaml.Stdlib.MoreLabels.Hashtbl.MakeSeeded.H)

    Parameter MakeSeeded.H

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/index.html b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/index.html index f1cac1e2..b89e1008 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/MakeSeeded/index.html @@ -1,2 +1,2 @@ -MakeSeeded (ocaml.Stdlib.MoreLabels.Hashtbl.MakeSeeded)

    Module Hashtbl.MakeSeeded

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    • since 4.00.0

    Parameters

    Signature

    type key = H.t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key:key -> data:'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    • since 4.05.0
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key:key -> data:'a -> unit
    val mem : 'a t -> key -> bool
    val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
    val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit
    • since 4.03.0
    val fold : f:(key:key -> data:'a -> 'b -> 'b) -> 'a t -> init:'b -> 'b
    val length : 'a t -> int
    val stats : 'a t -> statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • since 4.07
    val to_seq_keys : _ t -> key Seq.t
    • since 4.07
    val to_seq_values : 'a t -> 'a Seq.t
    • since 4.07
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t
    • since 4.07
    \ No newline at end of file +MakeSeeded (ocaml.Stdlib.MoreLabels.Hashtbl.MakeSeeded)

    Module Hashtbl.MakeSeeded

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    • since 4.00.0

    Parameters

    Signature

    type key = H.t
    val create : ?random:bool -> int -> 'a t
    val clear : 'a t -> unit
    val reset : 'a t -> unit
    val copy : 'a t -> 'a t
    val add : 'a t -> key:key -> data:'a -> unit
    val remove : 'a t -> key -> unit
    val find : 'a t -> key -> 'a
    val find_opt : 'a t -> key -> 'a option
    • since 4.05.0
    val find_all : 'a t -> key -> 'a list
    val replace : 'a t -> key:key -> data:'a -> unit
    val mem : 'a t -> key -> bool
    val iter : f:(key:key -> data:'a -> unit) -> 'a t -> unit
    val filter_map_inplace : f:(key:key -> data:'a -> 'a option) -> 'a t -> unit
    • since 4.03.0
    val fold : f:(key:key -> data:'a -> 'b -> 'b) -> 'a t -> init:'b -> 'b
    val length : 'a t -> int
    val stats : 'a t -> statistics
    val to_seq : 'a t -> (key * 'a) Seq.t
    • since 4.07
    val to_seq_keys : _ t -> key Seq.t
    • since 4.07
    val to_seq_values : 'a t -> 'a Seq.t
    • since 4.07
    val add_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val replace_seq : 'a t -> (key * 'a) Seq.t -> unit
    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t
    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/index.html b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/index.html index 2284e074..355109dd 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/index.html @@ -1,8 +1,8 @@ -Hashtbl (ocaml.Stdlib.MoreLabels.Hashtbl)

    Module MoreLabels.Hashtbl

    Hash tables and hash functions.

    Hash tables are hashed association tables, with in-place modification.

    Generic interface

    type (!'a, !'b) t = ('a, 'b) Hashtbl.t

    The type of hash tables from type 'a to type 'b.

    val create : ?random:bool -> int -> ('a, 'b) t

    Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

    The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

    A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

    A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

    If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

    • before 4.00.0

      the ~random parameter was not present and all hash tables were created in non-randomized mode.

    val clear : ('a, 'b) t -> unit

    Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

    val reset : ('a, 'b) t -> unit

    Empty a hash table and shrink the size of the bucket table to its initial size.

    • since 4.00.0
    val copy : ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable.

    val add : ('a, 'b) t -> key:'a -> data:'b -> unit

    Hashtbl.add tbl ~key ~data adds a binding of key to data in table tbl. Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

    val find : ('a, 'b) t -> 'a -> 'b

    Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

    val find_opt : ('a, 'b) t -> 'a -> 'b option

    Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

    • since 4.05
    val find_all : ('a, 'b) t -> 'a -> 'b list

    Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

    val mem : ('a, 'b) t -> 'a -> bool

    Hashtbl.mem tbl x checks if x is bound in tbl.

    val remove : ('a, 'b) t -> 'a -> unit

    Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

    val replace : ('a, 'b) t -> key:'a -> data:'b -> unit

    Hashtbl.replace tbl ~key ~data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

    val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit

    Hashtbl.iter ~f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val filter_map_inplace : +Hashtbl (ocaml.Stdlib.MoreLabels.Hashtbl)

    Module MoreLabels.Hashtbl

    Hash tables and hash functions.

    Hash tables are hashed association tables, with in-place modification.

    Unsynchronized accesses

    Unsynchronized accesses to a hash table may lead to an invalid hash table state. Thus, concurrent accesses to a hash tables must be synchronized (for instance with a Mutex.t).

    Generic interface

    type (!'a, !'b) t = ('a, 'b) Hashtbl.t

    The type of hash tables from type 'a to type 'b.

    val create : ?random:bool -> int -> ('a, 'b) t

    Hashtbl.create n creates a new, empty hash table, with initial size n. For best results, n should be on the order of the expected number of elements that will be in the table. The table grows as needed, so n is just an initial guess.

    The optional ~random parameter (a boolean) controls whether the internal organization of the hash table is randomized at each execution of Hashtbl.create or deterministic over all executions.

    A hash table that is created with ~random set to false uses a fixed hash function (hash) to distribute keys among buckets. As a consequence, collisions between keys happen deterministically. In Web-facing applications or other security-sensitive applications, the deterministic collision patterns can be exploited by a malicious user to create a denial-of-service attack: the attacker sends input crafted to create many collisions in the table, slowing the application down.

    A hash table that is created with ~random set to true uses the seeded hash function seeded_hash with a seed that is randomly chosen at hash table creation time. In effect, the hash function used is randomly selected among 2^{30} different hash functions. All these hash functions have different collision patterns, rendering ineffective the denial-of-service attack described above. However, because of randomization, enumerating all elements of the hash table using fold or iter is no longer deterministic: elements are enumerated in different orders at different runs of the program.

    If no ~random parameter is given, hash tables are created in non-random mode by default. This default can be changed either programmatically by calling randomize or by setting the R flag in the OCAMLRUNPARAM environment variable.

    • before 4.00.0

      the ~random parameter was not present and all hash tables were created in non-randomized mode.

    val clear : ('a, 'b) t -> unit

    Empty a hash table. Use reset instead of clear to shrink the size of the bucket table to its initial size.

    val reset : ('a, 'b) t -> unit

    Empty a hash table and shrink the size of the bucket table to its initial size.

    • since 4.00.0
    val copy : ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable.

    val add : ('a, 'b) t -> key:'a -> data:'b -> unit

    Hashtbl.add tbl ~key ~data adds a binding of key to data in table tbl. Previous bindings for key are not removed, but simply hidden. That is, after performing remove tbl key, the previous binding for key, if any, is restored. (Same behavior as with association lists.)

    val find : ('a, 'b) t -> 'a -> 'b

    Hashtbl.find tbl x returns the current binding of x in tbl, or raises Not_found if no such binding exists.

    val find_opt : ('a, 'b) t -> 'a -> 'b option

    Hashtbl.find_opt tbl x returns the current binding of x in tbl, or None if no such binding exists.

    • since 4.05
    val find_all : ('a, 'b) t -> 'a -> 'b list

    Hashtbl.find_all tbl x returns the list of all data associated with x in tbl. The current binding is returned first, then the previous bindings, in reverse order of introduction in the table.

    val mem : ('a, 'b) t -> 'a -> bool

    Hashtbl.mem tbl x checks if x is bound in tbl.

    val remove : ('a, 'b) t -> 'a -> unit

    Hashtbl.remove tbl x removes the current binding of x in tbl, restoring the previous binding if it exists. It does nothing if x is not bound in tbl.

    val replace : ('a, 'b) t -> key:'a -> data:'b -> unit

    Hashtbl.replace tbl ~key ~data replaces the current binding of key in tbl by a binding of key to data. If key is unbound in tbl, a binding of key to data is added to tbl. This is functionally equivalent to remove tbl key followed by add tbl key data.

    val iter : f:(key:'a -> data:'b -> unit) -> ('a, 'b) t -> unit

    Hashtbl.iter ~f tbl applies f to all bindings in table tbl. f receives the key as first argument, and the associated value as second argument. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val filter_map_inplace : f:(key:'a -> data:'b -> 'b option) -> ('a, 'b) t -> - unit

    Hashtbl.filter_map_inplace ~f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

    Other comments for iter apply as well.

    • since 4.03.0
    val fold : f:(key:'a -> data:'b -> 'c -> 'c) -> ('a, 'b) t -> init:'c -> 'c

    Hashtbl.fold ~f tbl ~init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val length : ('a, 'b) t -> int

    Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

    val randomize : unit -> unit

    After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

    It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time.

    Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

    • since 4.00.0
    val is_randomized : unit -> bool

    Return true if the tables are currently created in randomized mode by default, false otherwise.

    • since 4.03.0
    val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

    rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

    • since 4.12.0
    type statistics = Hashtbl.statistics = {
    1. num_bindings : int;
      (*

      Number of bindings present in the table. Same value as returned by length.

      *)
    2. num_buckets : int;
      (*

      Number of buckets in the table.

      *)
    3. max_bucket_length : int;
      (*

      Maximal number of bindings per bucket.

      *)
    4. bucket_histogram : int array;
      (*

      Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

      *)
    }
    • since 4.00.0
    val stats : ('a, 'b) t -> statistics

    Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

    • since 4.00.0

    Hash tables and Sequences

    val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

    Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

    The behavior is not specified if the hash table is modified during the iteration.

    • since 4.07
    val to_seq_keys : ('a, _) t -> 'a Seq.t

    Same as Seq.map fst (to_seq m)

    • since 4.07
    val to_seq_values : (_, 'b) t -> 'b Seq.t

    Same as Seq.map snd (to_seq m)

    • since 4.07
    val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using add

    • since 4.07
    val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using replace

    • since 4.07
    val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

    Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

    • since 4.07

    Functorial interface

    The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

    For instance, one might want to specialize a table for integer keys:

    module IntHash =
    +  unit

    Hashtbl.filter_map_inplace ~f tbl applies f to all bindings in table tbl and update each binding depending on the result of f. If f returns None, the binding is discarded. If it returns Some new_val, the binding is update to associate the key to new_val.

    Other comments for iter apply as well.

    • since 4.03.0
    val fold : f:(key:'a -> data:'b -> 'c -> 'c) -> ('a, 'b) t -> init:'c -> 'c

    Hashtbl.fold ~f tbl ~init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in tbl, and d1 ... dN are the associated values. Each binding is presented exactly once to f.

    The order in which the bindings are passed to f is unspecified. However, if the table contains several bindings for the same key, they are passed to f in reverse order of introduction, that is, the most recent binding is passed first.

    If the hash table was created in non-randomized mode, the order in which the bindings are enumerated is reproducible between successive runs of the program, and even between minor versions of OCaml. For randomized hash tables, the order of enumeration is entirely random.

    The behavior is not specified if the hash table is modified by f during the iteration.

    val length : ('a, 'b) t -> int

    Hashtbl.length tbl returns the number of bindings in tbl. It takes constant time. Multiple bindings are counted once each, so Hashtbl.length gives the number of times Hashtbl.iter calls its first argument.

    val randomize : unit -> unit

    After a call to Hashtbl.randomize(), hash tables are created in randomized mode by default: create returns randomized hash tables, unless the ~random:false optional parameter is given. The same effect can be achieved by setting the R parameter in the OCAMLRUNPARAM environment variable.

    It is recommended that applications or Web frameworks that need to protect themselves against the denial-of-service attack described in create call Hashtbl.randomize() at initialization time before any domains are created.

    Note that once Hashtbl.randomize() was called, there is no way to revert to the non-randomized default behavior of create. This is intentional. Non-randomized hash tables can still be created using Hashtbl.create ~random:false.

    • since 4.00.0
    val is_randomized : unit -> bool

    Return true if the tables are currently created in randomized mode by default, false otherwise.

    • since 4.03.0
    val rebuild : ?random:bool -> ('a, 'b) t -> ('a, 'b) t

    Return a copy of the given hashtable. Unlike copy, rebuild h re-hashes all the (key, value) entries of the original table h. The returned hash table is randomized if h was randomized, or the optional random parameter is true, or if the default is to create randomized hash tables; see create for more information.

    rebuild can safely be used to import a hash table built by an old version of the Hashtbl module, then marshaled to persistent storage. After unmarshaling, apply rebuild to produce a hash table for the current version of the Hashtbl module.

    • since 4.12.0
    type statistics = Hashtbl.statistics = {
    1. num_bindings : int;
      (*

      Number of bindings present in the table. Same value as returned by length.

      *)
    2. num_buckets : int;
      (*

      Number of buckets in the table.

      *)
    3. max_bucket_length : int;
      (*

      Maximal number of bindings per bucket.

      *)
    4. bucket_histogram : int array;
      (*

      Histogram of bucket sizes. This array histo has length max_bucket_length + 1. The value of histo.(i) is the number of buckets whose size is i.

      *)
    }
    • since 4.00.0
    val stats : ('a, 'b) t -> statistics

    Hashtbl.stats tbl returns statistics about the table tbl: number of buckets, size of the biggest bucket, distribution of buckets by size.

    • since 4.00.0

    Hash tables and Sequences

    val to_seq : ('a, 'b) t -> ('a * 'b) Seq.t

    Iterate on the whole table. The order in which the bindings appear in the sequence is unspecified. However, if the table contains several bindings for the same key, they appear in reversed order of introduction, that is, the most recent binding appears first.

    The behavior is not specified if the hash table is modified during the iteration.

    • since 4.07
    val to_seq_keys : ('a, _) t -> 'a Seq.t

    Same as Seq.map fst (to_seq m)

    • since 4.07
    val to_seq_values : (_, 'b) t -> 'b Seq.t

    Same as Seq.map snd (to_seq m)

    • since 4.07
    val add_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using add

    • since 4.07
    val replace_seq : ('a, 'b) t -> ('a * 'b) Seq.t -> unit

    Add the given bindings to the table, using replace

    • since 4.07
    val of_seq : ('a * 'b) Seq.t -> ('a, 'b) t

    Build a table from the given bindings. The bindings are added in the same order they appear in the sequence, using replace_seq, which means that if two pairs have the same key, only the latest one will appear in the table.

    • since 4.07

    Functorial interface

    The functorial interface allows the use of specific comparison and hash functions, either for performance/security concerns, or because keys are not hashable/comparable with the polymorphic builtins.

    For instance, one might want to specialize a table for integer keys:

    module IntHash =
       struct
         type t = int
         let equal i j = i=j
    @@ -17,4 +17,4 @@ IntHashtbl.add h 12 "hello"

    This creates a new module < (H : HashedType) : S with type key = H.t and type 'a t = 'a Hashtbl.Make(H).t

    Functor building an implementation of the hashtable structure. The functor Hashtbl.Make returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the hashing and equality functions specified in the functor argument H instead of generic equality and hashing. Since the hash function is not seeded, the create operation of the result structure always returns non-randomized hash tables.

    module type SeededHashedType = sig ... end

    The input signature of the functor MakeSeeded.

    module type SeededS = sig ... end

    The output signature of the functor MakeSeeded.

    module MakeSeeded (H : SeededHashedType) : - SeededS with type key = H.t and type 'a t = 'a Hashtbl.MakeSeeded(H).t

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    The polymorphic hash functions

    val hash : 'a -> int

    Hashtbl.hash x associates a nonnegative integer to any value of any type. It is guaranteed that if x = y or Stdlib.compare x y = 0, then hash x = hash y. Moreover, hash always terminates, even on cyclic structures.

    val seeded_hash : int -> 'a -> int

    A variant of hash that is further parameterized by an integer seed.

    • since 4.00.0
    val hash_param : int -> int -> 'a -> int

    Hashtbl.hash_param meaningful total x computes a hash value for x, with the same properties as for hash. The two extra integer parameters meaningful and total give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure x, stopping after meaningful meaningful nodes were encountered, or total nodes (meaningful or not) were encountered. If total as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of meaningful and total means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters meaningful and total govern the tradeoff between accuracy and speed. As default choices, hash and seeded_hash take meaningful = 10 and total = 100.

    val seeded_hash_param : int -> int -> int -> 'a -> int

    A variant of hash_param that is further parameterized by an integer seed. Usage: Hashtbl.seeded_hash_param meaningful total seed x.

    • since 4.00.0
    \ No newline at end of file + SeededS with type key = H.t and type 'a t = 'a Hashtbl.MakeSeeded(H).t

    Functor building an implementation of the hashtable structure. The functor Hashtbl.MakeSeeded returns a structure containing a type key of keys and a type 'a t of hash tables associating data of type 'a to keys of type key. The operations perform similarly to those of the generic interface, but use the seeded hashing and equality functions specified in the functor argument H instead of generic equality and hashing. The create operation of the result structure supports the ~random optional parameter and returns randomized hash tables if ~random:true is passed or if randomization is globally on (see Hashtbl.randomize).

    The polymorphic hash functions

    val hash : 'a -> int

    Hashtbl.hash x associates a nonnegative integer to any value of any type. It is guaranteed that if x = y or Stdlib.compare x y = 0, then hash x = hash y. Moreover, hash always terminates, even on cyclic structures.

    val seeded_hash : int -> 'a -> int

    A variant of hash that is further parameterized by an integer seed.

    • since 4.00.0
    val hash_param : int -> int -> 'a -> int

    Hashtbl.hash_param meaningful total x computes a hash value for x, with the same properties as for hash. The two extra integer parameters meaningful and total give more precise control over hashing. Hashing performs a breadth-first, left-to-right traversal of the structure x, stopping after meaningful meaningful nodes were encountered, or total nodes (meaningful or not) were encountered. If total as specified by the user exceeds a certain value, currently 256, then it is capped to that value. Meaningful nodes are: integers; floating-point numbers; strings; characters; booleans; and constant constructors. Larger values of meaningful and total means that more nodes are taken into account to compute the final hash value, and therefore collisions are less likely to happen. However, hashing takes longer. The parameters meaningful and total govern the tradeoff between accuracy and speed. As default choices, hash and seeded_hash take meaningful = 10 and total = 100.

    val seeded_hash_param : int -> int -> int -> 'a -> int

    A variant of hash_param that is further parameterized by an integer seed. Usage: Hashtbl.seeded_hash_param meaningful total seed x.

    • since 4.00.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededHashedType/index.html b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededHashedType/index.html index a34164d3..f742b89f 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededHashedType/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Hashtbl/module-type-SeededHashedType/index.html @@ -1,2 +1,2 @@ -SeededHashedType (ocaml.Stdlib.MoreLabels.Hashtbl.SeededHashedType)

    Module type Hashtbl.SeededHashedType

    The input signature of the functor MakeSeeded.

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then hash seed x = hash seed y for any value of seed. A suitable choice for hash is the function Stdlib.Hashtbl.seeded_hash below.

    \ No newline at end of file +SeededHashedType (ocaml.Stdlib.MoreLabels.Hashtbl.SeededHashedType)

    Module type Hashtbl.SeededHashedType

    The input signature of the functor MakeSeeded.

    type t

    The type of the hashtable keys.

    val equal : t -> t -> bool

    The equality predicate used to compare keys.

    val seeded_hash : int -> t -> int

    A seeded hashing function on keys. The first argument is the seed. It must be the case that if equal x y is true, then seeded_hash seed x = seeded_hash seed y for any value of seed. A suitable choice for seeded_hash is the function Hashtbl.seeded_hash below.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Map/Make/index.html b/dev/ocaml/Stdlib/MoreLabels/Map/Make/index.html index 0d3c8b35..b3105642 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Map/Make/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Map/Make/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal ~cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter ~f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : f:(key:key -> data:'a -> 'b -> 'b) -> 'a t -> init:'b -> 'b

    fold ~f m ~init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : f:(key -> 'a -> bool) -> 'a t -> bool

    for_all ~f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : f:(key -> 'a -> bool) -> 'a t -> bool

    exists ~f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t

    filter ~f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map ~f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : f:(key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition ~f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : f:(key -> bool) -> 'a t -> key * 'a

    find_first ~f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt ~f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : f:(key -> bool) -> 'a t -> key * 'a

    find_last ~f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt ~f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map ~f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    val partition : f:(key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition ~f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : f:(key -> bool) -> 'a t -> key * 'a

    find_first ~f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt ~f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : f:(key -> bool) -> 'a t -> key * 'a

    find_last ~f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt ~f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map ~f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Map/module-type-S/index.html b/dev/ocaml/Stdlib/MoreLabels/Map/module-type-S/index.html index 0ff0cecb..78ad6bd2 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Map/module-type-S/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Map/module-type-S/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : f:(key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union ~f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : cmp:('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal ~cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter ~f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : f:(key:key -> data:'a -> 'b -> 'b) -> 'a t -> init:'b -> 'b

    fold ~f m ~init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : f:(key -> 'a -> bool) -> 'a t -> bool

    for_all ~f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : f:(key -> 'a -> bool) -> 'a t -> bool

    exists ~f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : f:(key -> 'a -> bool) -> 'a t -> 'a t

    filter ~f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : f:(key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map ~f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : f:(key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition ~f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : f:(key -> bool) -> 'a t -> key * 'a

    find_first ~f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt ~f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : f:(key -> bool) -> 'a t -> key * 'a

    find_last ~f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt ~f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map ~f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    val partition : f:(key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition ~f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : f:(key -> bool) -> 'a t -> key * 'a

    find_first ~f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt ~f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : f:(key -> bool) -> 'a t -> key * 'a

    find_last ~f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : f:(key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt ~f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map ~f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Set/Make/index.html b/dev/ocaml/Stdlib/MoreLabels/Set/Make/index.html index 8d4046fc..ab4179a5 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Set/Make/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Set/Make/index.html @@ -1,3 +1,3 @@ Make (ocaml.Stdlib.MoreLabels.Set.Make)

    Module Set.Make

    Functor building an implementation of the set structure given a totally ordered type.

    Parameters

    module Ord : OrderedType

    Signature

    type elt = Ord.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : f:(elt -> unit) -> t -> unit

    iter ~f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : f:(elt -> elt) -> t -> t

    map ~f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : f:(elt -> 'a -> 'a) -> t -> init:'a -> 'a

    fold ~f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : f:(elt -> bool) -> t -> bool

    for_all ~f s checks if all elements of the set satisfy the predicate f.

    val exists : f:(elt -> bool) -> t -> bool

    exists ~f s checks if at least one element of the set satisfies the predicate f.

    val filter : f:(elt -> bool) -> t -> t

    filter ~f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : f:(elt -> elt option) -> t -> t

    filter_map ~f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : f:(elt -> bool) -> t -> t * t

    partition ~f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : f:(elt -> bool) -> t -> elt

    find_first ~f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : f:(elt -> bool) -> t -> elt option

    find_first_opt ~f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : f:(elt -> bool) -> t -> elt

    find_last ~f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : f:(elt -> bool) -> t -> elt option

    find_last_opt ~f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    val fold : f:(elt -> 'a -> 'a) -> t -> init:'a -> 'a

    fold ~f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : f:(elt -> bool) -> t -> bool

    for_all ~f s checks if all elements of the set satisfy the predicate f.

    val exists : f:(elt -> bool) -> t -> bool

    exists ~f s checks if at least one element of the set satisfies the predicate f.

    val filter : f:(elt -> bool) -> t -> t

    filter ~f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : f:(elt -> elt option) -> t -> t

    filter_map ~f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : f:(elt -> bool) -> t -> t * t

    partition ~f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : f:(elt -> bool) -> t -> elt

    find_first ~f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : f:(elt -> bool) -> t -> elt option

    find_first_opt ~f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : f:(elt -> bool) -> t -> elt

    find_last ~f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : f:(elt -> bool) -> t -> elt option

    find_last_opt ~f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/MoreLabels/Set/module-type-S/index.html b/dev/ocaml/Stdlib/MoreLabels/Set/module-type-S/index.html index 4e877acf..8eecb142 100644 --- a/dev/ocaml/Stdlib/MoreLabels/Set/module-type-S/index.html +++ b/dev/ocaml/Stdlib/MoreLabels/Set/module-type-S/index.html @@ -1,3 +1,3 @@ S (ocaml.Stdlib.MoreLabels.Set.S)

    Module type Set.S

    Output signature of the functor Make.

    type elt

    The type of the set elements.

    type t

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : f:(elt -> unit) -> t -> unit

    iter ~f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : f:(elt -> elt) -> t -> t

    map ~f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : f:(elt -> 'a -> 'a) -> t -> init:'a -> 'a

    fold ~f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : f:(elt -> bool) -> t -> bool

    for_all ~f s checks if all elements of the set satisfy the predicate f.

    val exists : f:(elt -> bool) -> t -> bool

    exists ~f s checks if at least one element of the set satisfies the predicate f.

    val filter : f:(elt -> bool) -> t -> t

    filter ~f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : f:(elt -> elt option) -> t -> t

    filter_map ~f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : f:(elt -> bool) -> t -> t * t

    partition ~f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : f:(elt -> bool) -> t -> elt

    find_first ~f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : f:(elt -> bool) -> t -> elt option

    find_first_opt ~f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : f:(elt -> bool) -> t -> elt

    find_last ~f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : f:(elt -> bool) -> t -> elt option

    find_last_opt ~f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    val fold : f:(elt -> 'a -> 'a) -> t -> init:'a -> 'a

    fold ~f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : f:(elt -> bool) -> t -> bool

    for_all ~f s checks if all elements of the set satisfy the predicate f.

    val exists : f:(elt -> bool) -> t -> bool

    exists ~f s checks if at least one element of the set satisfies the predicate f.

    val filter : f:(elt -> bool) -> t -> t

    filter ~f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : f:(elt -> elt option) -> t -> t

    filter_map ~f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : f:(elt -> bool) -> t -> t * t

    partition ~f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : f:(elt -> bool) -> t -> elt

    find_first ~f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : f:(elt -> bool) -> t -> elt option

    find_first_opt ~f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : f:(elt -> bool) -> t -> elt

    find_last ~f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : f:(elt -> bool) -> t -> elt option

    find_last_opt ~f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Mutex/index.html b/dev/ocaml/Stdlib/Mutex/index.html new file mode 100644 index 00000000..ce7cc5ed --- /dev/null +++ b/dev/ocaml/Stdlib/Mutex/index.html @@ -0,0 +1,4 @@ + +Mutex (ocaml.Stdlib.Mutex)

    Module Stdlib.Mutex

    Locks for mutual exclusion.

    Mutexes (mutual-exclusion locks) are used to implement critical sections and protect shared mutable data structures against concurrent accesses. The typical use is (if m is the mutex associated with the data structure D):

    Mutex.lock m;
    +(* Critical section that operates over D *);
    +Mutex.unlock m
    type t

    The type of mutexes.

    val create : unit -> t

    Return a new mutex.

    val lock : t -> unit

    Lock the given mutex. Only one thread can have the mutex locked at any time. A thread that attempts to lock a mutex already locked by another thread will suspend until the other thread unlocks the mutex.

    • raises Sys_error

      if the mutex is already locked by the thread calling Mutex.lock.

    • before 4.12

      Sys_error was not raised for recursive locking (platform-dependent behaviour)

    val try_lock : t -> bool

    Same as Mutex.lock, but does not suspend the calling thread if the mutex is already locked: just return false immediately in that case. If the mutex is unlocked, lock it and return true.

    val unlock : t -> unit

    Unlock the given mutex. Other threads suspended trying to lock the mutex will restart. The mutex must have been previously locked by the thread that calls Mutex.unlock.

    • raises Sys_error

      if the mutex is unlocked or was locked by another thread.

    • before 4.12

      Sys_error was not raised when unlocking an unlocked mutex or when unlocking a mutex from a different thread.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Nativeint/index.html b/dev/ocaml/Stdlib/Nativeint/index.html index bfdeb39f..b1d20158 100644 --- a/dev/ocaml/Stdlib/Nativeint/index.html +++ b/dev/ocaml/Stdlib/Nativeint/index.html @@ -2,4 +2,4 @@ Nativeint (ocaml.Stdlib.Nativeint)

    Module Stdlib.Nativeint

    Processor-native integers.

    This module provides operations on the type nativeint of signed 32-bit integers (on 32-bit platforms) or signed 64-bit integers (on 64-bit platforms). This integer type has exactly the same width as that of a pointer type in the C compiler. All arithmetic operations over nativeint are taken modulo 232 or 264 depending on the word size of the architecture.

    Performance notice: values of type nativeint occupy more memory space than values of type int, and arithmetic operations on nativeint are generally slower than those on int. Use nativeint only when the application requires the extra bit of precision over the int type.

    Literals for native integers are suffixed by n:

    let zero: nativeint = 0n
     let one: nativeint = 1n
     let m_one: nativeint = -1n
    val zero : nativeint

    The native integer 0.

    val one : nativeint

    The native integer 1.

    val minus_one : nativeint

    The native integer -1.

    val neg : nativeint -> nativeint

    Unary negation.

    val add : nativeint -> nativeint -> nativeint

    Addition.

    val sub : nativeint -> nativeint -> nativeint

    Subtraction.

    val mul : nativeint -> nativeint -> nativeint

    Multiplication.

    val div : nativeint -> nativeint -> nativeint

    Integer division. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

    • raises Division_by_zero

      if the second argument is zero.

    val unsigned_div : nativeint -> nativeint -> nativeint

    Same as div, except that arguments and result are interpreted as unsigned native integers.

    • since 4.08.0
    val rem : nativeint -> nativeint -> nativeint

    Integer remainder. If y is not zero, the result of Nativeint.rem x y satisfies the following properties: Nativeint.zero <= Nativeint.rem x y < Nativeint.abs y and x = Nativeint.add (Nativeint.mul (Nativeint.div x y) y) - (Nativeint.rem x y). If y = 0, Nativeint.rem x y raises Division_by_zero.

    val unsigned_rem : nativeint -> nativeint -> nativeint

    Same as rem, except that arguments and result are interpreted as unsigned native integers.

    • since 4.08.0
    val succ : nativeint -> nativeint

    Successor. Nativeint.succ x is Nativeint.add x Nativeint.one.

    val pred : nativeint -> nativeint

    Predecessor. Nativeint.pred x is Nativeint.sub x Nativeint.one.

    val abs : nativeint -> nativeint

    Return the absolute value of its argument.

    val size : int

    The size in bits of a native integer. This is equal to 32 on a 32-bit platform and to 64 on a 64-bit platform.

    val max_int : nativeint

    The greatest representable native integer, either 231 - 1 on a 32-bit platform, or 263 - 1 on a 64-bit platform.

    val min_int : nativeint

    The smallest representable native integer, either -231 on a 32-bit platform, or -263 on a 64-bit platform.

    val logand : nativeint -> nativeint -> nativeint

    Bitwise logical and.

    val logor : nativeint -> nativeint -> nativeint

    Bitwise logical or.

    val logxor : nativeint -> nativeint -> nativeint

    Bitwise logical exclusive or.

    val lognot : nativeint -> nativeint

    Bitwise logical negation.

    val shift_left : nativeint -> int -> nativeint

    Nativeint.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

    val shift_right : nativeint -> int -> nativeint

    Nativeint.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

    val shift_right_logical : nativeint -> int -> nativeint

    Nativeint.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

    val of_int : int -> nativeint

    Convert the given integer (type int) to a native integer (type nativeint).

    val to_int : nativeint -> int

    Convert the given native integer (type nativeint) to an integer (type int). The high-order bit is lost during the conversion.

    val unsigned_to_int : nativeint -> int option

    Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

    • since 4.08.0
    val of_float : float -> nativeint

    Convert the given floating-point number to a native integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Nativeint.min_int, Nativeint.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

    val to_float : nativeint -> float

    Convert the given native integer to a floating-point number.

    val of_int32 : int32 -> nativeint

    Convert the given 32-bit integer (type int32) to a native integer.

    val to_int32 : nativeint -> int32

    Convert the given native integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.

    val of_string : string -> nativeint

    Convert the given string to a native integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*Nativeint.max_int+1]. If the input exceeds Nativeint.max_int it is converted to the signed integer Int64.min_int + input - Nativeint.max_int - 1.

    • raises Failure

      if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type nativeint.

    val of_string_opt : string -> nativeint option

    Same as of_string, but return None instead of raising.

    • since 4.05
    val to_string : nativeint -> string

    Return the string representation of its argument, in decimal.

    type t = nativeint

    An alias for the type of native integers.

    val compare : t -> t -> int

    The comparison function for native integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Nativeint to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned native integers.

    • since 4.08.0
    val equal : t -> t -> bool

    The equal function for native ints.

    • since 4.03.0
    val min : t -> t -> t

    Return the smaller of the two arguments.

    • since 4.13.0
    val max : t -> t -> t

    Return the greater of the two arguments.

    • since 4.13.0
    \ No newline at end of file + (Nativeint.rem x y). If y = 0, Nativeint.rem x y raises Division_by_zero.

    val unsigned_rem : nativeint -> nativeint -> nativeint

    Same as rem, except that arguments and result are interpreted as unsigned native integers.

    • since 4.08.0
    val succ : nativeint -> nativeint

    Successor. Nativeint.succ x is Nativeint.add x Nativeint.one.

    val pred : nativeint -> nativeint

    Predecessor. Nativeint.pred x is Nativeint.sub x Nativeint.one.

    val abs : nativeint -> nativeint

    abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

    val size : int

    The size in bits of a native integer. This is equal to 32 on a 32-bit platform and to 64 on a 64-bit platform.

    val max_int : nativeint

    The greatest representable native integer, either 231 - 1 on a 32-bit platform, or 263 - 1 on a 64-bit platform.

    val min_int : nativeint

    The smallest representable native integer, either -231 on a 32-bit platform, or -263 on a 64-bit platform.

    val logand : nativeint -> nativeint -> nativeint

    Bitwise logical and.

    val logor : nativeint -> nativeint -> nativeint

    Bitwise logical or.

    val logxor : nativeint -> nativeint -> nativeint

    Bitwise logical exclusive or.

    val lognot : nativeint -> nativeint

    Bitwise logical negation.

    val shift_left : nativeint -> int -> nativeint

    Nativeint.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

    val shift_right : nativeint -> int -> nativeint

    Nativeint.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

    val shift_right_logical : nativeint -> int -> nativeint

    Nativeint.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

    val of_int : int -> nativeint

    Convert the given integer (type int) to a native integer (type nativeint).

    val to_int : nativeint -> int

    Convert the given native integer (type nativeint) to an integer (type int). The high-order bit is lost during the conversion.

    val unsigned_to_int : nativeint -> int option

    Same as to_int, but interprets the argument as an unsigned integer. Returns None if the unsigned value of the argument cannot fit into an int.

    • since 4.08.0
    val of_float : float -> nativeint

    Convert the given floating-point number to a native integer, discarding the fractional part (truncate towards 0). If the truncated floating-point number is outside the range [Nativeint.min_int, Nativeint.max_int], no exception is raised, and an unspecified, platform-dependent integer is returned.

    val to_float : nativeint -> float

    Convert the given native integer to a floating-point number.

    val of_int32 : int32 -> nativeint

    Convert the given 32-bit integer (type int32) to a native integer.

    val to_int32 : nativeint -> int32

    Convert the given native integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.

    val of_string : string -> nativeint

    Convert the given string to a native integer. The string is read in decimal (by default, or if the string begins with 0u) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively.

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*Nativeint.max_int+1]. If the input exceeds Nativeint.max_int it is converted to the signed integer Int64.min_int + input - Nativeint.max_int - 1.

    • raises Failure

      if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type nativeint.

    val of_string_opt : string -> nativeint option

    Same as of_string, but return None instead of raising.

    • since 4.05
    val to_string : nativeint -> string

    Return the string representation of its argument, in decimal.

    type t = nativeint

    An alias for the type of native integers.

    val compare : t -> t -> int

    The comparison function for native integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Nativeint to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned native integers.

    • since 4.08.0
    val equal : t -> t -> bool

    The equal function for native ints.

    • since 4.03.0
    val min : t -> t -> t

    Return the smaller of the two arguments.

    • since 4.13.0
    val max : t -> t -> t

    Return the greater of the two arguments.

    • since 4.13.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Obj/Ephemeron/index.html b/dev/ocaml/Stdlib/Obj/Ephemeron/index.html index 43288853..dfb9beef 100644 --- a/dev/ocaml/Stdlib/Obj/Ephemeron/index.html +++ b/dev/ocaml/Stdlib/Obj/Ephemeron/index.html @@ -1,2 +1,2 @@ -Ephemeron (ocaml.Stdlib.Obj.Ephemeron)

    Module Obj.Ephemeron

    Ephemeron with arbitrary arity and untyped

    type obj_t = t

    alias for Obj.t

    type t

    an ephemeron cf Ephemeron

    val create : int -> t

    create n returns an ephemeron with n keys. All the keys and the data are initially empty. The argument n must be between zero and max_ephe_length (limits included).

    val length : t -> int

    return the number of keys

    val get_key : t -> int -> obj_t option
    val get_key_copy : t -> int -> obj_t option
    val set_key : t -> int -> obj_t -> unit
    val unset_key : t -> int -> unit
    val check_key : t -> int -> bool
    val blit_key : t -> int -> t -> int -> int -> unit
    val get_data : t -> obj_t option
    val get_data_copy : t -> obj_t option
    val set_data : t -> obj_t -> unit
    val unset_data : t -> unit
    val check_data : t -> bool
    val blit_data : t -> t -> unit
    val max_ephe_length : int

    Maximum length of an ephemeron, ie the maximum number of keys an ephemeron could contain

    \ No newline at end of file +Ephemeron (ocaml.Stdlib.Obj.Ephemeron)

    Module Obj.Ephemeron

    Ephemeron with arbitrary arity and untyped

    type obj_t = t

    alias for Obj.t

    type t

    an ephemeron cf Ephemeron

    val create : int -> t

    create n returns an ephemeron with n keys. All the keys and the data are initially empty. The argument n must be between zero and max_ephe_length (limits included).

    val length : t -> int

    return the number of keys

    val get_key : t -> int -> obj_t option
    val get_key_copy : t -> int -> obj_t option
    val set_key : t -> int -> obj_t -> unit
    val unset_key : t -> int -> unit
    val check_key : t -> int -> bool
    val blit_key : t -> int -> t -> int -> int -> unit
    val get_data : t -> obj_t option
    val get_data_copy : t -> obj_t option
    val set_data : t -> obj_t -> unit
    val unset_data : t -> unit
    val check_data : t -> bool
    val blit_data : t -> t -> unit
    val max_ephe_length : int

    Maximum length of an ephemeron, ie the maximum number of keys an ephemeron could contain

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Obj/index.html b/dev/ocaml/Stdlib/Obj/index.html index 3f3bcac9..06c4f027 100644 --- a/dev/ocaml/Stdlib/Obj/index.html +++ b/dev/ocaml/Stdlib/Obj/index.html @@ -1,2 +1,2 @@ -Obj (ocaml.Stdlib.Obj)

    Module Stdlib.Obj

    Operations on internal representations of values.

    Not for the casual user.

    type t
    type raw_data = nativeint
    val repr : 'a -> t
    val obj : t -> 'a
    val magic : 'a -> 'b
    val is_block : t -> bool
    val is_int : t -> bool
    val tag : t -> int
    val size : t -> int
    val reachable_words : t -> int

    Computes the total size (in words, including the headers) of all heap blocks accessible from the argument. Statically allocated blocks are excluded, unless the runtime system was configured with --disable-naked-pointers.

    • since 4.04
    val field : t -> int -> t
    val set_field : t -> int -> t -> unit

    When using flambda:

    set_field MUST NOT be called on immutable blocks. (Blocks allocated in C stubs, or with new_block below, are always considered mutable.)

    The same goes for set_double_field and set_tag. However, for set_tag, in the case of immutable blocks where the middle-end optimizers never see code that discriminates on their tag (for example records), the operation should be safe. Such uses are nonetheless discouraged.

    For experts only: set_field et al can be made safe by first wrapping the block in Sys.opaque_identity, so any information about its contents will not be propagated.

    val set_tag : t -> int -> unit
    • deprecated Use with_tag instead.
    val double_field : t -> int -> float
    val set_double_field : t -> int -> float -> unit
    val raw_field : t -> int -> raw_data
    val set_raw_field : t -> int -> raw_data -> unit
    val new_block : int -> int -> t
    val dup : t -> t
    val truncate : t -> int -> unit
    • deprecated
    val add_offset : t -> Int32.t -> t
    val with_tag : int -> t -> t
    val first_non_constant_constructor_tag : int
    val last_non_constant_constructor_tag : int
    val lazy_tag : int
    val closure_tag : int
    val object_tag : int
    val infix_tag : int
    val forward_tag : int
    val no_scan_tag : int
    val abstract_tag : int
    val string_tag : int
    val double_tag : int
    val double_array_tag : int
    val custom_tag : int
    val final_tag : int
    • deprecated Replaced by custom_tag.
    val int_tag : int
    val out_of_heap_tag : int
    val unaligned_tag : int
    module Closure : sig ... end
    module Extension_constructor : sig ... end
    val extension_constructor : 'a -> extension_constructor
    • deprecated use Obj.Extension_constructor.of_val
    val extension_name : extension_constructor -> string
    • deprecated use Obj.Extension_constructor.name
    val extension_id : extension_constructor -> int
    • deprecated use Obj.Extension_constructor.id
    module Ephemeron : sig ... end

    Ephemeron with arbitrary arity and untyped

    \ No newline at end of file +Obj (ocaml.Stdlib.Obj)

    Module Stdlib.Obj

    Operations on internal representations of values.

    Not for the casual user.

    type t
    type raw_data = nativeint
    val repr : 'a -> t
    val obj : t -> 'a
    val magic : 'a -> 'b
    val is_block : t -> bool
    val is_int : t -> bool
    val tag : t -> int
    val size : t -> int
    val reachable_words : t -> int

    Computes the total size (in words, including the headers) of all heap blocks accessible from the argument. Statically allocated blocks are included.

    • since 4.04
    val field : t -> int -> t
    val set_field : t -> int -> t -> unit

    When using flambda:

    set_field MUST NOT be called on immutable blocks. (Blocks allocated in C stubs, or with new_block below, are always considered mutable.)

    The same goes for set_double_field.

    For experts only: set_field et al can be made safe by first wrapping the block in Sys.opaque_identity, so any information about its contents will not be propagated.

    val compare_and_swap_field : t -> int -> t -> t -> bool
    val is_shared : t -> bool
    val double_field : t -> int -> float
    val set_double_field : t -> int -> float -> unit
    val raw_field : t -> int -> raw_data
    val set_raw_field : t -> int -> raw_data -> unit
    val new_block : int -> int -> t
    val dup : t -> t
    val add_offset : t -> Int32.t -> t
    val with_tag : int -> t -> t
    val first_non_constant_constructor_tag : int
    val last_non_constant_constructor_tag : int
    val forcing_tag : int
    val cont_tag : int
    val lazy_tag : int
    val closure_tag : int
    val object_tag : int
    val infix_tag : int
    val forward_tag : int
    val no_scan_tag : int
    val abstract_tag : int
    val string_tag : int
    val double_tag : int
    val double_array_tag : int
    val custom_tag : int
    val int_tag : int
    val out_of_heap_tag : int
    val unaligned_tag : int
    module Closure : sig ... end
    module Extension_constructor : sig ... end
    module Ephemeron : sig ... end

    Ephemeron with arbitrary arity and untyped

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Oo/index.html b/dev/ocaml/Stdlib/Oo/index.html index 0da3251f..f129fd48 100644 --- a/dev/ocaml/Stdlib/Oo/index.html +++ b/dev/ocaml/Stdlib/Oo/index.html @@ -1,2 +1,2 @@ -Oo (ocaml.Stdlib.Oo)

    Module Stdlib.Oo

    Operations on objects

    val copy : < .. > as 'a -> 'a

    Oo.copy o returns a copy of object o, that is a fresh object with the same methods and instance variables as o.

    val id : < .. > -> int

    Return an integer identifying this object, unique for the current execution of the program. The generic comparison and hashing functions are based on this integer. When an object is obtained by unmarshaling, the id is refreshed, and thus different from the original object. As a consequence, the internal invariants of data structures such as hash table or sets containing objects are broken after unmarshaling the data structures.

    \ No newline at end of file +Oo (ocaml.Stdlib.Oo)

    Module Stdlib.Oo

    Operations on objects

    val copy : < .. > as 'a -> 'a

    Oo.copy o returns a copy of object o, that is a fresh object with the same methods and instance variables as o.

    • alert unsynchronized_access Unsynchronized accesses to mutable objects are a programming error.
    val id : < .. > -> int

    Return an integer identifying this object, unique for the current execution of the program. The generic comparison and hashing functions are based on this integer. When an object is obtained by unmarshaling, the id is refreshed, and thus different from the original object. As a consequence, the internal invariants of data structures such as hash table or sets containing objects are broken after unmarshaling the data structures.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Option/index.html b/dev/ocaml/Stdlib/Option/index.html index 3bc01968..6dbbce7a 100644 --- a/dev/ocaml/Stdlib/Option/index.html +++ b/dev/ocaml/Stdlib/Option/index.html @@ -1,2 +1,2 @@ -Option (ocaml.Stdlib.Option)

    Module Stdlib.Option

    Option values.

    Option values explicitly indicate the presence or absence of a value.

    Options

    type 'a t = 'a option =
    1. | None
    2. | Some of 'a

    The type for option values. Either None or a value Some v.

    val none : 'a option

    none is None.

    val some : 'a -> 'a option

    some v is Some v.

    val value : 'a option -> default:'a -> 'a

    value o ~default is v if o is Some v and default otherwise.

    val get : 'a option -> 'a

    get o is v if o is Some v and raise otherwise.

    • raises Invalid_argument

      if o is None.

    val bind : 'a option -> ('a -> 'b option) -> 'b option

    bind o f is f v if o is Some v and None if o is None.

    val join : 'a option option -> 'a option

    join oo is Some v if oo is Some (Some v) and None otherwise.

    val map : ('a -> 'b) -> 'a option -> 'b option

    map f o is None if o is None and Some (f v) is o is Some v.

    val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a

    fold ~none ~some o is none if o is None and some v if o is Some v.

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

    iter f o is f v if o is Some v and () otherwise.

    Predicates and comparisons

    val is_none : 'a option -> bool

    is_none o is true if and only if o is None.

    val is_some : 'a option -> bool

    is_some o is true if and only if o is Some o.

    val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool

    equal eq o0 o1 is true if and only if o0 and o1 are both None or if they are Some v0 and Some v1 and eq v0 v1 is true.

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

    compare cmp o0 o1 is a total order on options using cmp to compare values wrapped by Some _. None is smaller than Some _ values.

    Converting

    val to_result : none:'e -> 'a option -> ('a, 'e) result

    to_result ~none o is Ok v if o is Some v and Error none otherwise.

    val to_list : 'a option -> 'a list

    to_list o is [] if o is None and [v] if o is Some v.

    val to_seq : 'a option -> 'a Seq.t

    to_seq o is o as a sequence. None is the empty sequence and Some v is the singleton sequence containing v.

    \ No newline at end of file +Option (ocaml.Stdlib.Option)

    Module Stdlib.Option

    Option values.

    Option values explicitly indicate the presence or absence of a value.

    Options

    type 'a t = 'a option =
    1. | None
    2. | Some of 'a

    The type for option values. Either None or a value Some v.

    val none : 'a option

    none is None.

    val some : 'a -> 'a option

    some v is Some v.

    val value : 'a option -> default:'a -> 'a

    value o ~default is v if o is Some v and default otherwise.

    val get : 'a option -> 'a

    get o is v if o is Some v and raise otherwise.

    • raises Invalid_argument

      if o is None.

    val bind : 'a option -> ('a -> 'b option) -> 'b option

    bind o f is f v if o is Some v and None if o is None.

    val join : 'a option option -> 'a option

    join oo is Some v if oo is Some (Some v) and None otherwise.

    val map : ('a -> 'b) -> 'a option -> 'b option

    map f o is None if o is None and Some (f v) if o is Some v.

    val fold : none:'a -> some:('b -> 'a) -> 'b option -> 'a

    fold ~none ~some o is none if o is None and some v if o is Some v.

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

    iter f o is f v if o is Some v and () otherwise.

    Predicates and comparisons

    val is_none : 'a option -> bool

    is_none o is true if and only if o is None.

    val is_some : 'a option -> bool

    is_some o is true if and only if o is Some o.

    val equal : ('a -> 'a -> bool) -> 'a option -> 'a option -> bool

    equal eq o0 o1 is true if and only if o0 and o1 are both None or if they are Some v0 and Some v1 and eq v0 v1 is true.

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

    compare cmp o0 o1 is a total order on options using cmp to compare values wrapped by Some _. None is smaller than Some _ values.

    Converting

    val to_result : none:'e -> 'a option -> ('a, 'e) result

    to_result ~none o is Ok v if o is Some v and Error none otherwise.

    val to_list : 'a option -> 'a list

    to_list o is [] if o is None and [v] if o is Some v.

    val to_seq : 'a option -> 'a Seq.t

    to_seq o is o as a sequence. None is the empty sequence and Some v is the singleton sequence containing v.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Pervasives/index.html b/dev/ocaml/Stdlib/Pervasives/index.html deleted file mode 100644 index 8001b201..00000000 --- a/dev/ocaml/Stdlib/Pervasives/index.html +++ /dev/null @@ -1,11 +0,0 @@ - -Pervasives (ocaml.Stdlib.Pervasives)

    Module Stdlib.Pervasives

    val raise : exn -> 'a
    val raise_notrace : exn -> 'a
    val invalid_arg : string -> 'a
    val failwith : string -> 'a
    exception Exit
    val (=) : 'a -> 'a -> bool
    val (<>) : 'a -> 'a -> bool
    val (<) : 'a -> 'a -> bool
    val (>) : 'a -> 'a -> bool
    val (<=) : 'a -> 'a -> bool
    val (>=) : 'a -> 'a -> bool
    val compare : 'a -> 'a -> int
    val min : 'a -> 'a -> 'a
    val max : 'a -> 'a -> 'a
    val (==) : 'a -> 'a -> bool
    val (!=) : 'a -> 'a -> bool
    val not : bool -> bool
    val (&&) : bool -> bool -> bool
    val (&) : bool -> bool -> bool
    • deprecated Use (&&) instead.
    val (||) : bool -> bool -> bool
    val or : bool -> bool -> bool
    • deprecated Use (||) instead.
    val __LOC__ : string
    val __FILE__ : string
    val __LINE__ : int
    val __MODULE__ : string
    val __POS__ : string * int * int * int
    val __LOC_OF__ : 'a -> string * 'a
    val __LINE_OF__ : 'a -> int * 'a
    val __POS_OF__ : 'a -> (string * int * int * int) * 'a
    val (|>) : 'a -> ('a -> 'b) -> 'b
    val (@@) : ('a -> 'b) -> 'a -> 'b
    val (~-) : int -> int
    val (~+) : int -> int
    val succ : int -> int
    val pred : int -> int
    val (+) : int -> int -> int
    val (-) : int -> int -> int
    val (*) : int -> int -> int
    val (/) : int -> int -> int
    val (mod) : int -> int -> int
    val abs : int -> int
    val max_int : int
    val min_int : int
    val (land) : int -> int -> int
    val (lor) : int -> int -> int
    val (lxor) : int -> int -> int
    val lnot : int -> int
    val (lsl) : int -> int -> int
    val (lsr) : int -> int -> int
    val (asr) : int -> int -> int
    val (~-.) : float -> float
    val (~+.) : float -> float
    val (+.) : float -> float -> float
    val (-.) : float -> float -> float
    val (*.) : float -> float -> float
    val (/.) : float -> float -> float
    val (**) : float -> float -> float
    val sqrt : float -> float
    val exp : float -> float
    val log : float -> float
    val log10 : float -> float
    val expm1 : float -> float
    val log1p : float -> float
    val cos : float -> float
    val sin : float -> float
    val tan : float -> float
    val acos : float -> float
    val asin : float -> float
    val atan : float -> float
    val atan2 : float -> float -> float
    val hypot : float -> float -> float
    val cosh : float -> float
    val sinh : float -> float
    val tanh : float -> float
    val ceil : float -> float
    val floor : float -> float
    val abs_float : float -> float
    val copysign : float -> float -> float
    val mod_float : float -> float -> float
    val frexp : float -> float * int
    val ldexp : float -> int -> float
    val modf : float -> float * float
    val float : int -> float
    val float_of_int : int -> float
    val truncate : float -> int
    val int_of_float : float -> int
    val infinity : float
    val neg_infinity : float
    val nan : float
    val max_float : float
    val min_float : float
    val epsilon_float : float
    type nonrec fpclass = fpclass =
    1. | FP_normal
    2. | FP_subnormal
    3. | FP_zero
    4. | FP_infinite
    5. | FP_nan
    val classify_float : float -> fpclass
    val (^) : string -> string -> string
    val int_of_char : char -> int
    val char_of_int : int -> char
    val ignore : 'a -> unit
    val string_of_bool : bool -> string
    val bool_of_string : string -> bool
    val bool_of_string_opt : string -> bool option
    val string_of_int : int -> string
    val int_of_string : string -> int
    val int_of_string_opt : string -> int option
    val string_of_float : float -> string
    val float_of_string : string -> float
    val float_of_string_opt : string -> float option
    val fst : ('a * 'b) -> 'a
    val snd : ('a * 'b) -> 'b
    val (@) : 'a list -> 'a list -> 'a list
    type nonrec in_channel = in_channel
    type nonrec out_channel = out_channel
    val stdin : in_channel
    val stdout : out_channel
    val stderr : out_channel
    val print_char : char -> unit
    val print_string : string -> unit
    val print_bytes : bytes -> unit
    val print_int : int -> unit
    val print_float : float -> unit
    val print_endline : string -> unit
    val print_newline : unit -> unit
    val prerr_char : char -> unit
    val prerr_string : string -> unit
    val prerr_bytes : bytes -> unit
    val prerr_int : int -> unit
    val prerr_float : float -> unit
    val prerr_endline : string -> unit
    val prerr_newline : unit -> unit
    val read_line : unit -> string
    val read_int : unit -> int
    val read_int_opt : unit -> int option
    val read_float : unit -> float
    val read_float_opt : unit -> float option
    type nonrec open_flag = open_flag =
    1. | Open_rdonly
    2. | Open_wronly
    3. | Open_append
    4. | Open_creat
    5. | Open_trunc
    6. | Open_excl
    7. | Open_binary
    8. | Open_text
    9. | Open_nonblock
    val open_out : string -> out_channel
    val open_out_bin : string -> out_channel
    val open_out_gen : open_flag list -> int -> string -> out_channel
    val flush : out_channel -> unit
    val flush_all : unit -> unit
    val output_char : out_channel -> char -> unit
    val output_string : out_channel -> string -> unit
    val output_bytes : out_channel -> bytes -> unit
    val output : out_channel -> bytes -> int -> int -> unit
    val output_substring : out_channel -> string -> int -> int -> unit
    val output_byte : out_channel -> int -> unit
    val output_binary_int : out_channel -> int -> unit
    val output_value : out_channel -> 'a -> unit
    val seek_out : out_channel -> int -> unit
    val pos_out : out_channel -> int
    val out_channel_length : out_channel -> int
    val close_out : out_channel -> unit
    val close_out_noerr : out_channel -> unit
    val set_binary_mode_out : out_channel -> bool -> unit
    val open_in : string -> in_channel
    val open_in_bin : string -> in_channel
    val open_in_gen : open_flag list -> int -> string -> in_channel
    val input_char : in_channel -> char
    val input_line : in_channel -> string
    val input : in_channel -> bytes -> int -> int -> int
    val really_input : in_channel -> bytes -> int -> int -> unit
    val really_input_string : in_channel -> int -> string
    val input_byte : in_channel -> int
    val input_binary_int : in_channel -> int
    val input_value : in_channel -> 'a
    val seek_in : in_channel -> int -> unit
    val pos_in : in_channel -> int
    val in_channel_length : in_channel -> int
    val close_in : in_channel -> unit
    val close_in_noerr : in_channel -> unit
    val set_binary_mode_in : in_channel -> bool -> unit
    module LargeFile = LargeFile
    type nonrec 'a ref = 'a ref = {
    1. mutable contents : 'a;
    }
    val ref : 'a -> 'a ref
    val (!) : 'a ref -> 'a
    val (:=) : 'a ref -> 'a -> unit
    val incr : int ref -> unit
    val decr : int ref -> unit
    type nonrec ('a, 'b) result = ('a, 'b) result =
    1. | Ok of 'a
    2. | Error of 'b
    type ('a, 'b, 'c, 'd, 'e, 'f) format6 = - ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6
    type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6
    type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4
    val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string
    val format_of_string : - ('a, 'b, 'c, 'd, 'e, 'f) format6 -> - ('a, 'b, 'c, 'd, 'e, 'f) format6
    val (^^) : - ('a, 'b, 'c, 'd, 'e, 'f) format6 -> - ('f, 'b, 'c, 'e, 'g, 'h) format6 -> - ('a, 'b, 'c, 'd, 'g, 'h) format6
    val exit : int -> 'a
    val at_exit : (unit -> unit) -> unit
    val valid_float_lexem : string -> string
    val do_at_exit : unit -> unit
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Printexc/index.html b/dev/ocaml/Stdlib/Printexc/index.html index 27f32a78..8c0360e9 100644 --- a/dev/ocaml/Stdlib/Printexc/index.html +++ b/dev/ocaml/Stdlib/Printexc/index.html @@ -1,5 +1,5 @@ -Printexc (ocaml.Stdlib.Printexc)

    Module Stdlib.Printexc

    Facilities for printing exceptions and inspecting current call stack.

    type t = exn = ..

    The type of exception values.

    val to_string : exn -> string

    Printexc.to_string e returns a string representation of the exception e.

    val to_string_default : exn -> string

    Printexc.to_string_default e returns a string representation of the exception e, ignoring all registered exception printers.

    • since 4.09
    val print : ('a -> 'b) -> 'a -> 'b

    Printexc.print fn x applies fn to x and returns the result. If the evaluation of fn x raises any exception, the name of the exception is printed on standard error output, and the exception is raised again. The typical use is to catch and report exceptions that escape a function application.

    val catch : ('a -> 'b) -> 'a -> 'b

    Printexc.catch fn x is similar to Printexc.print, but aborts the program with exit code 2 after printing the uncaught exception. This function is deprecated: the runtime system is now able to print uncaught exceptions as precisely as Printexc.catch does. Moreover, calling Printexc.catch makes it harder to track the location of the exception using the debugger or the stack backtrace facility. So, do not use Printexc.catch in new code.

    val print_backtrace : out_channel -> unit

    Printexc.print_backtrace oc prints an exception backtrace on the output channel oc. The backtrace lists the program locations where the most-recently raised exception was raised and where it was propagated through function calls.

    If the call is not inside an exception handler, the returned backtrace is unspecified. If the call is after some exception-catching code (before in the handler, or in a when-guard during the matching of the exception handler), the backtrace may correspond to a later exception than the handled one.

    • since 3.11.0
    val get_backtrace : unit -> string

    Printexc.get_backtrace () returns a string containing the same exception backtrace that Printexc.print_backtrace would print. Same restriction usage than print_backtrace.

    • since 3.11.0
    val record_backtrace : bool -> unit

    Printexc.record_backtrace b turns recording of exception backtraces on (if b = true) or off (if b = false). Initially, backtraces are not recorded, unless the b flag is given to the program through the OCAMLRUNPARAM variable.

    • since 3.11.0
    val backtrace_status : unit -> bool

    Printexc.backtrace_status() returns true if exception backtraces are currently recorded, false if not.

    • since 3.11.0
    val register_printer : (exn -> string option) -> unit

    Printexc.register_printer fn registers fn as an exception printer. The printer should return None or raise an exception if it does not know how to convert the passed exception, and Some +Printexc (ocaml.Stdlib.Printexc)

    Module Stdlib.Printexc

    Facilities for printing exceptions and inspecting current call stack.

    type t = exn = ..

    The type of exception values.

    val to_string : exn -> string

    Printexc.to_string e returns a string representation of the exception e.

    val to_string_default : exn -> string

    Printexc.to_string_default e returns a string representation of the exception e, ignoring all registered exception printers.

    • since 4.09
    val print : ('a -> 'b) -> 'a -> 'b

    Printexc.print fn x applies fn to x and returns the result. If the evaluation of fn x raises any exception, the name of the exception is printed on standard error output, and the exception is raised again. The typical use is to catch and report exceptions that escape a function application.

    val catch : ('a -> 'b) -> 'a -> 'b

    Printexc.catch fn x is similar to Printexc.print, but aborts the program with exit code 2 after printing the uncaught exception. This function is deprecated: the runtime system is now able to print uncaught exceptions as precisely as Printexc.catch does. Moreover, calling Printexc.catch makes it harder to track the location of the exception using the debugger or the stack backtrace facility. So, do not use Printexc.catch in new code.

    • deprecated This function is no longer needed.
    val print_backtrace : out_channel -> unit

    Printexc.print_backtrace oc prints an exception backtrace on the output channel oc. The backtrace lists the program locations where the most-recently raised exception was raised and where it was propagated through function calls.

    If the call is not inside an exception handler, the returned backtrace is unspecified. If the call is after some exception-catching code (before in the handler, or in a when-guard during the matching of the exception handler), the backtrace may correspond to a later exception than the handled one.

    • since 3.11.0
    val get_backtrace : unit -> string

    Printexc.get_backtrace () returns a string containing the same exception backtrace that Printexc.print_backtrace would print. Same restriction usage than print_backtrace.

    • since 3.11.0
    val record_backtrace : bool -> unit

    Printexc.record_backtrace b turns recording of exception backtraces on (if b = true) or off (if b = false). Initially, backtraces are not recorded, unless the b flag is given to the program through the OCAMLRUNPARAM variable.

    • since 3.11.0
    val backtrace_status : unit -> bool

    Printexc.backtrace_status() returns true if exception backtraces are currently recorded, false if not.

    • since 3.11.0
    val register_printer : (exn -> string option) -> unit

    Printexc.register_printer fn registers fn as an exception printer. The printer should return None or raise an exception if it does not know how to convert the passed exception, and Some s with s the resulting string if it can convert the passed exception. Exceptions raised by the printer are ignored.

    When converting an exception into a string, the printers will be invoked in the reverse order of their registrations, until a printer returns a Some s value (if no such printer exists, the runtime will use a generic printer).

    When using this mechanism, one should be aware that an exception backtrace is attached to the thread that saw it raised, rather than to the exception itself. Practically, it means that the code related to fn should not use the backtrace if it has itself raised an exception before.

    • since 3.11.2
    val use_printers : exn -> string option

    Printexc.use_printers e returns None if there are no registered printers and Some s with else as the resulting string otherwise.

    • since 4.09

    Raw backtraces

    type raw_backtrace

    The type raw_backtrace stores a backtrace in a low-level format, which can be converted to usable form using raw_backtrace_entries and backtrace_slots_of_raw_entry below.

    Converting backtraces to backtrace_slots is slower than capturing the backtraces. If an application processes many backtraces, it can be useful to use raw_backtrace to avoid or delay conversion.

    Raw backtraces cannot be marshalled. If you need marshalling, you should use the array returned by the backtrace_slots function of the next section.

    • since 4.01.0
    type raw_backtrace_entry = private int

    A raw_backtrace_entry is an element of a raw_backtrace.

    Each raw_backtrace_entry is an opaque integer, whose value is not stable between different programs, or even between different runs of the same binary.

    A raw_backtrace_entry can be converted to a usable form using backtrace_slots_of_raw_entry below. Note that, due to inlining, a single raw_backtrace_entry may convert to several backtrace_slots. Since the values of a raw_backtrace_entry are not stable, they cannot be marshalled. If they are to be converted, the conversion must be done by the process that generated them.

    Again due to inlining, there may be multiple distinct raw_backtrace_entry values that convert to equal backtrace_slots. However, if two raw_backtrace_entrys are equal as integers, then they represent the same backtrace_slots.

    • since 4.12.0
    val raw_backtrace_entries : raw_backtrace -> raw_backtrace_entry array
    • since 4.12.0
    val get_raw_backtrace : unit -> raw_backtrace

    Printexc.get_raw_backtrace () returns the same exception backtrace that Printexc.print_backtrace would print, but in a raw format. Same restriction usage than print_backtrace.

    • since 4.01.0
    val print_raw_backtrace : out_channel -> raw_backtrace -> unit

    Print a raw backtrace in the same format Printexc.print_backtrace uses.

    • since 4.01.0
    val raw_backtrace_to_string : raw_backtrace -> string

    Return a string from a raw backtrace, in the same format Printexc.get_backtrace uses.

    • since 4.01.0
    val raise_with_backtrace : exn -> raw_backtrace -> 'a

    Reraise the exception using the given raw_backtrace for the origin of the exception

    • since 4.05.0

    Current call stack

    val get_callstack : int -> raw_backtrace

    Printexc.get_callstack n returns a description of the top of the call stack on the current program point (for the current thread), with at most n entries. (Note: this function is not related to exceptions at all, despite being part of the Printexc module.)

    • since 4.01.0

    Uncaught exceptions

    val default_uncaught_exception_handler : exn -> raw_backtrace -> unit

    Printexc.default_uncaught_exception_handler prints the exception and backtrace on standard error output.

    • since 4.11
    val set_uncaught_exception_handler : (exn -> raw_backtrace -> unit) -> unit

    Printexc.set_uncaught_exception_handler fn registers fn as the handler for uncaught exceptions. The default handler is Printexc.default_uncaught_exception_handler.

    Note that when fn is called all the functions registered with Stdlib.at_exit have already been called. Because of this you must make sure any output channel fn writes on is flushed.

    Also note that exceptions raised by user code in the interactive toplevel are not passed to this function as they are caught by the toplevel itself.

    If fn raises an exception, both the exceptions passed to fn and raised by fn will be printed with their respective backtrace.

    • since 4.02.0

    Manipulation of backtrace information

    These functions are used to traverse the slots of a raw backtrace and extract information from them in a programmer-friendly format.

    type backtrace_slot

    The abstract type backtrace_slot represents a single slot of a backtrace.

    • since 4.02
    val backtrace_slots : raw_backtrace -> backtrace_slot array option

    Returns the slots of a raw backtrace, or None if none of them contain useful information.

    In the return array, the slot at index 0 corresponds to the most recent function call, raise, or primitive get_backtrace call in the trace.

    Some possible reasons for returning None are as follow:

    • none of the slots in the trace come from modules compiled with debug information (-g)
    • the program is a bytecode program that has not been linked with debug information enabled (ocamlc -g)
    • since 4.02.0
    val backtrace_slots_of_raw_entry : raw_backtrace_entry -> backtrace_slot array option

    Returns the slots of a single raw backtrace entry, or None if this entry lacks debug information.

    Slots are returned in the same order as backtrace_slots: the slot at index 0 is the most recent call, raise, or primitive, and subsequent slots represent callers.

    • since 4.12
    type location = {
    1. filename : string;
    2. line_number : int;
    3. start_char : int;
    4. end_char : int;
    }

    The type of location information found in backtraces. start_char and end_char are positions relative to the beginning of the line.

    • since 4.02
    module Slot : sig ... end

    Raw backtrace slots

    type raw_backtrace_slot

    This type is used to iterate over the slots of a raw_backtrace. For most purposes, backtrace_slots_of_raw_entry is easier to use.

    Like raw_backtrace_entry, values of this type are process-specific and must absolutely not be marshalled, and are unsafe to use for this reason (marshalling them may not fail, but un-marshalling and using the result will result in undefined behavior).

    Elements of this type can still be compared and hashed: when two elements are equal, then they represent the same source location (the converse is not necessarily true in presence of inlining, for example).

    • since 4.02.0
    val raw_backtrace_length : raw_backtrace -> int

    raw_backtrace_length bckt returns the number of slots in the backtrace bckt.

    • since 4.02
    val get_raw_backtrace_slot : raw_backtrace -> int -> raw_backtrace_slot

    get_raw_backtrace_slot bckt pos returns the slot in position pos in the backtrace bckt.

    • since 4.02
    val convert_raw_backtrace_slot : raw_backtrace_slot -> backtrace_slot

    Extracts the user-friendly backtrace_slot from a low-level raw_backtrace_slot.

    • since 4.02
    val get_raw_backtrace_next_slot : diff --git a/dev/ocaml/Stdlib/Printf/index.html b/dev/ocaml/Stdlib/Printf/index.html index ad111bc1..95932a78 100644 --- a/dev/ocaml/Stdlib/Printf/index.html +++ b/dev/ocaml/Stdlib/Printf/index.html @@ -11,4 +11,4 @@ (Buffer.t -> 'd) -> Buffer.t -> ('a, Buffer.t, unit, 'd) format4 -> - 'a

    Same as kbprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

    • since 4.11.0

    Deprecated

    val kprintf : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a

    A deprecated synonym for ksprintf.

    \ No newline at end of file + 'a

    Same as kbprintf above, but does not print anything. Useful to ignore some material when conditionally printing.

    • since 4.11.0

    Deprecated

    val kprintf : (string -> 'b) -> ('a, unit, string, 'b) format4 -> 'a

    A deprecated synonym for ksprintf.

    • deprecated Use Printf.ksprintf instead.
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Queue/index.html b/dev/ocaml/Stdlib/Queue/index.html index 07010775..8349ca48 100644 --- a/dev/ocaml/Stdlib/Queue/index.html +++ b/dev/ocaml/Stdlib/Queue/index.html @@ -1,2 +1,2 @@ -Queue (ocaml.Stdlib.Queue)

    Module Stdlib.Queue

    First-in first-out queues.

    This module implements queues (FIFOs), with in-place modification.

    Warning This module is not thread-safe: each Queue.t value must be protected from concurrent access (e.g. with a Mutex.t). Failure to do so can lead to a crash.

    type !'a t

    The type of queues containing elements of type 'a.

    exception Empty

    Raised when Queue.take or Queue.peek is applied to an empty queue.

    val create : unit -> 'a t

    Return a new queue, initially empty.

    val add : 'a -> 'a t -> unit

    add x q adds the element x at the end of the queue q.

    val push : 'a -> 'a t -> unit

    push is a synonym for add.

    val take : 'a t -> 'a

    take q removes and returns the first element in queue q, or raises Empty if the queue is empty.

    val take_opt : 'a t -> 'a option

    take_opt q removes and returns the first element in queue q, or returns None if the queue is empty.

    • since 4.08
    val pop : 'a t -> 'a

    pop is a synonym for take.

    val peek : 'a t -> 'a

    peek q returns the first element in queue q, without removing it from the queue, or raises Empty if the queue is empty.

    val peek_opt : 'a t -> 'a option

    peek_opt q returns the first element in queue q, without removing it from the queue, or returns None if the queue is empty.

    • since 4.08
    val top : 'a t -> 'a

    top is a synonym for peek.

    val clear : 'a t -> unit

    Discard all elements from a queue.

    val copy : 'a t -> 'a t

    Return a copy of the given queue.

    val is_empty : 'a t -> bool

    Return true if the given queue is empty, false otherwise.

    val length : 'a t -> int

    Return the number of elements in a queue.

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

    iter f q applies f in turn to all elements of q, from the least recently entered to the most recently entered. The queue itself is unchanged.

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

    fold f accu q is equivalent to List.fold_left f accu l, where l is the list of q's elements. The queue remains unchanged.

    val transfer : 'a t -> 'a t -> unit

    transfer q1 q2 adds all of q1's elements at the end of the queue q2, then clears q1. It is equivalent to the sequence iter (fun x -> add x q2) q1; clear q1, but runs in constant time.

    Iterators

    val to_seq : 'a t -> 'a Seq.t

    Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration.

    • since 4.07
    val add_seq : 'a t -> 'a Seq.t -> unit

    Add the elements from a sequence to the end of the queue.

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

    Create a queue from a sequence.

    • since 4.07
    \ No newline at end of file +Queue (ocaml.Stdlib.Queue)

    Module Stdlib.Queue

    First-in first-out queues.

    This module implements queues (FIFOs), with in-place modification.

    Unsynchronized accesses

    Unsynchronized accesses to a queue may lead to an invalid queue state. Thus, concurrent accesses to queues must be synchronized (for instance with a Mutex.t).

    type !'a t

    The type of queues containing elements of type 'a.

    exception Empty

    Raised when Queue.take or Queue.peek is applied to an empty queue.

    val create : unit -> 'a t

    Return a new queue, initially empty.

    val add : 'a -> 'a t -> unit

    add x q adds the element x at the end of the queue q.

    val push : 'a -> 'a t -> unit

    push is a synonym for add.

    val take : 'a t -> 'a

    take q removes and returns the first element in queue q, or raises Empty if the queue is empty.

    val take_opt : 'a t -> 'a option

    take_opt q removes and returns the first element in queue q, or returns None if the queue is empty.

    • since 4.08
    val pop : 'a t -> 'a

    pop is a synonym for take.

    val peek : 'a t -> 'a

    peek q returns the first element in queue q, without removing it from the queue, or raises Empty if the queue is empty.

    val peek_opt : 'a t -> 'a option

    peek_opt q returns the first element in queue q, without removing it from the queue, or returns None if the queue is empty.

    • since 4.08
    val top : 'a t -> 'a

    top is a synonym for peek.

    val clear : 'a t -> unit

    Discard all elements from a queue.

    val copy : 'a t -> 'a t

    Return a copy of the given queue.

    val is_empty : 'a t -> bool

    Return true if the given queue is empty, false otherwise.

    val length : 'a t -> int

    Return the number of elements in a queue.

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

    iter f q applies f in turn to all elements of q, from the least recently entered to the most recently entered. The queue itself is unchanged.

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

    fold f accu q is equivalent to List.fold_left f accu l, where l is the list of q's elements. The queue remains unchanged.

    val transfer : 'a t -> 'a t -> unit

    transfer q1 q2 adds all of q1's elements at the end of the queue q2, then clears q1. It is equivalent to the sequence iter (fun x -> add x q2) q1; clear q1, but runs in constant time.

    Iterators

    val to_seq : 'a t -> 'a Seq.t

    Iterate on the queue, in front-to-back order. The behavior is not specified if the queue is modified during the iteration.

    • since 4.07
    val add_seq : 'a t -> 'a Seq.t -> unit

    Add the elements from a sequence to the end of the queue.

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

    Create a queue from a sequence.

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Random/State/index.html b/dev/ocaml/Stdlib/Random/State/index.html index 567d7a3d..300691aa 100644 --- a/dev/ocaml/Stdlib/Random/State/index.html +++ b/dev/ocaml/Stdlib/Random/State/index.html @@ -1,2 +1,2 @@ -State (ocaml.Stdlib.Random.State)

    Module Random.State

    type t

    The type of PRNG states.

    val make : int array -> t

    Create a new state and initialize it with the given seed.

    val make_self_init : unit -> t

    Create a new state and initialize it with a system-dependent low-entropy seed.

    val copy : t -> t

    Return a copy of the given state.

    val bits : t -> int
    val int : t -> int -> int
    val full_int : t -> int -> int
    val int32 : t -> Int32.t -> Int32.t
    val nativeint : t -> Nativeint.t -> Nativeint.t
    val int64 : t -> Int64.t -> Int64.t
    val float : t -> float -> float
    val bool : t -> bool
    val bits32 : t -> Int32.t
    val bits64 : t -> Int64.t
    val nativebits : t -> Nativeint.t

    These functions are the same as the basic functions, except that they use (and update) the given PRNG state instead of the default one.

    \ No newline at end of file +State (ocaml.Stdlib.Random.State)

    Module Random.State

    type t

    The type of PRNG states.

    val make : int array -> t

    Create a new state and initialize it with the given seed.

    val make_self_init : unit -> t

    Create a new state and initialize it with a random seed chosen in a system-dependent way. The seed is obtained as described in Random.self_init.

    val copy : t -> t

    Return a copy of the given state.

    val bits : t -> int
    val int : t -> int -> int
    val full_int : t -> int -> int
    val int32 : t -> Int32.t -> Int32.t
    val nativeint : t -> Nativeint.t -> Nativeint.t
    val int64 : t -> Int64.t -> Int64.t
    val float : t -> float -> float
    val bool : t -> bool
    val bits32 : t -> Int32.t
    val bits64 : t -> Int64.t
    val nativebits : t -> Nativeint.t

    These functions are the same as the basic functions, except that they use (and update) the given PRNG state instead of the default one.

    val split : t -> t

    Draw a fresh PRNG state from the given PRNG state. (The given PRNG state is modified.) The new PRNG is statistically independent from the given PRNG. Data can be drawn from both PRNGs, in any order, without risk of correlation. Both PRNGs can be split later, arbitrarily many times.

    • since 5.0.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Random/index.html b/dev/ocaml/Stdlib/Random/index.html index 34902710..c12db505 100644 --- a/dev/ocaml/Stdlib/Random/index.html +++ b/dev/ocaml/Stdlib/Random/index.html @@ -1,2 +1,2 @@ -Random (ocaml.Stdlib.Random)

    Module Stdlib.Random

    Pseudo-random number generators (PRNG).

    Basic functions

    val init : int -> unit

    Initialize the generator, using the argument as a seed. The same seed will always yield the same sequence of numbers.

    val full_init : int array -> unit

    Same as Random.init but takes more data as seed.

    val self_init : unit -> unit

    Initialize the generator with a random seed chosen in a system-dependent way. If /dev/urandom is available on the host machine, it is used to provide a highly random initial seed. Otherwise, a less random seed is computed from system parameters (current time, process IDs).

    val bits : unit -> int

    Return 30 random bits in a nonnegative integer.

    • before 3.12.0

      used a different algorithm (affects all the following functions)

    val int : int -> int

    Random.int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0 and less than 230.

    val full_int : int -> int

    Random.full_int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound may be any positive integer.

    If bound is less than 230, Random.full_int bound is equal to Random.int bound. If bound is greater than 230 (on 64-bit systems or non-standard environments, such as JavaScript), Random.full_int returns a value, where Random.int raises Invalid_argument.

    • since 4.13.0
    val int32 : Int32.t -> Int32.t

    Random.int32 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

    val nativeint : Nativeint.t -> Nativeint.t

    Random.nativeint bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

    val int64 : Int64.t -> Int64.t

    Random.int64 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

    val float : float -> float

    Random.float bound returns a random floating-point number between 0 and bound (inclusive). If bound is negative, the result is negative or zero. If bound is 0, the result is 0.

    val bool : unit -> bool

    Random.bool () returns true or false with probability 0.5 each.

    val bits32 : unit -> Int32.t

    Random.bits32 () returns 32 random bits as an integer between Int32.min_int and Int32.max_int.

    • since 4.14.0
    val bits64 : unit -> Int64.t

    Random.bits64 () returns 64 random bits as an integer between Int64.min_int and Int64.max_int.

    • since 4.14.0
    val nativebits : unit -> Nativeint.t

    Random.nativebits () returns 32 or 64 random bits (depending on the bit width of the platform) as an integer between Nativeint.min_int and Nativeint.max_int.

    • since 4.14.0

    Advanced functions

    The functions from module State manipulate the current state of the random generator explicitly. This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program.

    module State : sig ... end
    val get_state : unit -> State.t

    Return the current state of the generator used by the basic functions.

    val set_state : State.t -> unit

    Set the state of the generator used by the basic functions.

    \ No newline at end of file +Random (ocaml.Stdlib.Random)

    Module Stdlib.Random

    Pseudo-random number generators (PRNG).

    With multiple domains, each domain has its own generator that evolves independently of the generators of other domains. When a domain is created, its generator is initialized by splitting the state of the generator associated with the parent domain.

    In contrast, all threads within a domain share the same domain-local generator. Independent generators can be created with the Random.split function and used with the functions from the Random.State module.

    Basic functions

    val init : int -> unit

    Initialize the domain-local generator, using the argument as a seed. The same seed will always yield the same sequence of numbers.

    val full_init : int array -> unit

    Same as Random.init but takes more data as seed.

    val self_init : unit -> unit

    Initialize the domain-local generator with a random seed chosen in a system-dependent way. If /dev/urandom is available on the host machine, it is used to provide a highly random initial seed. Otherwise, a less random seed is computed from system parameters (current time, process IDs, domain-local state).

    val bits : unit -> int

    Return 30 random bits in a nonnegative integer.

    • before 5.0.0

      used a different algorithm (affects all the following functions)

    val int : int -> int

    Random.int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0 and less than 230.

    val full_int : int -> int

    Random.full_int bound returns a random integer between 0 (inclusive) and bound (exclusive). bound may be any positive integer.

    If bound is less than 230, Random.full_int bound is equal to Random.int bound. If bound is greater than 230 (on 64-bit systems or non-standard environments, such as JavaScript), Random.full_int returns a value, where Random.int raises Stdlib.Invalid_argument.

    • since 4.13.0
    val int32 : Int32.t -> Int32.t

    Random.int32 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

    val nativeint : Nativeint.t -> Nativeint.t

    Random.nativeint bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

    val int64 : Int64.t -> Int64.t

    Random.int64 bound returns a random integer between 0 (inclusive) and bound (exclusive). bound must be greater than 0.

    val float : float -> float

    Random.float bound returns a random floating-point number between 0 and bound (inclusive). If bound is negative, the result is negative or zero. If bound is 0, the result is 0.

    val bool : unit -> bool

    Random.bool () returns true or false with probability 0.5 each.

    val bits32 : unit -> Int32.t

    Random.bits32 () returns 32 random bits as an integer between Int32.min_int and Int32.max_int.

    • since 4.14.0
    val bits64 : unit -> Int64.t

    Random.bits64 () returns 64 random bits as an integer between Int64.min_int and Int64.max_int.

    • since 4.14.0
    val nativebits : unit -> Nativeint.t

    Random.nativebits () returns 32 or 64 random bits (depending on the bit width of the platform) as an integer between Nativeint.min_int and Nativeint.max_int.

    • since 4.14.0

    Advanced functions

    The functions from module State manipulate the current state of the random generator explicitly. This allows using one or several deterministic PRNGs, even in a multi-threaded program, without interference from other parts of the program.

    module State : sig ... end
    val get_state : unit -> State.t

    get_state() returns a fresh copy of the current state of the domain-local generator (which is used by the basic functions).

    val set_state : State.t -> unit

    set_state s updates the current state of the domain-local generator (which is used by the basic functions) by copying the state s into it.

    val split : unit -> State.t

    Draw a fresh PRNG state from the current state of the domain-local generator used by the default functions. (The state of the domain-local generator is modified.) See Random.State.split.

    • since 5.0.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Scanf/Scanning/index.html b/dev/ocaml/Stdlib/Scanf/Scanning/index.html index c89350fa..44007491 100644 --- a/dev/ocaml/Stdlib/Scanf/Scanning/index.html +++ b/dev/ocaml/Stdlib/Scanf/Scanning/index.html @@ -1,2 +1,2 @@ -Scanning (ocaml.Stdlib.Scanf.Scanning)

    Module Scanf.Scanning

    type in_channel

    The notion of input channel for the Scanf module: those channels provide all the machinery necessary to read from any source of characters, including a Stdlib.in_channel value. A Scanf.Scanning.in_channel value is also called a formatted input channel or equivalently a scanning buffer. The type Scanning.scanbuf below is an alias for Scanning.in_channel.

    • since 3.12.0
    type scanbuf = in_channel

    The type of scanning buffers. A scanning buffer is the source from which a formatted input function gets characters. The scanning buffer holds the current state of the scan, plus a function to get the next char from the input, and a token buffer to store the string matched so far.

    Note: a scanning action may often require to examine one character in advance; when this 'lookahead' character does not belong to the token read, it is stored back in the scanning buffer and becomes the next character yet to be read.

    val stdin : in_channel

    The standard input notion for the Scanf module. Scanning.stdin is the Scanning.in_channel formatted input channel attached to Stdlib.stdin.

    Note: in the interactive system, when input is read from Stdlib.stdin, the newline character that triggers evaluation is part of the input; thus, the scanning specifications must properly skip this additional newline character (for instance, simply add a '\n' as the last character of the format string).

    • since 3.12.0
    type file_name = string

    A convenient alias to designate a file name.

    • since 4.00.0
    val open_in : file_name -> in_channel

    Scanning.open_in fname returns a Scanning.in_channel formatted input channel for bufferized reading in text mode from file fname.

    Note: open_in returns a formatted input channel that efficiently reads characters in large chunks; in contrast, from_channel below returns formatted input channels that must read one character at a time, leading to a much slower scanning rate.

    • since 3.12.0
    val open_in_bin : file_name -> in_channel

    Scanning.open_in_bin fname returns a Scanning.in_channel formatted input channel for bufferized reading in binary mode from file fname.

    • since 3.12.0
    val close_in : in_channel -> unit

    Closes the Stdlib.in_channel associated with the given Scanning.in_channel formatted input channel.

    • since 3.12.0
    val from_file : file_name -> in_channel

    An alias for Scanning.open_in above.

    val from_file_bin : string -> in_channel

    An alias for Scanning.open_in_bin above.

    val from_string : string -> in_channel

    Scanning.from_string s returns a Scanning.in_channel formatted input channel which reads from the given string. Reading starts from the first character in the string. The end-of-input condition is set when the end of the string is reached.

    val from_function : (unit -> char) -> in_channel

    Scanning.from_function f returns a Scanning.in_channel formatted input channel with the given function as its reading method.

    When scanning needs one more character, the given function is called.

    When the function has no more character to provide, it must signal an end-of-input condition by raising the exception End_of_file.

    val from_channel : in_channel -> in_channel

    Scanning.from_channel ic returns a Scanning.in_channel formatted input channel which reads from the regular Stdlib.in_channel input channel ic argument. Reading starts at current reading position of ic.

    val end_of_input : in_channel -> bool

    Scanning.end_of_input ic tests the end-of-input condition of the given Scanning.in_channel formatted input channel.

    val beginning_of_input : in_channel -> bool

    Scanning.beginning_of_input ic tests the beginning of input condition of the given Scanning.in_channel formatted input channel.

    val name_of_input : in_channel -> string

    Scanning.name_of_input ic returns the name of the character source for the given Scanning.in_channel formatted input channel.

    • since 3.09.0
    val stdib : in_channel

    A deprecated alias for Scanning.stdin, the scanning buffer reading from Stdlib.stdin.

    • deprecated Use Scanf.Scanning.stdin instead.
    \ No newline at end of file +Scanning (ocaml.Stdlib.Scanf.Scanning)

    Module Scanf.Scanning

    type in_channel

    The notion of input channel for the Scanf module: those channels provide all the machinery necessary to read from any source of characters, including a Stdlib.in_channel value. A Scanf.Scanning.in_channel value is also called a formatted input channel or equivalently a scanning buffer. The type Scanning.scanbuf below is an alias for Scanning.in_channel. Note that a Scanning.in_channel is not concurrency-safe: concurrent use may produce arbitrary values or exceptions.

    • since 3.12.0
    type scanbuf = in_channel

    The type of scanning buffers. A scanning buffer is the source from which a formatted input function gets characters. The scanning buffer holds the current state of the scan, plus a function to get the next char from the input, and a token buffer to store the string matched so far.

    Note: a scanning action may often require to examine one character in advance; when this 'lookahead' character does not belong to the token read, it is stored back in the scanning buffer and becomes the next character yet to be read.

    val stdin : in_channel

    The standard input notion for the Scanf module. Scanning.stdin is the Scanning.in_channel formatted input channel attached to Stdlib.stdin.

    Note: in the interactive system, when input is read from Stdlib.stdin, the newline character that triggers evaluation is part of the input; thus, the scanning specifications must properly skip this additional newline character (for instance, simply add a '\n' as the last character of the format string).

    • since 3.12.0
    type file_name = string

    A convenient alias to designate a file name.

    • since 4.00.0
    val open_in : file_name -> in_channel

    Scanning.open_in fname returns a Scanning.in_channel formatted input channel for bufferized reading in text mode from file fname.

    Note: open_in returns a formatted input channel that efficiently reads characters in large chunks; in contrast, from_channel below returns formatted input channels that must read one character at a time, leading to a much slower scanning rate.

    • since 3.12.0
    val open_in_bin : file_name -> in_channel

    Scanning.open_in_bin fname returns a Scanning.in_channel formatted input channel for bufferized reading in binary mode from file fname.

    • since 3.12.0
    val close_in : in_channel -> unit

    Closes the Stdlib.in_channel associated with the given Scanning.in_channel formatted input channel.

    • since 3.12.0
    val from_file : file_name -> in_channel

    An alias for Scanning.open_in above.

    val from_file_bin : string -> in_channel

    An alias for Scanning.open_in_bin above.

    val from_string : string -> in_channel

    Scanning.from_string s returns a Scanning.in_channel formatted input channel which reads from the given string. Reading starts from the first character in the string. The end-of-input condition is set when the end of the string is reached.

    val from_function : (unit -> char) -> in_channel

    Scanning.from_function f returns a Scanning.in_channel formatted input channel with the given function as its reading method.

    When scanning needs one more character, the given function is called.

    When the function has no more character to provide, it must signal an end-of-input condition by raising the exception End_of_file.

    val from_channel : in_channel -> in_channel

    Scanning.from_channel ic returns a Scanning.in_channel formatted input channel which reads from the regular Stdlib.in_channel input channel ic argument. Reading starts at current reading position of ic.

    val end_of_input : in_channel -> bool

    Scanning.end_of_input ic tests the end-of-input condition of the given Scanning.in_channel formatted input channel.

    val beginning_of_input : in_channel -> bool

    Scanning.beginning_of_input ic tests the beginning of input condition of the given Scanning.in_channel formatted input channel.

    val name_of_input : in_channel -> string

    Scanning.name_of_input ic returns the name of the character source for the given Scanning.in_channel formatted input channel.

    • since 3.09.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Scanf/index.html b/dev/ocaml/Stdlib/Scanf/index.html index bb5c0753..61cfeb45 100644 --- a/dev/ocaml/Stdlib/Scanf/index.html +++ b/dev/ocaml/Stdlib/Scanf/index.html @@ -1,10 +1,12 @@ -Scanf (ocaml.Stdlib.Scanf)

    Module Stdlib.Scanf

    Formatted input functions.

    Introduction

    Functional input with format strings

    The module Scanf provides formatted input functions or scanners.

    The formatted input functions can read from any kind of input, including strings, files, or anything that can return characters. The more general source of characters is named a formatted input channel (or scanning buffer) and has type Scanning.in_channel. The more general formatted input function reads from any scanning buffer and is named bscanf.

    Generally speaking, the formatted input functions have 3 arguments:

    Hence, a typical call to the formatted input function Scanf.bscanf is bscanf ic fmt f, where:

    A simple example

    As suggested above, the expression bscanf ic "%d" f reads a decimal integer n from the source of characters ic and returns f n.

    For instance,

    then bscanf Scanning.stdin "%d" f reads an integer n from the standard input and returns f n (that is n + 1). Thus, if we evaluate bscanf stdin "%d" f, and then enter 41 at the keyboard, the result we get is 42.

    Formatted input as a functional feature

    The OCaml scanning facility is reminiscent of the corresponding C feature. However, it is also largely different, simpler, and yet more powerful: the formatted input functions are higher-order functionals and the parameter passing mechanism is just the regular function application not the variable assignment based mechanism which is typical for formatted input in imperative languages; the OCaml format strings also feature useful additions to easily define complex tokens; as expected within a functional programming language, the formatted input functions also support polymorphism, in particular arbitrary interaction with polymorphic user-defined scanners. Furthermore, the OCaml formatted input facility is fully type-checked at compile time.

    Formatted input channel

    module Scanning : sig ... end

    Type of formatted input functions

    type ('a, 'b, 'c, 'd) scanner = +Scanf (ocaml.Stdlib.Scanf)

    Module Stdlib.Scanf

    Formatted input functions.

    Introduction

    Functional input with format strings

    The module Scanf provides formatted input functions or scanners.

    The formatted input functions can read from any kind of input, including strings, files, or anything that can return characters. The more general source of characters is named a formatted input channel (or scanning buffer) and has type Scanning.in_channel. The more general formatted input function reads from any scanning buffer and is named bscanf.

    Generally speaking, the formatted input functions have 3 arguments:

    • the first argument is a source of characters for the input,
    • the second argument is a format string that specifies the values to read,
    • the third argument is a receiver function that is applied to the values read.

    Hence, a typical call to the formatted input function Scanf.bscanf is bscanf ic fmt f, where:

    • ic is a source of characters (typically a formatted input channel with type Scanning.in_channel),
    • fmt is a format string (the same format strings as those used to print material with module Printf or Format),
    • f is a function that has as many arguments as the number of values to read in the input according to fmt.

    A simple example

    As suggested above, the expression bscanf ic "%d" f reads a decimal integer n from the source of characters ic and returns f n.

    For instance,

    • if we use stdin as the source of characters (Scanning.stdin is the predefined formatted input channel that reads from standard input),
    • if we define the receiver f as let f x = x + 1,

    then bscanf Scanning.stdin "%d" f reads an integer n from the standard input and returns f n (that is n + 1). Thus, if we evaluate bscanf stdin "%d" f, and then enter 41 at the keyboard, the result we get is 42.

    Formatted input as a functional feature

    The OCaml scanning facility is reminiscent of the corresponding C feature. However, it is also largely different, simpler, and yet more powerful: the formatted input functions are higher-order functionals and the parameter passing mechanism is just the regular function application not the variable assignment based mechanism which is typical for formatted input in imperative languages; the OCaml format strings also feature useful additions to easily define complex tokens; as expected within a functional programming language, the formatted input functions also support polymorphism, in particular arbitrary interaction with polymorphic user-defined scanners. Furthermore, the OCaml formatted input facility is fully type-checked at compile time.

    Unsynchronized accesses

    Unsynchronized accesses to a Scanning.in_channel may lead to an invalid Scanning.in_channel state. Thus, concurrent accesses to Scanning.in_channels must be synchronized (for instance with a Mutex.t).

    Formatted input channel

    module Scanning : sig ... end

    Type of formatted input functions

    type ('a, 'b, 'c, 'd) scanner = ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd, 'd) format6 -> 'c

    The type of formatted input scanners: ('a, 'b, 'c, 'd) scanner is the type of a formatted input function that reads from some formatted input channel according to some format string; more precisely, if scan is some formatted input function, then scan - ic fmt f applies f to all the arguments specified by format string fmt, when scan has read those arguments from the Scanning.in_channel formatted input channel ic.

    For instance, the Scanf.scanf function below has type ('a, 'b, 'c, 'd) scanner, since it is a formatted input function that reads from Scanning.stdin: scanf fmt f applies f to the arguments specified by fmt, reading those arguments from Stdlib.stdin as expected.

    If the format fmt has some %r indications, the corresponding formatted input functions must be provided before receiver function f. For instance, if read_elem is an input function for values of type t, then bscanf ic "%r;" read_elem f reads a value v of type t followed by a ';' character, and returns f v.

    • since 3.10.0
    exception Scan_failure of string

    When the input can not be read according to the format string specification, formatted input functions typically raise exception Scan_failure.

    The general formatted input function

    val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner

    bscanf ic fmt r1 ... rN f reads characters from the Scanning.in_channel formatted input channel ic and converts them to values according to format string fmt. As a final step, receiver function f is applied to the values read and gives the result of the bscanf call.

    For instance, if f is the function fun s i -> i + 1, then Scanf.sscanf "x= 1" "%s = %i" f returns 2.

    Arguments r1 to rN are user-defined input functions that read the argument corresponding to the %r conversions specified in the format string.

    Format string description

    The format string is a character string which contains three types of objects:

    • plain characters, which are simply matched with the characters of the input (with a special case for space and line feed, see space),
    • conversion specifications, each of which causes reading and conversion of one argument for the function f (see conversion),
    • scanning indications to specify boundaries of tokens (see scanning indication).

    The space character in format strings

    As mentioned above, a plain character in the format string is just matched with the next character of the input; however, two characters are special exceptions to this rule: the space character (' ' or ASCII code 32) and the line feed character ('\n' or ASCII code 10). A space does not match a single space character, but any amount of 'whitespace' in the input. More precisely, a space inside the format string matches any number of tab, space, line feed and carriage return characters. Similarly, a line feed character in the format string matches either a single line feed or a carriage return followed by a line feed.

    Matching any amount of whitespace, a space in the format string also matches no amount of whitespace at all; hence, the call bscanf ib + ic fmt f applies f to all the arguments specified by format string fmt, when scan has read those arguments from the Scanning.in_channel formatted input channel ic.

    For instance, the Scanf.scanf function below has type ('a, 'b, 'c, 'd) scanner, since it is a formatted input function that reads from Scanning.stdin: scanf fmt f applies f to the arguments specified by fmt, reading those arguments from Stdlib.stdin as expected.

    If the format fmt has some %r indications, the corresponding formatted input functions must be provided before receiver function f. For instance, if read_elem is an input function for values of type t, then bscanf ic "%r;" read_elem f reads a value v of type t followed by a ';' character, and returns f v.

    • since 3.10.0
    type ('a, 'b, 'c, 'd) scanner_opt = + ('a, Scanning.in_channel, 'b, 'c, 'a -> 'd option, 'd) format6 -> + 'c
    exception Scan_failure of string

    When the input can not be read according to the format string specification, formatted input functions typically raise exception Scan_failure.

    The general formatted input function

    val bscanf : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner

    bscanf ic fmt r1 ... rN f reads characters from the Scanning.in_channel formatted input channel ic and converts them to values according to format string fmt. As a final step, receiver function f is applied to the values read and gives the result of the bscanf call.

    For instance, if f is the function fun s i -> i + 1, then Scanf.sscanf "x = 1" "%s = %i" f returns 2.

    Arguments r1 to rN are user-defined input functions that read the argument corresponding to the %r conversions specified in the format string.

    val bscanf_opt : Scanning.in_channel -> ('a, 'b, 'c, 'd) scanner_opt

    Same as Scanf.bscanf, but returns None in case of scanning failure.

    • since 5.0

    Format string description

    The format string is a character string which contains three types of objects:

    • plain characters, which are simply matched with the characters of the input (with a special case for space and line feed, see space),
    • conversion specifications, each of which causes reading and conversion of one argument for the function f (see conversion),
    • scanning indications to specify boundaries of tokens (see scanning indication).

    The space character in format strings

    As mentioned above, a plain character in the format string is just matched with the next character of the input; however, two characters are special exceptions to this rule: the space character (' ' or ASCII code 32) and the line feed character ('\n' or ASCII code 10). A space does not match a single space character, but any amount of 'whitespace' in the input. More precisely, a space inside the format string matches any number of tab, space, line feed and carriage return characters. Similarly, a line feed character in the format string matches either a single line feed or a carriage return followed by a line feed.

    Matching any amount of whitespace, a space in the format string also matches no amount of whitespace at all; hence, the call bscanf ib "Price = %d $" (fun p -> p) succeeds and returns 1 when reading an input with various whitespace in it, such as Price = 1 $, Price = 1 $, or even Price=1$.

    Conversion specifications in format strings

    Conversion specifications consist in the % character, followed by an optional flag, an optional field width, and followed by one or two conversion characters.

    The conversion characters and their meanings are:

    • d: reads an optionally signed decimal integer (0-9+).
    • i: reads an optionally signed integer (usual input conventions for decimal (0-9+), hexadecimal (0x[0-9a-f]+ and 0X[0-9A-F]+), octal (0o[0-7]+), and binary (0b[0-1]+) notations are understood).
    • u: reads an unsigned decimal integer.
    • x or X: reads an unsigned hexadecimal integer ([0-9a-fA-F]+).
    • o: reads an unsigned octal integer ([0-7]+).
    • s: reads a string argument that spreads as much as possible, until the following bounding condition holds:

      • a whitespace has been found (see space),
      • a scanning indication (see scanning indication) has been encountered,
      • the end-of-input has been reached.

      Hence, this conversion always succeeds: it returns an empty string if the bounding condition holds when the scan begins.

    • S: reads a delimited string argument (delimiters and special escaped characters follow the lexical conventions of OCaml).
    • c: reads a single character. To test the current input character without reading it, specify a null field width, i.e. use specification %0c. Raise Invalid_argument, if the field width specification is greater than 1.
    • C: reads a single delimited character (delimiters and special escaped characters follow the lexical conventions of OCaml).
    • f, e, E, g, G: reads an optionally signed floating-point number in decimal notation, in the style dddd.ddd - e/E+-dd.
    • h, H: reads an optionally signed floating-point number in hexadecimal notation.
    • F: reads a floating point number according to the lexical conventions of OCaml (hence the decimal point is mandatory if the exponent part is not mentioned).
    • B: reads a boolean argument (true or false).
    • b: reads a boolean argument (for backward compatibility; do not use in new programs).
    • ld, li, lu, lx, lX, lo: reads an int32 argument to the format specified by the second letter for regular integers.
    • nd, ni, nu, nx, nX, no: reads a nativeint argument to the format specified by the second letter for regular integers.
    • Ld, Li, Lu, Lx, LX, Lo: reads an int64 argument to the format specified by the second letter for regular integers.
    • [ range ]: reads characters that matches one of the characters mentioned in the range of characters range (or not mentioned in it, if the range starts with ^). Reads a string that can be empty, if the next input character does not match the range. The set of characters from c1 to c2 (inclusively) is denoted by c1-c2. Hence, %[0-9] returns a string representing a decimal number or an empty string if no decimal digit is found; similarly, %[0-9a-f] returns a string of hexadecimal digits. If a closing bracket appears in a range, it must occur as the first character of the range (or just after the ^ in case of range negation); hence []] matches a ] character and [^]] matches any character that is not ]. Use %% and %@ to include a % or a @ in a range.
    • r: user-defined reader. Takes the next ri formatted input function and applies it to the scanning buffer ib to read the next argument. The input function ri must therefore have type Scanning.in_channel -> 'a and the argument read has type 'a.
    • { fmt %}: reads a format string argument. The format string read must have the same type as the format string specification fmt. For instance, "%{ %i %}" reads any format string that can read a value of type int; hence, if s is the string "fmt:\"number is %u\"", then Scanf.sscanf s "fmt: %{%i%}" succeeds and returns the format string "number is %u".
    • ( fmt %): scanning sub-format substitution. Reads a format string rf in the input, then goes on scanning with rf instead of scanning with fmt. The format string rf must have the same type as the format string specification fmt that it replaces. For instance, "%( %i %)" reads any format string that can read a value of type int. The conversion returns the format string read rf, and then a value read using rf. Hence, if s is the string "\"%4d\"1234.00", then Scanf.sscanf s "%(%i%)" (fun fmt i -> fmt, i) evaluates to ("%4d", 1234). This behaviour is not mere format substitution, since the conversion returns the format string read as additional argument. If you need pure format substitution, use special flag _ to discard the extraneous argument: conversion %_( fmt %) reads a format string rf and then behaves the same as format string rf. Hence, if s is the string "\"%4d\"1234.00", then Scanf.sscanf s "%_(%i%)" is simply equivalent to Scanf.sscanf "1234.00" "%4d".
    • l: returns the number of lines read so far.
    • n: returns the number of characters read so far.
    • N or L: returns the number of tokens read so far.
    • !: matches the end of input condition.
    • %: matches one % character in the input.
    • @: matches one @ character in the input.
    • ,: does nothing.

    Following the % character that introduces a conversion, there may be the special flag _: the conversion that follows occurs as usual, but the resulting value is discarded. For instance, if f is the function fun i -> i + 1, and s is the string "x = 1", then Scanf.sscanf s "%_s = %i" f returns 2.

    The field width is composed of an optional integer literal indicating the maximal width of the token to read. For instance, %6d reads an integer, having at most 6 decimal digits; %4f reads a float with at most 4 characters; and %8[\000-\255] returns the next 8 characters (or all the characters still available, if fewer than 8 characters are available in the input).

    Notes:

    • as mentioned above, a %s conversion always succeeds, even if there is nothing to read in the input: in this case, it simply returns "".
    • in addition to the relevant digits, '_' characters may appear inside numbers (this is reminiscent to the usual OCaml lexical conventions). If stricter scanning is desired, use the range conversion facility instead of the number conversions.
    • the scanf facility is not intended for heavy duty lexical analysis and parsing. If it appears not expressive enough for your needs, several alternative exists: regular expressions (module Str), stream parsers, ocamllex-generated lexers, ocamlyacc-generated parsers.

    Scanning indications in format strings

    Scanning indications appear just after the string conversions %s and %[ range ] to delimit the end of the token. A scanning indication is introduced by a @ character, followed by some plain character c. It means that the string token should end just before the next matching c (which is skipped). If no c character is encountered, the string token spreads as much as possible. For instance, "%s@\t" reads a string up to the next tab character or to the end of input. If a @ character appears anywhere else in the format string, it is treated as a plain character.

    Note:

    • As usual in format strings, % and @ characters must be escaped using %% and %@; this rule still holds within range specifications and scanning indications. For instance, format "%s@%%" reads a string up to the next % character, and format "%s@%@" reads a string up to the next @.
    • The scanning indications introduce slight differences in the syntax of Scanf format strings, compared to those used for the Printf module. However, the scanning indications are similar to those used in the Format module; hence, when producing formatted text to be scanned by Scanf.bscanf, it is wise to use printing functions from the Format module (or, if you need to use functions from Printf, banish or carefully double check the format strings that contain '@' characters).

    Exceptions during scanning

    Scanners may raise the following exceptions when the input cannot be read according to the format string:

    • Raise Failure if a conversion to a number is not possible.
    • Raise End_of_file if the end of input is encountered while some more characters are needed to read the current conversion specification.
    • Raise Invalid_argument if the format string is invalid.

    Note:

    • as a consequence, scanning a %s conversion never raises exception End_of_file: if the end of input is reached the conversion succeeds and simply returns the characters read so far, or "" if none were ever read.

    Specialised formatted input functions

    val sscanf : string -> ('a, 'b, 'c, 'd) scanner

    Same as Scanf.bscanf, but reads from the given string.

    val scanf : ('a, 'b, 'c, 'd) scanner

    Same as Scanf.bscanf, but reads from the predefined formatted input channel Scanf.Scanning.stdin that is connected to Stdlib.stdin.

    val kscanf : + e/E+-dd.
  • h, H: reads an optionally signed floating-point number in hexadecimal notation.
  • F: reads a floating point number according to the lexical conventions of OCaml (hence the decimal point is mandatory if the exponent part is not mentioned).
  • B: reads a boolean argument (true or false).
  • b: reads a boolean argument (for backward compatibility; do not use in new programs).
  • ld, li, lu, lx, lX, lo: reads an int32 argument to the format specified by the second letter for regular integers.
  • nd, ni, nu, nx, nX, no: reads a nativeint argument to the format specified by the second letter for regular integers.
  • Ld, Li, Lu, Lx, LX, Lo: reads an int64 argument to the format specified by the second letter for regular integers.
  • [ range ]: reads characters that matches one of the characters mentioned in the range of characters range (or not mentioned in it, if the range starts with ^). Reads a string that can be empty, if the next input character does not match the range. The set of characters from c1 to c2 (inclusively) is denoted by c1-c2. Hence, %[0-9] returns a string representing a decimal number or an empty string if no decimal digit is found; similarly, %[0-9a-f] returns a string of hexadecimal digits. If a closing bracket appears in a range, it must occur as the first character of the range (or just after the ^ in case of range negation); hence []] matches a ] character and [^]] matches any character that is not ]. Use %% and %@ to include a % or a @ in a range.
  • r: user-defined reader. Takes the next ri formatted input function and applies it to the scanning buffer ib to read the next argument. The input function ri must therefore have type Scanning.in_channel -> 'a and the argument read has type 'a.
  • { fmt %}: reads a format string argument. The format string read must have the same type as the format string specification fmt. For instance, "%{ %i %}" reads any format string that can read a value of type int; hence, if s is the string "fmt:\"number is %u\"", then Scanf.sscanf s "fmt: %{%i%}" succeeds and returns the format string "number is %u".
  • ( fmt %): scanning sub-format substitution. Reads a format string rf in the input, then goes on scanning with rf instead of scanning with fmt. The format string rf must have the same type as the format string specification fmt that it replaces. For instance, "%( %i %)" reads any format string that can read a value of type int. The conversion returns the format string read rf, and then a value read using rf. Hence, if s is the string "\"%4d\"1234.00", then Scanf.sscanf s "%(%i%)" (fun fmt i -> fmt, i) evaluates to ("%4d", 1234). This behaviour is not mere format substitution, since the conversion returns the format string read as additional argument. If you need pure format substitution, use special flag _ to discard the extraneous argument: conversion %_( fmt %) reads a format string rf and then behaves the same as format string rf. Hence, if s is the string "\"%4d\"1234.00", then Scanf.sscanf s "%_(%i%)" is simply equivalent to Scanf.sscanf "1234.00" "%4d".
  • l: returns the number of lines read so far.
  • n: returns the number of characters read so far.
  • N or L: returns the number of tokens read so far.
  • !: matches the end of input condition.
  • %: matches one % character in the input.
  • @: matches one @ character in the input.
  • ,: does nothing.
  • Following the % character that introduces a conversion, there may be the special flag _: the conversion that follows occurs as usual, but the resulting value is discarded. For instance, if f is the function fun i -> i + 1, and s is the string "x = 1", then Scanf.sscanf s "%_s = %i" f returns 2.

    The field width is composed of an optional integer literal indicating the maximal width of the token to read. For instance, %6d reads an integer, having at most 6 decimal digits; %4f reads a float with at most 4 characters; and %8[\000-\255] returns the next 8 characters (or all the characters still available, if fewer than 8 characters are available in the input).

    Notes:

    • as mentioned above, a %s conversion always succeeds, even if there is nothing to read in the input: in this case, it simply returns "".
    • in addition to the relevant digits, '_' characters may appear inside numbers (this is reminiscent to the usual OCaml lexical conventions). If stricter scanning is desired, use the range conversion facility instead of the number conversions.
    • the scanf facility is not intended for heavy duty lexical analysis and parsing. If it appears not expressive enough for your needs, several alternative exists: regular expressions (module Str), stream parsers, ocamllex-generated lexers, ocamlyacc-generated parsers.

    Scanning indications in format strings

    Scanning indications appear just after the string conversions %s and %[ range ] to delimit the end of the token. A scanning indication is introduced by a @ character, followed by some plain character c. It means that the string token should end just before the next matching c (which is skipped). If no c character is encountered, the string token spreads as much as possible. For instance, "%s@\t" reads a string up to the next tab character or to the end of input. If a @ character appears anywhere else in the format string, it is treated as a plain character.

    Note:

    • As usual in format strings, % and @ characters must be escaped using %% and %@; this rule still holds within range specifications and scanning indications. For instance, format "%s@%%" reads a string up to the next % character, and format "%s@%@" reads a string up to the next @.
    • The scanning indications introduce slight differences in the syntax of Scanf format strings, compared to those used for the Printf module. However, the scanning indications are similar to those used in the Format module; hence, when producing formatted text to be scanned by Scanf.bscanf, it is wise to use printing functions from the Format module (or, if you need to use functions from Printf, banish or carefully double check the format strings that contain '@' characters).

    Exceptions during scanning

    Scanners may raise the following exceptions when the input cannot be read according to the format string:

    • Raise Failure if a conversion to a number is not possible.
    • Raise End_of_file if the end of input is encountered while some more characters are needed to read the current conversion specification.
    • Raise Invalid_argument if the format string is invalid.

    Note:

    • as a consequence, scanning a %s conversion never raises exception End_of_file: if the end of input is reached the conversion succeeds and simply returns the characters read so far, or "" if none were ever read.

    Specialised formatted input functions

    val sscanf : string -> ('a, 'b, 'c, 'd) scanner

    Same as Scanf.bscanf, but reads from the given string.

    val sscanf_opt : string -> ('a, 'b, 'c, 'd) scanner_opt

    Same as Scanf.sscanf, but returns None in case of scanning failure.

    • since 5.0
    val scanf : ('a, 'b, 'c, 'd) scanner

    Same as Scanf.bscanf, but reads from the predefined formatted input channel Scanf.Scanning.stdin that is connected to Stdlib.stdin.

    val scanf_opt : ('a, 'b, 'c, 'd) scanner_opt

    Same as Scanf.scanf, but returns None in case of scanning failure.

    • since 5.0
    val kscanf : Scanning.in_channel -> (Scanning.in_channel -> exn -> 'd) -> ('a, 'b, 'c, 'd) scanner

    Same as Scanf.bscanf, but takes an additional function argument ef that is called in case of error: if the scanning process or some conversion fails, the scanning function aborts and calls the error handling function ef with the formatted input channel and the exception that aborted the scanning process as arguments.

    val ksscanf : @@ -21,7 +23,4 @@ 'g

    Same as Scanf.bscanf_format, but reads from the given string.

    • since 3.09.0
    val format_from_string : string -> ('a, 'b, 'c, 'd, 'e, 'f) format6 -> - ('a, 'b, 'c, 'd, 'e, 'f) format6

    format_from_string s fmt converts a string argument to a format string, according to the given format string fmt.

    • raises Scan_failure

      if s, considered as a format string, does not have the same type as fmt.

    • since 3.10.0
    val unescaped : string -> string

    unescaped s return a copy of s with escape sequences (according to the lexical conventions of OCaml) replaced by their corresponding special characters. More precisely, Scanf.unescaped has the following property: for all string s, Scanf.unescaped (String.escaped s) = s.

    Always return a copy of the argument, even if there is no escape sequence in the argument.

    • raises Scan_failure

      if s is not properly escaped (i.e. s has invalid escape sequences or special characters that are not properly escaped). For instance, Scanf.unescaped "\"" will fail.

    • since 4.00.0

    Deprecated

    val fscanf : in_channel -> ('a, 'b, 'c, 'd) scanner
    • deprecated

      Scanf.fscanf is error prone and deprecated since 4.03.0.

      This function violates the following invariant of the Scanf module: To preserve scanning semantics, all scanning functions defined in Scanf must read from a user defined Scanning.in_channel formatted input channel.

      If you need to read from a Stdlib.in_channel input channel ic, simply define a Scanning.in_channel formatted input channel as in let ib = Scanning.from_channel ic, then use Scanf.bscanf ib as usual.

    val kfscanf : - in_channel -> - (Scanning.in_channel -> exn -> 'd) -> - ('a, 'b, 'c, 'd) scanner
    • deprecated

      Scanf.kfscanf is error prone and deprecated since 4.03.0.

    \ No newline at end of file + ('a, 'b, 'c, 'd, 'e, 'f) format6

    format_from_string s fmt converts a string argument to a format string, according to the given format string fmt.

    • raises Scan_failure

      if s, considered as a format string, does not have the same type as fmt.

    • since 3.10.0
    val unescaped : string -> string

    unescaped s return a copy of s with escape sequences (according to the lexical conventions of OCaml) replaced by their corresponding special characters. More precisely, Scanf.unescaped has the following property: for all string s, Scanf.unescaped (String.escaped s) = s.

    Always return a copy of the argument, even if there is no escape sequence in the argument.

    • raises Scan_failure

      if s is not properly escaped (i.e. s has invalid escape sequences or special characters that are not properly escaped). For instance, Scanf.unescaped "\"" will fail.

    • since 4.00.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Semaphore/Binary/index.html b/dev/ocaml/Stdlib/Semaphore/Binary/index.html new file mode 100644 index 00000000..c830c1ee --- /dev/null +++ b/dev/ocaml/Stdlib/Semaphore/Binary/index.html @@ -0,0 +1,2 @@ + +Binary (ocaml.Stdlib.Semaphore.Binary)

    Module Semaphore.Binary

    type t

    The type of binary semaphores.

    val make : bool -> t

    make b returns a new binary semaphore. If b is true, the initial value of the semaphore is 1, meaning "available". If b is false, the initial value of the semaphore is 0, meaning "unavailable".

    val release : t -> unit

    release s sets the value of semaphore s to 1, putting it in the "available" state. If other threads are waiting on s, one of them is restarted.

    val acquire : t -> unit

    acquire s blocks the calling thread until the semaphore s has value 1 (is available), then atomically sets it to 0 and returns.

    val try_acquire : t -> bool

    try_acquire s immediately returns false if the semaphore s has value 0. If s has value 1, its value is atomically set to 0 and try_acquire s returns true.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Semaphore/Counting/index.html b/dev/ocaml/Stdlib/Semaphore/Counting/index.html new file mode 100644 index 00000000..4fa22ab9 --- /dev/null +++ b/dev/ocaml/Stdlib/Semaphore/Counting/index.html @@ -0,0 +1,2 @@ + +Counting (ocaml.Stdlib.Semaphore.Counting)

    Module Semaphore.Counting

    type t

    The type of counting semaphores.

    val make : int -> t

    make n returns a new counting semaphore, with initial value n. The initial value n must be nonnegative.

    • raises Invalid_argument

      if n < 0

    val release : t -> unit

    release s increments the value of semaphore s. If other threads are waiting on s, one of them is restarted. If the current value of s is equal to max_int, the value of the semaphore is unchanged and a Sys_error exception is raised to signal overflow.

    • raises Sys_error

      if the value of the semaphore would overflow max_int

    val acquire : t -> unit

    acquire s blocks the calling thread until the value of semaphore s is not zero, then atomically decrements the value of s and returns.

    val try_acquire : t -> bool

    try_acquire s immediately returns false if the value of semaphore s is zero. Otherwise, the value of s is atomically decremented and try_acquire s returns true.

    val get_value : t -> int

    get_value s returns the current value of semaphore s. The current value can be modified at any time by concurrent release and acquire operations. Hence, the get_value operation is racy, and its result should only be used for debugging or informational messages.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Semaphore/index.html b/dev/ocaml/Stdlib/Semaphore/index.html new file mode 100644 index 00000000..6812e15f --- /dev/null +++ b/dev/ocaml/Stdlib/Semaphore/index.html @@ -0,0 +1,2 @@ + +Semaphore (ocaml.Stdlib.Semaphore)

    Module Stdlib.Semaphore

    Semaphores

    A semaphore is a thread synchronization device that can be used to control access to a shared resource.

    Two flavors of semaphores are provided: counting semaphores and binary semaphores.

    Counting semaphores

    A counting semaphore is a counter that can be accessed concurrently by several threads. The typical use is to synchronize producers and consumers of a resource by counting how many units of the resource are available.

    The two basic operations on semaphores are:

    module Counting : sig ... end

    Binary semaphores

    Binary semaphores are a variant of counting semaphores where semaphores can only take two values, 0 and 1.

    A binary semaphore can be used to control access to a single shared resource, with value 1 meaning "resource is available" and value 0 meaning "resource is unavailable".

    The "release" operation of a binary semaphore sets its value to 1, and "acquire" waits until the value is 1 and sets it to 0.

    A binary semaphore can be used instead of a mutex (see module Mutex) when the mutex discipline (of unlocking the mutex from the thread that locked it) is too restrictive. The "acquire" operation corresponds to locking the mutex, and the "release" operation to unlocking it, but "release" can be performed in a thread different than the one that performed the "acquire". Likewise, it is safe to release a binary semaphore that is already available.

    module Binary : sig ... end
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Seq/index.html b/dev/ocaml/Stdlib/Seq/index.html index f01b3484..d3246d55 100644 --- a/dev/ocaml/Stdlib/Seq/index.html +++ b/dev/ocaml/Stdlib/Seq/index.html @@ -1,2 +1,2 @@ -Seq (ocaml.Stdlib.Seq)

    Module Stdlib.Seq

    Sequences.

    A sequence of type 'a Seq.t can be thought of as a delayed list, that is, a list whose elements are computed only when they are demanded by a consumer. This allows sequences to be produced and transformed lazily (one element at a time) rather than eagerly (all elements at once). This also allows constructing conceptually infinite sequences.

    The type 'a Seq.t is defined as a synonym for unit -> 'a Seq.node. This is a function type: therefore, it is opaque. The consumer can query a sequence in order to request the next element (if there is one), but cannot otherwise inspect the sequence in any way.

    Because it is opaque, the type 'a Seq.t does not reveal whether a sequence is:

    It also does not reveal whether the elements of the sequence are:

    It is up to the programmer to keep these distinctions in mind so as to understand the time and space requirements of sequences.

    For the sake of simplicity, most of the documentation that follows is written under the implicit assumption that the sequences at hand are persistent. We normally do not point out when or how many times each function is invoked, because that would be too verbose. For instance, in the description of map, we write: "if xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ...". If we wished to be more explicit, we could point out that the transformation takes place on demand: that is, the elements of map f xs are computed only when they are demanded. In other words, the definition let ys = map f xs terminates immediately and does not invoke f. The function call f x0 takes place only when the first element of ys is demanded, via the function call ys(). Furthermore, calling ys() twice causes f x0 to be called twice as well. If one wishes for f to be applied at most once to each element of xs, even in scenarios where ys is queried more than once, then one should use let ys = memoize (map f xs).

    As a general rule, the functions that build sequences, such as map, filter, scan, take, etc., produce sequences whose elements are computed only on demand. The functions that eagerly consume sequences, such as is_empty, find, length, iter, fold_left, etc., are the functions that force computation to take place.

    When possible, we recommend using sequences rather than dispensers (functions of type unit -> 'a option that produce elements upon demand). Whereas sequences can be persistent or ephemeral, dispensers are always ephemeral, and are typically more difficult to work with than sequences. Two conversion functions, to_dispenser and of_dispenser, are provided.

    type 'a t = unit -> 'a node

    A sequence xs of type 'a t is a delayed list of elements of type 'a. Such a sequence is queried by performing a function application xs(). This function application returns a node, allowing the caller to determine whether the sequence is empty or nonempty, and in the latter case, to obtain its head and tail.

    and +'a node =
    1. | Nil
    2. | Cons of 'a * 'a t

    A node is either Nil, which means that the sequence is empty, or Cons (x, xs), which means that x is the first element of the sequence and that xs is the remainder of the sequence.

    Consuming sequences

    The functions in this section consume their argument, a sequence, either partially or completely:

    Similarly, among the functions that consume two sequences, one can distinguish two groups:

    The functions that consume two sequences can be applied to two sequences of distinct lengths: in that case, the excess elements in the longer sequence are ignored. (It may be the case that one excess element is demanded, even though this element is not used.)

    None of the functions in this section is lazy. These functions are consumers: they force some computation to take place.

    val is_empty : 'a t -> bool

    is_empty xs determines whether the sequence xs is empty.

    It is recommended that the sequence xs be persistent. Indeed, is_empty xs demands the head of the sequence xs, so, if xs is ephemeral, it may be the case that xs cannot be used any more after this call has taken place.

    • since 4.14
    val uncons : 'a t -> ('a * 'a t) option

    If xs is empty, then uncons xs is None.

    If xs is nonempty, then uncons xs is Some (head xs, tail xs), that is, a pair of the head and tail of the sequence xs.

    This equivalence holds if xs is persistent. If xs is ephemeral, then uncons must be preferred over separate calls to head and tail, which would cause xs to be queried twice.

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

    length xs is the length of the sequence xs.

    The sequence xs must be finite.

    • since 4.14
    val iter : ('a -> unit) -> 'a t -> unit

    iter f xs invokes f x successively for every element x of the sequence xs, from left to right.

    It terminates only if the sequence xs is finite.

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

    fold_left f _ xs invokes f _ x successively for every element x of the sequence xs, from left to right.

    An accumulator of type 'a is threaded through the calls to f.

    It terminates only if the sequence xs is finite.

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

    iteri f xs invokes f i x successively for every element x located at index i in the sequence xs.

    It terminates only if the sequence xs is finite.

    iteri f xs is equivalent to iter (fun (i, x) -> f i x) (zip (ints 0) xs).

    • since 4.14
    val fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b

    fold_lefti f _ xs invokes f _ i x successively for every element x located at index i of the sequence xs.

    An accumulator of type 'b is threaded through the calls to f.

    It terminates only if the sequence xs is finite.

    fold_lefti f accu xs is equivalent to fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs).

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

    for_all p xs determines whether all elements x of the sequence xs satisfy p x.

    The sequence xs must be finite.

    • since 4.14
    val exists : ('a -> bool) -> 'a t -> bool

    exists xs p determines whether at least one element x of the sequence xs satisfies p x.

    The sequence xs must be finite.

    • since 4.14
    val find : ('a -> bool) -> 'a t -> 'a option

    find p xs returns Some x, where x is the first element of the sequence xs that satisfies p x, if there is such an element.

    It returns None if there is no such element.

    The sequence xs must be finite.

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

    find_map f xs returns Some y, where x is the first element of the sequence xs such that f x = Some _, if there is such an element, and where y is defined by f x = Some y.

    It returns None if there is no such element.

    The sequence xs must be finite.

    • since 4.14
    val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit

    iter2 f xs ys invokes f x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

    If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    Iteration terminates only if at least one of the sequences xs and ys is finite.

    iter2 f xs ys is equivalent to iter (fun (x, y) -> f x y) (zip xs ys).

    • since 4.14
    val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b t -> 'c t -> 'a

    fold_left2 f _ xs ys invokes f _ x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

    An accumulator of type 'a is threaded through the calls to f.

    If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    Iteration terminates only if at least one of the sequences xs and ys is finite.

    fold_left2 f accu xs ys is equivalent to fold_left (fun accu (x, y) -> f accu x y) (zip xs ys).

    • since 4.14
    val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

    for_all2 p xs ys determines whether all pairs (x, y) of elements drawn synchronously from the sequences xs and ys satisfy p x y.

    If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. In particular, if xs or ys is empty, then for_all2 p xs ys is true. This is where for_all2 and equal differ: equal eq xs ys can be true only if xs and ys have the same length.

    At least one of the sequences xs and ys must be finite.

    for_all2 p xs ys is equivalent to for_all (fun b -> b) (map2 p xs ys).

    • since 4.14
    val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

    exists2 p xs ys determines whether some pair (x, y) of elements drawn synchronously from the sequences xs and ys satisfies p x y.

    If the sequences xs and ys have different lengths, then iteration must stop as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    At least one of the sequences xs and ys must be finite.

    exists2 p xs ys is equivalent to exists (fun b -> b) (map2 p xs ys).

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

    Provided the function eq defines an equality on elements, equal eq xs ys determines whether the sequences xs and ys are pointwise equal.

    At least one of the sequences xs and ys must be finite.

    • since 4.14
    val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int

    Provided the function cmp defines a preorder on elements, compare cmp xs ys compares the sequences xs and ys according to the lexicographic preorder.

    For more details on comparison functions, see Array.sort.

    At least one of the sequences xs and ys must be finite.

    • since 4.14

    Constructing sequences

    The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

    val empty : 'a t

    empty is the empty sequence. It has no elements. Its length is 0.

    val return : 'a -> 'a t

    return x is the sequence whose sole element is x. Its length is 1.

    val cons : 'a -> 'a t -> 'a t

    cons x xs is the sequence that begins with the element x, followed with the sequence xs.

    Writing cons (f()) xs causes the function call f() to take place immediately. For this call to be delayed until the sequence is queried, one must instead write (fun () -> Cons(f(), xs)).

    • since 4.11
    val init : int -> (int -> 'a) -> 'a t

    init n f is the sequence f 0; f 1; ...; f (n-1).

    n must be nonnegative.

    If desired, the infinite sequence f 0; f 1; ... can be defined as map f (ints 0).

    • raises Invalid_argument

      if n is negative.

    • since 4.14
    val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t

    unfold constructs a sequence out of a step function and an initial state.

    If f u is None then unfold f u is the empty sequence. If f u is Some (x, u') then unfold f u is the nonempty sequence cons x (unfold f u').

    For example, unfold (function [] -> None | h :: t -> Some (h, t)) l is equivalent to List.to_seq l.

    • since 4.11
    val repeat : 'a -> 'a t

    repeat x is the infinite sequence where the element x is repeated indefinitely.

    repeat x is equivalent to cycle (return x).

    • since 4.14
    val forever : (unit -> 'a) -> 'a t

    forever f is an infinite sequence where every element is produced (on demand) by the function call f().

    For instance, forever Random.bool is an infinite sequence of random bits.

    forever f is equivalent to map f (repeat ()).

    • since 4.14
    val cycle : 'a t -> 'a t

    cycle xs is the infinite sequence that consists of an infinite number of repetitions of the sequence xs.

    If xs is an empty sequence, then cycle xs is empty as well.

    Consuming (a prefix of) the sequence cycle xs once can cause the sequence xs to be consumed more than once. Therefore, xs must be persistent.

    • since 4.14
    val iterate : ('a -> 'a) -> 'a -> 'a t

    iterate f x is the infinite sequence whose elements are x, f x, f (f x), and so on.

    In other words, it is the orbit of the function f, starting at x.

    • since 4.14

    Transforming sequences

    The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

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

    map f xs is the image of the sequence xs through the transformation f.

    If xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ....

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

    mapi is analogous to map, but applies the function f to an index and an element.

    mapi f xs is equivalent to map2 f (ints 0) xs.

    • since 4.14
    val filter : ('a -> bool) -> 'a t -> 'a t

    filter p xs is the sequence of the elements x of xs that satisfy p x.

    In other words, filter p xs is the sequence xs, deprived of the elements x such that p x is false.

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

    filter_map f xs is the sequence of the elements y such that f x = Some y, where x ranges over xs.

    filter_map f xs is equivalent to map Option.get (filter Option.is_some (map f xs)).

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

    If xs is a sequence [x0; x1; x2; ...], then scan f a0 xs is a sequence of accumulators [a0; a1; a2; ...] where a1 is f a0 x0, a2 is f a1 x1, and so on.

    Thus, scan f a0 xs is conceptually related to fold_left f a0 xs. However, instead of performing an eager iteration and immediately returning the final accumulator, it returns a sequence of accumulators.

    For instance, scan (+) 0 transforms a sequence of integers into the sequence of its partial sums.

    If xs has length n then scan f a0 xs has length n+1.

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

    take n xs is the sequence of the first n elements of xs.

    If xs has fewer than n elements, then take n xs is equivalent to xs.

    n must be nonnegative.

    • raises Invalid_argument

      if n is negative.

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

    drop n xs is the sequence xs, deprived of its first n elements.

    If xs has fewer than n elements, then drop n xs is empty.

    n must be nonnegative.

    drop is lazy: the first n+1 elements of the sequence xs are demanded only when the first element of drop n xs is demanded. For this reason, drop 1 xs is not equivalent to tail xs, which queries xs immediately.

    • raises Invalid_argument

      if n is negative.

    • since 4.14
    val take_while : ('a -> bool) -> 'a t -> 'a t

    take_while p xs is the longest prefix of the sequence xs where every element x satisfies p x.

    • since 4.14
    val drop_while : ('a -> bool) -> 'a t -> 'a t

    drop_while p xs is the sequence xs, deprived of the prefix take_while p xs.

    • since 4.14
    val group : ('a -> 'a -> bool) -> 'a t -> 'a t t

    Provided the function eq defines an equality on elements, group eq xs is the sequence of the maximal runs of adjacent duplicate elements of the sequence xs.

    Every element of group eq xs is a nonempty sequence of equal elements.

    The concatenation concat (group eq xs) is equal to xs.

    Consuming group eq xs, and consuming the sequences that it contains, can cause xs to be consumed more than once. Therefore, xs must be persistent.

    • since 4.14
    val memoize : 'a t -> 'a t

    The sequence memoize xs has the same elements as the sequence xs.

    Regardless of whether xs is ephemeral or persistent, memoize xs is persistent: even if it is queried several times, xs is queried at most once.

    The construction of the sequence memoize xs internally relies on suspensions provided by the module Lazy. These suspensions are not thread-safe. Therefore, the sequence memoize xs must not be queried by multiple threads concurrently.

    • since 4.14
    exception Forced_twice

    This exception is raised when a sequence returned by once (or a suffix of it) is queried more than once.

    • since 4.14
    val once : 'a t -> 'a t

    The sequence once xs has the same elements as the sequence xs.

    Regardless of whether xs is ephemeral or persistent, once xs is an ephemeral sequence: it can be queried at most once. If it (or a suffix of it) is queried more than once, then the exception Forced_twice is raised. This can be useful, while debugging or testing, to ensure that a sequence is consumed at most once.

    • raises Forced_twice

      if once xs, or a suffix of it, is queried more than once.

    • since 4.14
    val transpose : 'a t t -> 'a t t

    If xss is a matrix (a sequence of rows), then transpose xss is the sequence of the columns of the matrix xss.

    The rows of the matrix xss are not required to have the same length.

    The matrix xss is not required to be finite (in either direction).

    The matrix xss must be persistent.

    • since 4.14

    Combining sequences

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

    append xs ys is the concatenation of the sequences xs and ys.

    Its elements are the elements of xs, followed by the elements of ys.

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

    If xss is a sequence of sequences, then concat xss is its concatenation.

    If xss is the sequence xs0; xs1; ... then concat xss is the sequence xs0 @ xs1 @ ....

    • since 4.13
    val flat_map : ('a -> 'b t) -> 'a t -> 'b t

    flat_map f xs is equivalent to concat (map f xs).

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

    concat_map f xs is equivalent to concat (map f xs).

    concat_map is an alias for flat_map.

    • since 4.13
    val zip : 'a t -> 'b t -> ('a * 'b) t

    zip xs ys is the sequence of pairs (x, y) drawn synchronously from the sequences xs and ys.

    If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    zip xs ys is equivalent to map2 (fun a b -> (a, b)) xs ys.

    • since 4.14
    val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

    map2 f xs ys is the sequence of the elements f x y, where the pairs (x, y) are drawn synchronously from the sequences xs and ys.

    If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    map2 f xs ys is equivalent to map (fun (x, y) -> f x y) (zip xs ys).

    • since 4.14
    val interleave : 'a t -> 'a t -> 'a t

    interleave xs ys is the sequence that begins with the first element of xs, continues with the first element of ys, and so on.

    When one of the sequences xs and ys is exhausted, interleave xs ys continues with the rest of the other sequence.

    • since 4.14
    val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t

    If the sequences xs and ys are sorted according to the total preorder cmp, then sorted_merge cmp xs ys is the sorted sequence obtained by merging the sequences xs and ys.

    For more details on comparison functions, see Array.sort.

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

    product xs ys is the Cartesian product of the sequences xs and ys.

    For every element x of xs and for every element y of ys, the pair (x, y) appears once as an element of product xs ys.

    The order in which the pairs appear is unspecified.

    The sequences xs and ys are not required to be finite.

    The sequences xs and ys must be persistent.

    • since 4.14
    val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

    The sequence map_product f xs ys is the image through f of the Cartesian product of the sequences xs and ys.

    For every element x of xs and for every element y of ys, the element f x y appears once as an element of map_product f xs ys.

    The order in which these elements appear is unspecified.

    The sequences xs and ys are not required to be finite.

    The sequences xs and ys must be persistent.

    map_product f xs ys is equivalent to map (fun (x, y) -> f x y) (product xs ys).

    • since 4.14

    Splitting a sequence into two sequences

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

    unzip transforms a sequence of pairs into a pair of sequences.

    unzip xs is equivalent to (map fst xs, map snd xs).

    Querying either of the sequences returned by unzip xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use unzip (memoize xs).

    • since 4.14
    val split : ('a * 'b) t -> 'a t * 'b t

    split is an alias for unzip.

    • since 4.14
    val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> 'b t * 'c t

    partition_map f xs returns a pair of sequences (ys, zs), where:

    • ys is the sequence of the elements y such that f x = Left y, where x ranges over xs;
    • zs is the sequence of the elements z such that f x = Right z, where x ranges over xs.

    partition_map f xs is equivalent to a pair of filter_map Either.find_left (map f xs) and filter_map Either.find_right (map f xs).

    Querying either of the sequences returned by partition_map f xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use partition_map f (memoize xs).

    • since 4.14
    val partition : ('a -> bool) -> 'a t -> 'a t * 'a t

    partition p xs returns a pair of the subsequence of the elements of xs that satisfy p and the subsequence of the elements of xs that do not satisfy p.

    partition p xs is equivalent to filter p xs, filter (fun x -> not (p x)) xs.

    Consuming both of the sequences returned by partition p xs causes xs to be consumed twice and causes the function f to be applied twice to each element of the list. Therefore, f should be pure and cheap. Furthermore, xs should be persistent and cheap. If that is not the case, use partition p (memoize xs).

    • since 4.14

    Converting between sequences and dispensers

    A dispenser is a representation of a sequence as a function of type unit -> 'a option. Every time this function is invoked, it returns the next element of the sequence. When there are no more elements, it returns None. A dispenser has mutable internal state, therefore is ephemeral: the sequence that it represents can be consumed at most once.

    val of_dispenser : (unit -> 'a option) -> 'a t

    of_dispenser it is the sequence of the elements produced by the dispenser it. It is an ephemeral sequence: it can be consumed at most once. If a persistent sequence is needed, use memoize (of_dispenser it).

    • since 4.14
    val to_dispenser : 'a t -> unit -> 'a option

    to_dispenser xs is a fresh dispenser on the sequence xs.

    This dispenser has mutable internal state, which is not protected by a lock; so, it must not be used by several threads concurrently.

    • since 4.14

    Sequences of integers

    val ints : int -> int t

    ints i is the infinite sequence of the integers beginning at i and counting up.

    • since 4.14
    \ No newline at end of file +Seq (ocaml.Stdlib.Seq)

    Module Stdlib.Seq

    Sequences.

    A sequence of type 'a Seq.t can be thought of as a delayed list, that is, a list whose elements are computed only when they are demanded by a consumer. This allows sequences to be produced and transformed lazily (one element at a time) rather than eagerly (all elements at once). This also allows constructing conceptually infinite sequences.

    The type 'a Seq.t is defined as a synonym for unit -> 'a Seq.node. This is a function type: therefore, it is opaque. The consumer can query a sequence in order to request the next element (if there is one), but cannot otherwise inspect the sequence in any way.

    Because it is opaque, the type 'a Seq.t does not reveal whether a sequence is:

    It also does not reveal whether the elements of the sequence are:

    It is up to the programmer to keep these distinctions in mind so as to understand the time and space requirements of sequences.

    For the sake of simplicity, most of the documentation that follows is written under the implicit assumption that the sequences at hand are persistent. We normally do not point out when or how many times each function is invoked, because that would be too verbose. For instance, in the description of map, we write: "if xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ...". If we wished to be more explicit, we could point out that the transformation takes place on demand: that is, the elements of map f xs are computed only when they are demanded. In other words, the definition let ys = map f xs terminates immediately and does not invoke f. The function call f x0 takes place only when the first element of ys is demanded, via the function call ys(). Furthermore, calling ys() twice causes f x0 to be called twice as well. If one wishes for f to be applied at most once to each element of xs, even in scenarios where ys is queried more than once, then one should use let ys = memoize (map f xs).

    As a general rule, the functions that build sequences, such as map, filter, scan, take, etc., produce sequences whose elements are computed only on demand. The functions that eagerly consume sequences, such as is_empty, find, length, iter, fold_left, etc., are the functions that force computation to take place.

    When possible, we recommend using sequences rather than dispensers (functions of type unit -> 'a option that produce elements upon demand). Whereas sequences can be persistent or ephemeral, dispensers are always ephemeral, and are typically more difficult to work with than sequences. Two conversion functions, to_dispenser and of_dispenser, are provided.

    type 'a t = unit -> 'a node

    A sequence xs of type 'a t is a delayed list of elements of type 'a. Such a sequence is queried by performing a function application xs(). This function application returns a node, allowing the caller to determine whether the sequence is empty or nonempty, and in the latter case, to obtain its head and tail.

    and +'a node =
    1. | Nil
    2. | Cons of 'a * 'a t

    A node is either Nil, which means that the sequence is empty, or Cons (x, xs), which means that x is the first element of the sequence and that xs is the remainder of the sequence.

    Consuming sequences

    The functions in this section consume their argument, a sequence, either partially or completely:

    Similarly, among the functions that consume two sequences, one can distinguish two groups:

    The functions that consume two sequences can be applied to two sequences of distinct lengths: in that case, the excess elements in the longer sequence are ignored. (It may be the case that one excess element is demanded, even though this element is not used.)

    None of the functions in this section is lazy. These functions are consumers: they force some computation to take place.

    val is_empty : 'a t -> bool

    is_empty xs determines whether the sequence xs is empty.

    It is recommended that the sequence xs be persistent. Indeed, is_empty xs demands the head of the sequence xs, so, if xs is ephemeral, it may be the case that xs cannot be used any more after this call has taken place.

    • since 4.14
    val uncons : 'a t -> ('a * 'a t) option

    If xs is empty, then uncons xs is None.

    If xs is nonempty, then uncons xs is Some (x, ys) where x is the head of the sequence and ys its tail.

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

    length xs is the length of the sequence xs.

    The sequence xs must be finite.

    • since 4.14
    val iter : ('a -> unit) -> 'a t -> unit

    iter f xs invokes f x successively for every element x of the sequence xs, from left to right.

    It terminates only if the sequence xs is finite.

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

    fold_left f _ xs invokes f _ x successively for every element x of the sequence xs, from left to right.

    An accumulator of type 'a is threaded through the calls to f.

    It terminates only if the sequence xs is finite.

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

    iteri f xs invokes f i x successively for every element x located at index i in the sequence xs.

    It terminates only if the sequence xs is finite.

    iteri f xs is equivalent to iter (fun (i, x) -> f i x) (zip (ints 0) xs).

    • since 4.14
    val fold_lefti : ('b -> int -> 'a -> 'b) -> 'b -> 'a t -> 'b

    fold_lefti f _ xs invokes f _ i x successively for every element x located at index i of the sequence xs.

    An accumulator of type 'b is threaded through the calls to f.

    It terminates only if the sequence xs is finite.

    fold_lefti f accu xs is equivalent to fold_left (fun accu (i, x) -> f accu i x) accu (zip (ints 0) xs).

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

    for_all p xs determines whether all elements x of the sequence xs satisfy p x.

    The sequence xs must be finite.

    • since 4.14
    val exists : ('a -> bool) -> 'a t -> bool

    exists xs p determines whether at least one element x of the sequence xs satisfies p x.

    The sequence xs must be finite.

    • since 4.14
    val find : ('a -> bool) -> 'a t -> 'a option

    find p xs returns Some x, where x is the first element of the sequence xs that satisfies p x, if there is such an element.

    It returns None if there is no such element.

    The sequence xs must be finite.

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

    find_map f xs returns Some y, where x is the first element of the sequence xs such that f x = Some _, if there is such an element, and where y is defined by f x = Some y.

    It returns None if there is no such element.

    The sequence xs must be finite.

    • since 4.14
    val iter2 : ('a -> 'b -> unit) -> 'a t -> 'b t -> unit

    iter2 f xs ys invokes f x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

    If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    Iteration terminates only if at least one of the sequences xs and ys is finite.

    iter2 f xs ys is equivalent to iter (fun (x, y) -> f x y) (zip xs ys).

    • since 4.14
    val fold_left2 : ('a -> 'b -> 'c -> 'a) -> 'a -> 'b t -> 'c t -> 'a

    fold_left2 f _ xs ys invokes f _ x y successively for every pair (x, y) of elements drawn synchronously from the sequences xs and ys.

    An accumulator of type 'a is threaded through the calls to f.

    If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    Iteration terminates only if at least one of the sequences xs and ys is finite.

    fold_left2 f accu xs ys is equivalent to fold_left (fun accu (x, y) -> f accu x y) (zip xs ys).

    • since 4.14
    val for_all2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

    for_all2 p xs ys determines whether all pairs (x, y) of elements drawn synchronously from the sequences xs and ys satisfy p x y.

    If the sequences xs and ys have different lengths, then iteration stops as soon as one sequence is exhausted; the excess elements in the other sequence are ignored. In particular, if xs or ys is empty, then for_all2 p xs ys is true. This is where for_all2 and equal differ: equal eq xs ys can be true only if xs and ys have the same length.

    At least one of the sequences xs and ys must be finite.

    for_all2 p xs ys is equivalent to for_all (fun b -> b) (map2 p xs ys).

    • since 4.14
    val exists2 : ('a -> 'b -> bool) -> 'a t -> 'b t -> bool

    exists2 p xs ys determines whether some pair (x, y) of elements drawn synchronously from the sequences xs and ys satisfies p x y.

    If the sequences xs and ys have different lengths, then iteration must stop as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    At least one of the sequences xs and ys must be finite.

    exists2 p xs ys is equivalent to exists (fun b -> b) (map2 p xs ys).

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

    Provided the function eq defines an equality on elements, equal eq xs ys determines whether the sequences xs and ys are pointwise equal.

    At least one of the sequences xs and ys must be finite.

    • since 4.14
    val compare : ('a -> 'b -> int) -> 'a t -> 'b t -> int

    Provided the function cmp defines a preorder on elements, compare cmp xs ys compares the sequences xs and ys according to the lexicographic preorder.

    For more details on comparison functions, see Array.sort.

    At least one of the sequences xs and ys must be finite.

    • since 4.14

    Constructing sequences

    The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

    val empty : 'a t

    empty is the empty sequence. It has no elements. Its length is 0.

    val return : 'a -> 'a t

    return x is the sequence whose sole element is x. Its length is 1.

    val cons : 'a -> 'a t -> 'a t

    cons x xs is the sequence that begins with the element x, followed with the sequence xs.

    Writing cons (f()) xs causes the function call f() to take place immediately. For this call to be delayed until the sequence is queried, one must instead write (fun () -> Cons(f(), xs)).

    • since 4.11
    val init : int -> (int -> 'a) -> 'a t

    init n f is the sequence f 0; f 1; ...; f (n-1).

    n must be nonnegative.

    If desired, the infinite sequence f 0; f 1; ... can be defined as map f (ints 0).

    • raises Invalid_argument

      if n is negative.

    • since 4.14
    val unfold : ('b -> ('a * 'b) option) -> 'b -> 'a t

    unfold constructs a sequence out of a step function and an initial state.

    If f u is None then unfold f u is the empty sequence. If f u is Some (x, u') then unfold f u is the nonempty sequence cons x (unfold f u').

    For example, unfold (function [] -> None | h :: t -> Some (h, t)) l is equivalent to List.to_seq l.

    • since 4.11
    val repeat : 'a -> 'a t

    repeat x is the infinite sequence where the element x is repeated indefinitely.

    repeat x is equivalent to cycle (return x).

    • since 4.14
    val forever : (unit -> 'a) -> 'a t

    forever f is an infinite sequence where every element is produced (on demand) by the function call f().

    For instance, forever Random.bool is an infinite sequence of random bits.

    forever f is equivalent to map f (repeat ()).

    • since 4.14
    val cycle : 'a t -> 'a t

    cycle xs is the infinite sequence that consists of an infinite number of repetitions of the sequence xs.

    If xs is an empty sequence, then cycle xs is empty as well.

    Consuming (a prefix of) the sequence cycle xs once can cause the sequence xs to be consumed more than once. Therefore, xs must be persistent.

    • since 4.14
    val iterate : ('a -> 'a) -> 'a -> 'a t

    iterate f x is the infinite sequence whose elements are x, f x, f (f x), and so on.

    In other words, it is the orbit of the function f, starting at x.

    • since 4.14

    Transforming sequences

    The functions in this section are lazy: that is, they return sequences whose elements are computed only when demanded.

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

    map f xs is the image of the sequence xs through the transformation f.

    If xs is the sequence x0; x1; ... then map f xs is the sequence f x0; f x1; ....

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

    mapi is analogous to map, but applies the function f to an index and an element.

    mapi f xs is equivalent to map2 f (ints 0) xs.

    • since 4.14
    val filter : ('a -> bool) -> 'a t -> 'a t

    filter p xs is the sequence of the elements x of xs that satisfy p x.

    In other words, filter p xs is the sequence xs, deprived of the elements x such that p x is false.

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

    filter_map f xs is the sequence of the elements y such that f x = Some y, where x ranges over xs.

    filter_map f xs is equivalent to map Option.get (filter Option.is_some (map f xs)).

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

    If xs is a sequence [x0; x1; x2; ...], then scan f a0 xs is a sequence of accumulators [a0; a1; a2; ...] where a1 is f a0 x0, a2 is f a1 x1, and so on.

    Thus, scan f a0 xs is conceptually related to fold_left f a0 xs. However, instead of performing an eager iteration and immediately returning the final accumulator, it returns a sequence of accumulators.

    For instance, scan (+) 0 transforms a sequence of integers into the sequence of its partial sums.

    If xs has length n then scan f a0 xs has length n+1.

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

    take n xs is the sequence of the first n elements of xs.

    If xs has fewer than n elements, then take n xs is equivalent to xs.

    n must be nonnegative.

    • raises Invalid_argument

      if n is negative.

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

    drop n xs is the sequence xs, deprived of its first n elements.

    If xs has fewer than n elements, then drop n xs is empty.

    n must be nonnegative.

    drop is lazy: the first n+1 elements of the sequence xs are demanded only when the first element of drop n xs is demanded. For this reason, drop 1 xs is not equivalent to tail xs, which queries xs immediately.

    • raises Invalid_argument

      if n is negative.

    • since 4.14
    val take_while : ('a -> bool) -> 'a t -> 'a t

    take_while p xs is the longest prefix of the sequence xs where every element x satisfies p x.

    • since 4.14
    val drop_while : ('a -> bool) -> 'a t -> 'a t

    drop_while p xs is the sequence xs, deprived of the prefix take_while p xs.

    • since 4.14
    val group : ('a -> 'a -> bool) -> 'a t -> 'a t t

    Provided the function eq defines an equality on elements, group eq xs is the sequence of the maximal runs of adjacent duplicate elements of the sequence xs.

    Every element of group eq xs is a nonempty sequence of equal elements.

    The concatenation concat (group eq xs) is equal to xs.

    Consuming group eq xs, and consuming the sequences that it contains, can cause xs to be consumed more than once. Therefore, xs must be persistent.

    • since 4.14
    val memoize : 'a t -> 'a t

    The sequence memoize xs has the same elements as the sequence xs.

    Regardless of whether xs is ephemeral or persistent, memoize xs is persistent: even if it is queried several times, xs is queried at most once.

    The construction of the sequence memoize xs internally relies on suspensions provided by the module Lazy. These suspensions are not thread-safe. Therefore, the sequence memoize xs must not be queried by multiple threads concurrently.

    • since 4.14
    exception Forced_twice

    This exception is raised when a sequence returned by once (or a suffix of it) is queried more than once.

    • since 4.14
    val once : 'a t -> 'a t

    The sequence once xs has the same elements as the sequence xs.

    Regardless of whether xs is ephemeral or persistent, once xs is an ephemeral sequence: it can be queried at most once. If it (or a suffix of it) is queried more than once, then the exception Forced_twice is raised. This can be useful, while debugging or testing, to ensure that a sequence is consumed at most once.

    • raises Forced_twice

      if once xs, or a suffix of it, is queried more than once.

    • since 4.14
    val transpose : 'a t t -> 'a t t

    If xss is a matrix (a sequence of rows), then transpose xss is the sequence of the columns of the matrix xss.

    The rows of the matrix xss are not required to have the same length.

    The matrix xss is not required to be finite (in either direction).

    The matrix xss must be persistent.

    • since 4.14

    Combining sequences

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

    append xs ys is the concatenation of the sequences xs and ys.

    Its elements are the elements of xs, followed by the elements of ys.

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

    If xss is a sequence of sequences, then concat xss is its concatenation.

    If xss is the sequence xs0; xs1; ... then concat xss is the sequence xs0 @ xs1 @ ....

    • since 4.13
    val flat_map : ('a -> 'b t) -> 'a t -> 'b t

    flat_map f xs is equivalent to concat (map f xs).

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

    concat_map f xs is equivalent to concat (map f xs).

    concat_map is an alias for flat_map.

    • since 4.13
    val zip : 'a t -> 'b t -> ('a * 'b) t

    zip xs ys is the sequence of pairs (x, y) drawn synchronously from the sequences xs and ys.

    If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    zip xs ys is equivalent to map2 (fun a b -> (a, b)) xs ys.

    • since 4.14
    val map2 : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

    map2 f xs ys is the sequence of the elements f x y, where the pairs (x, y) are drawn synchronously from the sequences xs and ys.

    If the sequences xs and ys have different lengths, then the sequence ends as soon as one sequence is exhausted; the excess elements in the other sequence are ignored.

    map2 f xs ys is equivalent to map (fun (x, y) -> f x y) (zip xs ys).

    • since 4.14
    val interleave : 'a t -> 'a t -> 'a t

    interleave xs ys is the sequence that begins with the first element of xs, continues with the first element of ys, and so on.

    When one of the sequences xs and ys is exhausted, interleave xs ys continues with the rest of the other sequence.

    • since 4.14
    val sorted_merge : ('a -> 'a -> int) -> 'a t -> 'a t -> 'a t

    If the sequences xs and ys are sorted according to the total preorder cmp, then sorted_merge cmp xs ys is the sorted sequence obtained by merging the sequences xs and ys.

    For more details on comparison functions, see Array.sort.

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

    product xs ys is the Cartesian product of the sequences xs and ys.

    For every element x of xs and for every element y of ys, the pair (x, y) appears once as an element of product xs ys.

    The order in which the pairs appear is unspecified.

    The sequences xs and ys are not required to be finite.

    The sequences xs and ys must be persistent.

    • since 4.14
    val map_product : ('a -> 'b -> 'c) -> 'a t -> 'b t -> 'c t

    The sequence map_product f xs ys is the image through f of the Cartesian product of the sequences xs and ys.

    For every element x of xs and for every element y of ys, the element f x y appears once as an element of map_product f xs ys.

    The order in which these elements appear is unspecified.

    The sequences xs and ys are not required to be finite.

    The sequences xs and ys must be persistent.

    map_product f xs ys is equivalent to map (fun (x, y) -> f x y) (product xs ys).

    • since 4.14

    Splitting a sequence into two sequences

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

    unzip transforms a sequence of pairs into a pair of sequences.

    unzip xs is equivalent to (map fst xs, map snd xs).

    Querying either of the sequences returned by unzip xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use unzip (memoize xs).

    • since 4.14
    val split : ('a * 'b) t -> 'a t * 'b t

    split is an alias for unzip.

    • since 4.14
    val partition_map : ('a -> ('b, 'c) Either.t) -> 'a t -> 'b t * 'c t

    partition_map f xs returns a pair of sequences (ys, zs), where:

    • ys is the sequence of the elements y such that f x = Left y, where x ranges over xs;
    • zs is the sequence of the elements z such that f x = Right z, where x ranges over xs.

    partition_map f xs is equivalent to a pair of filter_map Either.find_left (map f xs) and filter_map Either.find_right (map f xs).

    Querying either of the sequences returned by partition_map f xs causes xs to be queried. Therefore, querying both of them causes xs to be queried twice. Thus, xs must be persistent and cheap. If that is not the case, use partition_map f (memoize xs).

    • since 4.14
    val partition : ('a -> bool) -> 'a t -> 'a t * 'a t

    partition p xs returns a pair of the subsequence of the elements of xs that satisfy p and the subsequence of the elements of xs that do not satisfy p.

    partition p xs is equivalent to filter p xs, filter (fun x -> not (p x)) xs.

    Consuming both of the sequences returned by partition p xs causes xs to be consumed twice and causes the function f to be applied twice to each element of the list. Therefore, f should be pure and cheap. Furthermore, xs should be persistent and cheap. If that is not the case, use partition p (memoize xs).

    • since 4.14

    Converting between sequences and dispensers

    A dispenser is a representation of a sequence as a function of type unit -> 'a option. Every time this function is invoked, it returns the next element of the sequence. When there are no more elements, it returns None. A dispenser has mutable internal state, therefore is ephemeral: the sequence that it represents can be consumed at most once.

    val of_dispenser : (unit -> 'a option) -> 'a t

    of_dispenser it is the sequence of the elements produced by the dispenser it. It is an ephemeral sequence: it can be consumed at most once. If a persistent sequence is needed, use memoize (of_dispenser it).

    • since 4.14
    val to_dispenser : 'a t -> unit -> 'a option

    to_dispenser xs is a fresh dispenser on the sequence xs.

    This dispenser has mutable internal state, which is not protected by a lock; so, it must not be used by several threads concurrently.

    • since 4.14

    Sequences of integers

    val ints : int -> int t

    ints i is the infinite sequence of the integers beginning at i and counting up.

    • since 4.14
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Set/Make/index.html b/dev/ocaml/Stdlib/Set/Make/index.html index 23ad4376..3c5fd913 100644 --- a/dev/ocaml/Stdlib/Set/Make/index.html +++ b/dev/ocaml/Stdlib/Set/Make/index.html @@ -1,3 +1,3 @@ Make (ocaml.Stdlib.Set.Make)

    Module Set.Make

    Functor building an implementation of the set structure given a totally ordered type.

    Parameters

    module Ord : OrderedType

    Signature

    type elt = Ord.t

    The type of the set elements.

    type t

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : (elt -> elt) -> t -> t

    map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Set/module-type-S/index.html b/dev/ocaml/Stdlib/Set/module-type-S/index.html index 2629d895..7d671a76 100644 --- a/dev/ocaml/Stdlib/Set/module-type-S/index.html +++ b/dev/ocaml/Stdlib/Set/module-type-S/index.html @@ -1,3 +1,3 @@ S (ocaml.Stdlib.Set.S)

    Module type Set.S

    Output signature of the functor Make.

    type elt

    The type of the set elements.

    type t

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : (elt -> elt) -> t -> t

    map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Stack/index.html b/dev/ocaml/Stdlib/Stack/index.html index f081c417..610a7962 100644 --- a/dev/ocaml/Stdlib/Stack/index.html +++ b/dev/ocaml/Stdlib/Stack/index.html @@ -1,2 +1,2 @@ -Stack (ocaml.Stdlib.Stack)

    Module Stdlib.Stack

    Last-in first-out stacks.

    This module implements stacks (LIFOs), with in-place modification.

    type !'a t

    The type of stacks containing elements of type 'a.

    exception Empty

    Raised when Stack.pop or Stack.top is applied to an empty stack.

    val create : unit -> 'a t

    Return a new stack, initially empty.

    val push : 'a -> 'a t -> unit

    push x s adds the element x at the top of stack s.

    val pop : 'a t -> 'a

    pop s removes and returns the topmost element in stack s, or raises Empty if the stack is empty.

    val pop_opt : 'a t -> 'a option

    pop_opt s removes and returns the topmost element in stack s, or returns None if the stack is empty.

    • since 4.08
    val top : 'a t -> 'a

    top s returns the topmost element in stack s, or raises Empty if the stack is empty.

    val top_opt : 'a t -> 'a option

    top_opt s returns the topmost element in stack s, or None if the stack is empty.

    • since 4.08
    val clear : 'a t -> unit

    Discard all elements from a stack.

    val copy : 'a t -> 'a t

    Return a copy of the given stack.

    val is_empty : 'a t -> bool

    Return true if the given stack is empty, false otherwise.

    val length : 'a t -> int

    Return the number of elements in a stack. Time complexity O(1)

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

    iter f s applies f in turn to all elements of s, from the element at the top of the stack to the element at the bottom of the stack. The stack itself is unchanged.

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

    fold f accu s is (f (... (f (f accu x1) x2) ...) xn) where x1 is the top of the stack, x2 the second element, and xn the bottom element. The stack is unchanged.

    • since 4.03

    Stacks and Sequences

    val to_seq : 'a t -> 'a Seq.t

    Iterate on the stack, top to bottom. It is safe to modify the stack during iteration.

    • since 4.07
    val add_seq : 'a t -> 'a Seq.t -> unit

    Add the elements from the sequence on the top of the stack.

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

    Create a stack from the sequence.

    • since 4.07
    \ No newline at end of file +Stack (ocaml.Stdlib.Stack)

    Module Stdlib.Stack

    Last-in first-out stacks.

    This module implements stacks (LIFOs), with in-place modification.

    Unsynchronized accesses

    Unsynchronized accesses to a stack may lead to an invalid queue state. Thus, concurrent accesses to stacks must be synchronized (for instance with a Mutex.t).

    type !'a t

    The type of stacks containing elements of type 'a.

    exception Empty

    Raised when Stack.pop or Stack.top is applied to an empty stack.

    val create : unit -> 'a t

    Return a new stack, initially empty.

    val push : 'a -> 'a t -> unit

    push x s adds the element x at the top of stack s.

    val pop : 'a t -> 'a

    pop s removes and returns the topmost element in stack s, or raises Empty if the stack is empty.

    val pop_opt : 'a t -> 'a option

    pop_opt s removes and returns the topmost element in stack s, or returns None if the stack is empty.

    • since 4.08
    val top : 'a t -> 'a

    top s returns the topmost element in stack s, or raises Empty if the stack is empty.

    val top_opt : 'a t -> 'a option

    top_opt s returns the topmost element in stack s, or None if the stack is empty.

    • since 4.08
    val clear : 'a t -> unit

    Discard all elements from a stack.

    val copy : 'a t -> 'a t

    Return a copy of the given stack.

    val is_empty : 'a t -> bool

    Return true if the given stack is empty, false otherwise.

    val length : 'a t -> int

    Return the number of elements in a stack. Time complexity O(1)

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

    iter f s applies f in turn to all elements of s, from the element at the top of the stack to the element at the bottom of the stack. The stack itself is unchanged.

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

    fold f accu s is (f (... (f (f accu x1) x2) ...) xn) where x1 is the top of the stack, x2 the second element, and xn the bottom element. The stack is unchanged.

    • since 4.03

    Stacks and Sequences

    val to_seq : 'a t -> 'a Seq.t

    Iterate on the stack, top to bottom. It is safe to modify the stack during iteration.

    • since 4.07
    val add_seq : 'a t -> 'a Seq.t -> unit

    Add the elements from the sequence on the top of the stack.

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

    Create a stack from the sequence.

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/StdLabels/index.html b/dev/ocaml/Stdlib/StdLabels/index.html index e079741a..6b3efdbb 100644 --- a/dev/ocaml/Stdlib/StdLabels/index.html +++ b/dev/ocaml/Stdlib/StdLabels/index.html @@ -2,5 +2,5 @@ StdLabels (ocaml.Stdlib.StdLabels)

    Module Stdlib.StdLabels

    Standard labeled libraries.

    This meta-module provides versions of the Array, Bytes, List and String modules where function arguments are systematically labeled. It is intended to be opened at the top of source files, as shown below.

    open StdLabels
     
     let to_upper = String.map ~f:Char.uppercase_ascii
    -let seq len = List.init ~f:(function i -> i) ~len
    +let seq len = List.init ~f:(fun i -> i) ~len
     let everything = Array.create_matrix ~dimx:42 ~dimy:42 42
    module Array = ArrayLabels
    module Bytes = BytesLabels
    module List = ListLabels
    module String = StringLabels
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Stream/index.html b/dev/ocaml/Stdlib/Stream/index.html deleted file mode 100644 index 5b9fb511..00000000 --- a/dev/ocaml/Stdlib/Stream/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Stream (ocaml.Stdlib.Stream)

    Module Stdlib.Stream

    Streams and parsers.

    type !'a t

    The type of streams holding values of type 'a.

    exception Failure

    Raised by parsers when none of the first components of the stream patterns is accepted.

    exception Error of string

    Raised by parsers when the first component of a stream pattern is accepted, but one of the following components is rejected.

    Stream builders

    val from : (int -> 'a option) -> 'a t

    Stream.from f returns a stream built from the function f. To create a new stream element, the function f is called with the current stream count. The user function f must return either Some <value> for a value or None to specify the end of the stream.

    Do note that the indices passed to f may not start at 0 in the general case. For example, [< '0; '1; Stream.from f >] would call f the first time with count 2.

    val of_list : 'a list -> 'a t

    Return the stream holding the elements of the list in the same order.

    val of_string : string -> char t

    Return the stream of the characters of the string parameter.

    val of_bytes : bytes -> char t

    Return the stream of the characters of the bytes parameter.

    • since 4.02.0
    val of_channel : in_channel -> char t

    Return the stream of the characters read from the input channel.

    Stream iterator

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

    Stream.iter f s scans the whole stream s, applying function f in turn to each stream element encountered.

    Predefined parsers

    val next : 'a t -> 'a

    Return the first element of the stream and remove it from the stream.

    • raises Stream.Failure

      if the stream is empty.

    val empty : 'a t -> unit

    Return () if the stream is empty, else raise Stream.Failure.

    Useful functions

    val peek : 'a t -> 'a option

    Return Some of "the first element" of the stream, or None if the stream is empty.

    val junk : 'a t -> unit

    Remove the first element of the stream, possibly unfreezing it before.

    val count : 'a t -> int

    Return the current count of the stream elements, i.e. the number of the stream elements discarded.

    val npeek : int -> 'a t -> 'a list

    npeek n returns the list of the n first elements of the stream, or all its remaining elements if less than n elements are available.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/String/index.html b/dev/ocaml/Stdlib/String/index.html index 2cc0f053..e3f435ca 100644 --- a/dev/ocaml/Stdlib/String/index.html +++ b/dev/ocaml/Stdlib/String/index.html @@ -2,5 +2,5 @@ String (ocaml.Stdlib.String)

    Module Stdlib.String

    Strings.

    A string s of length n is an indexable and immutable sequence of n bytes. For historical reasons these bytes are referred to as characters.

    The semantics of string functions is defined in terms of indices and positions. These are depicted and described as follows.

    positions  0   1   2   3   4    n-1    n
                +---+---+---+---+     +-----+
       indices  | 0 | 1 | 2 | 3 | ... | n-1 |
    -           +---+---+---+---+     +-----+

    Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

    Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

    Past mutability. OCaml strings used to be modifiable in place, for instance via the String.set and String.blit functions. This use is nowadays only possible when the compiler is put in "unsafe-string" mode by giving the -unsafe-string command-line option. This compatibility mode makes the types string and bytes (see Bytes.t) interchangeable so that functions expecting byte sequences can also accept strings as arguments and modify them.

    The distinction between bytes and string was introduced in OCaml 4.02, and the "unsafe-string" compatibility mode was the default until OCaml 4.05. Starting with 4.06, the compatibility mode is opt-in; we intend to remove the option in the future.

    The labeled version of this module can be used as described in the StdLabels module.

    Strings

    type t = string

    The type for strings.

    val make : int -> char -> string

    make n c is a string of length n with each index holding the character c.

    val init : int -> (int -> char) -> string

    init n f is a string of length n with index i holding the character f i (called in increasing index order).

    • since 4.02.0
    val empty : string

    The empty string.

    • since 4.13.0
    val of_bytes : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    • since 4.13.0
    val to_bytes : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    • since 4.13.0
    val length : string -> int

    length s is the length (number of bytes/characters) of s.

    val get : string -> int -> char

    get s i is the character at index i in s. This is the same as writing s.[i].

    • raises Invalid_argument

      if i not an index of s.

    Concatenating

    Note. The Stdlib.(^) binary operator concatenates two strings.

    val concat : string -> string list -> string

    concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

    val cat : string -> string -> string

    cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

    • since 4.13.0

    Predicates and comparisons

    val equal : t -> t -> bool

    equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

    • since 4.03.0 (4.05.0 in StringLabels)
    val compare : t -> t -> int

    compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

    val starts_with : prefix:string -> string -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:string -> string -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13.0
    val contains_from : string -> int -> char -> bool

    contains_from s start c is true if and only if c appears in s after position start.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : string -> int -> char -> bool

    rcontains_from s stop c is true if and only if c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val contains : string -> char -> bool

    contains s c is String.contains_from s 0 c.

    Extracting substrings

    val sub : string -> int -> int -> string

    sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val split_on_char : char -> string -> string list

    split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

    The function's result is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) - (split_on_char sep s) = s).
    • No string in the result contains the sep character.
    • since 4.04.0 (4.05.0 in StringLabels)

    Transforming

    val map : (char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00.0
    val mapi : (int -> char -> char) -> string -> string

    mapi f s is like map but the index of the character is also passed to f.

    • since 4.02.0
    val fold_left : ('a -> char -> 'a) -> 'a -> string -> 'a

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13.0
    val fold_right : (char -> 'a -> 'a) -> string -> 'a -> 'a

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13.0
    val for_all : (char -> bool) -> string -> bool

    for_all p s checks if all characters in s satisfy the predicate p.

    • since 4.13.0
    val exists : (char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00.0
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)

    Traversing

    val iter : (char -> unit) -> string -> unit

    iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : (int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00.0

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Seq.t

    to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Deprecated functions

    val create : int -> bytes

    create n returns a fresh byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

    val set : bytes -> int -> char -> unit

    set s n c modifies byte sequence s in place, replacing the byte at index n with c. You can also write s.[n] <- c instead of set s n c.

    • raises Invalid_argument

      if n is not a valid index in s.

    val blit : string -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from the string src, starting at index src_pos, to byte sequence dst, starting at character number dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    val copy : string -> string

    Return a copy of the given string.

    • deprecated

      Because strings are immutable, it doesn't make much sense to make identical copies of them.

    val fill : bytes -> int -> int -> char -> unit

    fill s pos len c modifies byte sequence s in place, replacing len bytes by c, starting at pos.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val uppercase : string -> string

    Return a copy of the argument, with all lowercase letters translated to uppercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val lowercase : string -> string

    Return a copy of the argument, with all uppercase letters translated to lowercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val capitalize : string -> string

    Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set..

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uncapitalize : string -> string

    Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13.0
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13.0
    \ No newline at end of file + +---+---+---+---+ +-----+

    Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

    Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

    Past mutability. Before OCaml 4.02, strings used to be modifiable in place like Bytes.t mutable sequences of bytes. OCaml 4 had various compiler flags and configuration options to support the transition period from mutable to immutable strings. Those options are no longer available, and strings are now always immutable.

    The labeled version of this module can be used as described in the StdLabels module.

    Strings

    type t = string

    The type for strings.

    val make : int -> char -> string

    make n c is a string of length n with each index holding the character c.

    val init : int -> (int -> char) -> string

    init n f is a string of length n with index i holding the character f i (called in increasing index order).

    • since 4.02.0
    val empty : string

    The empty string.

    • since 4.13.0
    val of_bytes : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    • since 4.13.0
    val to_bytes : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    • since 4.13.0
    val length : string -> int

    length s is the length (number of bytes/characters) of s.

    val get : string -> int -> char

    get s i is the character at index i in s. This is the same as writing s.[i].

    • raises Invalid_argument

      if i not an index of s.

    Concatenating

    Note. The Stdlib.(^) binary operator concatenates two strings.

    val concat : string -> string list -> string

    concat sep ss concatenates the list of strings ss, inserting the separator string sep between each.

    val cat : string -> string -> string

    cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

    • since 4.13.0

    Predicates and comparisons

    val equal : t -> t -> bool

    equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

    • since 4.03.0 (4.05.0 in StringLabels)
    val compare : t -> t -> int

    compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

    val starts_with : prefix:string -> string -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:string -> string -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13.0
    val contains_from : string -> int -> char -> bool

    contains_from s start c is true if and only if c appears in s after position start.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : string -> int -> char -> bool

    rcontains_from s stop c is true if and only if c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val contains : string -> char -> bool

    contains s c is String.contains_from s 0 c.

    Extracting substrings

    val sub : string -> int -> int -> string

    sub s pos len is a string of length len, containing the substring of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val split_on_char : char -> string -> string list

    split_on_char sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

    The function's result is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
    • No string in the result contains the sep character.
    • since 4.04.0 (4.05.0 in StringLabels)

    Transforming

    val map : (char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00.0
    val mapi : (int -> char -> char) -> string -> string

    mapi f s is like map but the index of the character is also passed to f.

    • since 4.02.0
    val fold_left : ('a -> char -> 'a) -> 'a -> string -> 'a

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13.0
    val fold_right : (char -> 'a -> 'a) -> string -> 'a -> 'a

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13.0
    val for_all : (char -> bool) -> string -> bool

    for_all p s checks if all characters in s satisfy the predicate p.

    • since 4.13.0
    val exists : (char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00.0
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.03.0 (4.05.0 in StringLabels)

    Traversing

    val iter : (char -> unit) -> string -> unit

    iter f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : (int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00.0

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Seq.t

    to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    val blit : string -> int -> bytes -> int -> int -> unit

    blit src src_pos dst dst_pos len copies len bytes from the string src, starting at index src_pos, to byte sequence dst, starting at character number dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13.0
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val hash : t -> int

    An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

    • since 5.0.0
    val seeded_hash : int -> t -> int

    A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

    • since 5.0.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/StringLabels/index.html b/dev/ocaml/Stdlib/StringLabels/index.html index 9dd52617..ac7d9382 100644 --- a/dev/ocaml/Stdlib/StringLabels/index.html +++ b/dev/ocaml/Stdlib/StringLabels/index.html @@ -2,11 +2,11 @@ StringLabels (ocaml.Stdlib.StringLabels)

    Module Stdlib.StringLabels

    Strings.

    A string s of length n is an indexable and immutable sequence of n bytes. For historical reasons these bytes are referred to as characters.

    The semantics of string functions is defined in terms of indices and positions. These are depicted and described as follows.

    positions  0   1   2   3   4    n-1    n
                +---+---+---+---+     +-----+
       indices  | 0 | 1 | 2 | 3 | ... | n-1 |
    -           +---+---+---+---+     +-----+

    Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

    Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

    Past mutability. OCaml strings used to be modifiable in place, for instance via the String.set and String.blit functions. This use is nowadays only possible when the compiler is put in "unsafe-string" mode by giving the -unsafe-string command-line option. This compatibility mode makes the types string and bytes (see Bytes.t) interchangeable so that functions expecting byte sequences can also accept strings as arguments and modify them.

    The distinction between bytes and string was introduced in OCaml 4.02, and the "unsafe-string" compatibility mode was the default until OCaml 4.05. Starting with 4.06, the compatibility mode is opt-in; we intend to remove the option in the future.

    The labeled version of this module can be used as described in the StdLabels module.

    Strings

    type t = string

    The type for strings.

    val make : int -> char -> string

    make n c is a string of length n with each index holding the character c.

    val init : int -> f:(int -> char) -> string

    init n ~f is a string of length n with index i holding the character f i (called in increasing index order).

    • since 4.02.0
    val empty : string

    The empty string.

    • since 4.13.0
    val of_bytes : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    • since 4.13.0
    val to_bytes : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    • since 4.13.0
    val length : string -> int

    length s is the length (number of bytes/characters) of s.

    val get : string -> int -> char

    get s i is the character at index i in s. This is the same as writing s.[i].

    • raises Invalid_argument

      if i not an index of s.

    Concatenating

    Note. The Stdlib.(^) binary operator concatenates two strings.

    val concat : sep:string -> string list -> string

    concat ~sep ss concatenates the list of strings ss, inserting the separator string sep between each.

    val cat : string -> string -> string

    cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

    • since 4.13.0

    Predicates and comparisons

    val equal : t -> t -> bool

    equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

    • since 4.05.0
    val compare : t -> t -> int

    compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

    val starts_with : prefix:string -> string -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:string -> string -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13.0
    val contains_from : string -> int -> char -> bool

    contains_from s start c is true if and only if c appears in s after position start.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : string -> int -> char -> bool

    rcontains_from s stop c is true if and only if c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val contains : string -> char -> bool

    contains s c is String.contains_from s 0 c.

    Extracting substrings

    val sub : string -> pos:int -> len:int -> string

    sub s ~pos ~len is a string of length len, containing the substring of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val split_on_char : sep:char -> string -> string list

    split_on_char ~sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

    The function's result is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) - (split_on_char sep s) = s).
    • No string in the result contains the sep character.
    • since 4.05.0

    Transforming

    val map : f:(char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00.0
    val mapi : f:(int -> char -> char) -> string -> string

    mapi ~f s is like map but the index of the character is also passed to f.

    • since 4.02.0
    val fold_left : f:('a -> char -> 'a) -> init:'a -> string -> 'a

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13.0
    val fold_right : f:(char -> 'a -> 'a) -> string -> init:'a -> 'a

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13.0
    val for_all : f:(char -> bool) -> string -> bool

    for_all p s checks if all characters in s satisfy the predicate p.

    • since 4.13.0
    val exists : f:(char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00.0
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.05.0
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.05.0

    Traversing

    val iter : f:(char -> unit) -> string -> unit

    iter ~f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : f:(int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00.0

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Seq.t

    to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    Deprecated functions

    val create : int -> bytes

    create n returns a fresh byte sequence of length n. The sequence is uninitialized and contains arbitrary bytes.

    val set : bytes -> int -> char -> unit

    set s n c modifies byte sequence s in place, replacing the byte at index n with c. You can also write s.[n] <- c instead of set s n c.

    • raises Invalid_argument

      if n is not a valid index in s.

    val blit : + +---+---+---+---+ +-----+
    • An index i of s is an integer in the range [0;n-1]. It represents the ith byte (character) of s which can be accessed using the constant time string indexing operator s.[i].
    • A position i of s is an integer in the range [0;n]. It represents either the point at the beginning of the string, or the point between two indices, or the point at the end of the string. The ith byte index is between position i and i+1.

    Two integers start and len are said to define a valid substring of s if len >= 0 and start, start+len are positions of s.

    Unicode text. Strings being arbitrary sequences of bytes, they can hold any kind of textual encoding. However the recommended encoding for storing Unicode text in OCaml strings is UTF-8. This is the encoding used by Unicode escapes in string literals. For example the string "\u{1F42B}" is the UTF-8 encoding of the Unicode character U+1F42B.

    Past mutability. Before OCaml 4.02, strings used to be modifiable in place like Bytes.t mutable sequences of bytes. OCaml 4 had various compiler flags and configuration options to support the transition period from mutable to immutable strings. Those options are no longer available, and strings are now always immutable.

    The labeled version of this module can be used as described in the StdLabels module.

    Strings

    type t = string

    The type for strings.

    val make : int -> char -> string

    make n c is a string of length n with each index holding the character c.

    val init : int -> f:(int -> char) -> string

    init n ~f is a string of length n with index i holding the character f i (called in increasing index order).

    • since 4.02.0
    val empty : string

    The empty string.

    • since 4.13.0
    val of_bytes : bytes -> string

    Return a new string that contains the same bytes as the given byte sequence.

    • since 4.13.0
    val to_bytes : string -> bytes

    Return a new byte sequence that contains the same bytes as the given string.

    • since 4.13.0
    val length : string -> int

    length s is the length (number of bytes/characters) of s.

    val get : string -> int -> char

    get s i is the character at index i in s. This is the same as writing s.[i].

    • raises Invalid_argument

      if i not an index of s.

    Concatenating

    Note. The Stdlib.(^) binary operator concatenates two strings.

    val concat : sep:string -> string list -> string

    concat ~sep ss concatenates the list of strings ss, inserting the separator string sep between each.

    val cat : string -> string -> string

    cat s1 s2 concatenates s1 and s2 (s1 ^ s2).

    • since 4.13.0

    Predicates and comparisons

    val equal : t -> t -> bool

    equal s0 s1 is true if and only if s0 and s1 are character-wise equal.

    • since 4.05.0
    val compare : t -> t -> int

    compare s0 s1 sorts s0 and s1 in lexicographical order. compare behaves like Stdlib.compare on strings but may be more efficient.

    val starts_with : prefix:string -> string -> bool

    starts_with ~prefix s is true if and only if s starts with prefix.

    • since 4.13.0
    val ends_with : suffix:string -> string -> bool

    ends_with ~suffix s is true if and only if s ends with suffix.

    • since 4.13.0
    val contains_from : string -> int -> char -> bool

    contains_from s start c is true if and only if c appears in s after position start.

    • raises Invalid_argument

      if start is not a valid position in s.

    val rcontains_from : string -> int -> char -> bool

    rcontains_from s stop c is true if and only if c appears in s before position stop+1.

    • raises Invalid_argument

      if stop < 0 or stop+1 is not a valid position in s.

    val contains : string -> char -> bool

    contains s c is String.contains_from s 0 c.

    Extracting substrings

    val sub : string -> pos:int -> len:int -> string

    sub s ~pos ~len is a string of length len, containing the substring of s that starts at position pos and has length len.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val split_on_char : sep:char -> string -> string list

    split_on_char ~sep s is the list of all (possibly empty) substrings of s that are delimited by the character sep.

    The function's result is specified by the following invariants:

    • The list is not empty.
    • Concatenating its elements using sep as a separator returns a string equal to the input (concat (make 1 sep) + (split_on_char sep s) = s).
    • No string in the result contains the sep character.
    • since 4.05.0

    Transforming

    val map : f:(char -> char) -> string -> string

    map f s is the string resulting from applying f to all the characters of s in increasing order.

    • since 4.00.0
    val mapi : f:(int -> char -> char) -> string -> string

    mapi ~f s is like map but the index of the character is also passed to f.

    • since 4.02.0
    val fold_left : f:('a -> char -> 'a) -> init:'a -> string -> 'a

    fold_left f x s computes f (... (f (f x s.[0]) s.[1]) ...) s.[n-1], where n is the length of the string s.

    • since 4.13.0
    val fold_right : f:(char -> 'a -> 'a) -> string -> init:'a -> 'a

    fold_right f s x computes f s.[0] (f s.[1] ( ... (f s.[n-1] x) ...)), where n is the length of the string s.

    • since 4.13.0
    val for_all : f:(char -> bool) -> string -> bool

    for_all p s checks if all characters in s satisfy the predicate p.

    • since 4.13.0
    val exists : f:(char -> bool) -> string -> bool

    exists p s checks if at least one character of s satisfies the predicate p.

    • since 4.13.0
    val trim : string -> string

    trim s is s without leading and trailing whitespace. Whitespace characters are: ' ', '\x0C' (form feed), '\n', '\r', and '\t'.

    • since 4.00.0
    val escaped : string -> string

    escaped s is s with special characters represented by escape sequences, following the lexical conventions of OCaml.

    All characters outside the US-ASCII printable range [0x20;0x7E] are escaped, as well as backslash (0x2F) and double-quote (0x22).

    The function Scanf.unescaped is a left inverse of escaped, i.e. Scanf.unescaped (escaped s) = s for any string s (unless escaped s fails).

    val uppercase_ascii : string -> string

    uppercase_ascii s is s with all lowercase letters translated to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val lowercase_ascii : string -> string

    lowercase_ascii s is s with all uppercase letters translated to lowercase, using the US-ASCII character set.

    • since 4.05.0
    val capitalize_ascii : string -> string

    capitalize_ascii s is s with the first character set to uppercase, using the US-ASCII character set.

    • since 4.05.0
    val uncapitalize_ascii : string -> string

    uncapitalize_ascii s is s with the first character set to lowercase, using the US-ASCII character set.

    • since 4.05.0

    Traversing

    val iter : f:(char -> unit) -> string -> unit

    iter ~f s applies function f in turn to all the characters of s. It is equivalent to f s.[0]; f s.[1]; ...; f s.[length s - 1]; ().

    val iteri : f:(int -> char -> unit) -> string -> unit

    iteri is like iter, but the function is also given the corresponding character index.

    • since 4.00.0

    Searching

    val index_from : string -> int -> char -> int

    index_from s i c is the index of the first occurrence of c in s after position i.

    • raises Not_found

      if c does not occur in s after position i.

    • raises Invalid_argument

      if i is not a valid position in s.

    val index_from_opt : string -> int -> char -> int option

    index_from_opt s i c is the index of the first occurrence of c in s after position i (if any).

    • raises Invalid_argument

      if i is not a valid position in s.

    • since 4.05
    val rindex_from : string -> int -> char -> int

    rindex_from s i c is the index of the last occurrence of c in s before position i+1.

    • raises Not_found

      if c does not occur in s before position i+1.

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    val rindex_from_opt : string -> int -> char -> int option

    rindex_from_opt s i c is the index of the last occurrence of c in s before position i+1 (if any).

    • raises Invalid_argument

      if i+1 is not a valid position in s.

    • since 4.05
    val index : string -> char -> int

    index s c is String.index_from s 0 c.

    val index_opt : string -> char -> int option

    index_opt s c is String.index_from_opt s 0 c.

    • since 4.05
    val rindex : string -> char -> int

    rindex s c is String.rindex_from s (length s - 1) c.

    val rindex_opt : string -> char -> int option

    rindex_opt s c is String.rindex_from_opt s (length s - 1) c.

    • since 4.05

    Strings and Sequences

    val to_seq : t -> char Seq.t

    to_seq s is a sequence made of the string's characters in increasing order. In "unsafe-string" mode, modifications of the string during iteration will be reflected in the sequence.

    • since 4.07
    val to_seqi : t -> (int * char) Seq.t

    to_seqi s is like to_seq but also tuples the corresponding index.

    • since 4.07
    val of_seq : char Seq.t -> t

    of_seq s is a string made of the sequence's characters.

    • since 4.07

    UTF decoding and validations

    • since 4.14

    UTF-8

    val get_utf_8_uchar : t -> int -> Uchar.utf_decode

    get_utf_8_uchar b i decodes an UTF-8 character at index i in b.

    val is_valid_utf_8 : t -> bool

    is_valid_utf_8 b is true if and only if b contains valid UTF-8 data.

    UTF-16BE

    val get_utf_16be_uchar : t -> int -> Uchar.utf_decode

    get_utf_16be_uchar b i decodes an UTF-16BE character at index i in b.

    val is_valid_utf_16be : t -> bool

    is_valid_utf_16be b is true if and only if b contains valid UTF-16BE data.

    UTF-16LE

    val get_utf_16le_uchar : t -> int -> Uchar.utf_decode

    get_utf_16le_uchar b i decodes an UTF-16LE character at index i in b.

    val is_valid_utf_16le : t -> bool

    is_valid_utf_16le b is true if and only if b contains valid UTF-16LE data.

    val blit : src:string -> src_pos:int -> dst:bytes -> dst_pos:int -> len:int -> - unit

    blit ~src ~src_pos ~dst ~dst_pos ~len copies len bytes from the string src, starting at index src_pos, to byte sequence dst, starting at character number dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    val copy : string -> string

    Return a copy of the given string.

    • deprecated

      Because strings are immutable, it doesn't make much sense to make identical copies of them.

    val fill : bytes -> pos:int -> len:int -> char -> unit

    fill s ~pos ~len c modifies byte sequence s in place, replacing len bytes by c, starting at pos.

    • raises Invalid_argument

      if pos and len do not designate a valid substring of s.

    val uppercase : string -> string

    Return a copy of the argument, with all lowercase letters translated to uppercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val lowercase : string -> string

    Return a copy of the argument, with all uppercase letters translated to lowercase, including accented letters of the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val capitalize : string -> string

    Return a copy of the argument, with the first character set to uppercase, using the ISO Latin-1 (8859-1) character set..

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    val uncapitalize : string -> string

    Return a copy of the argument, with the first character set to lowercase, using the ISO Latin-1 (8859-1) character set.

    • deprecated

      Functions operating on Latin-1 character set are deprecated.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13.0
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13.0
    \ No newline at end of file + unit

    blit ~src ~src_pos ~dst ~dst_pos ~len copies len bytes from the string src, starting at index src_pos, to byte sequence dst, starting at character number dst_pos.

    • raises Invalid_argument

      if src_pos and len do not designate a valid range of src, or if dst_pos and len do not designate a valid range of dst.

    Binary decoding of integers

    The functions in this section binary decode integers from strings.

    All following functions raise Invalid_argument if the characters needed at index i to decode the integer are not available.

    Little-endian (resp. big-endian) encoding means that least (resp. most) significant bytes are stored first. Big-endian is also known as network byte order. Native-endian encoding is either little-endian or big-endian depending on Sys.big_endian.

    32-bit and 64-bit integers are represented by the int32 and int64 types, which can be interpreted either as signed or unsigned numbers.

    8-bit and 16-bit integers are represented by the int type, which has more bits than the binary encoding. These extra bits are sign-extended (or zero-extended) for functions which decode 8-bit or 16-bit integers and represented them with int values.

    val get_uint8 : string -> int -> int

    get_uint8 b i is b's unsigned 8-bit integer starting at character index i.

    • since 4.13.0
    val get_int8 : string -> int -> int

    get_int8 b i is b's signed 8-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_ne : string -> int -> int

    get_uint16_ne b i is b's native-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_be : string -> int -> int

    get_uint16_be b i is b's big-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_uint16_le : string -> int -> int

    get_uint16_le b i is b's little-endian unsigned 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_ne : string -> int -> int

    get_int16_ne b i is b's native-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_be : string -> int -> int

    get_int16_be b i is b's big-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int16_le : string -> int -> int

    get_int16_le b i is b's little-endian signed 16-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_ne : string -> int -> int32

    get_int32_ne b i is b's native-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val hash : t -> int

    An unseeded hash function for strings, with the same output value as Hashtbl.hash. This function allows this module to be passed as argument to the functor Hashtbl.Make.

    • since 5.0.0
    val seeded_hash : int -> t -> int

    A seeded hash function for strings, with the same output value as Hashtbl.seeded_hash. This function allows this module to be passed as argument to the functor Hashtbl.MakeSeeded.

    • since 5.0.0
    val get_int32_be : string -> int -> int32

    get_int32_be b i is b's big-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int32_le : string -> int -> int32

    get_int32_le b i is b's little-endian 32-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_ne : string -> int -> int64

    get_int64_ne b i is b's native-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_be : string -> int -> int64

    get_int64_be b i is b's big-endian 64-bit integer starting at character index i.

    • since 4.13.0
    val get_int64_le : string -> int -> int64

    get_int64_le b i is b's little-endian 64-bit integer starting at character index i.

    • since 4.13.0
    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Sys/index.html b/dev/ocaml/Stdlib/Sys/index.html index b2b6dfac..6ee831ff 100644 --- a/dev/ocaml/Stdlib/Sys/index.html +++ b/dev/ocaml/Stdlib/Sys/index.html @@ -1,4 +1,4 @@ -Sys (ocaml.Stdlib.Sys)

    Module Stdlib.Sys

    System interface.

    Every function in this module raises Sys_error with an informative message when the underlying system call signal an error.

    val argv : string array

    The command line arguments given to the process. The first element is the command name used to invoke the program. The following elements are the command-line arguments given to the program.

    val executable_name : string

    The name of the file containing the executable currently running. This name may be absolute or relative to the current directory, depending on the platform and whether the program was compiled to bytecode or a native executable.

    val file_exists : string -> bool

    Test if a file with the given name exists.

    val is_directory : string -> bool

    Returns true if the given name refers to a directory, false if it refers to another kind of file.

    • raises Sys_error

      if no file exists with the given name.

    • since 3.10.0
    val remove : string -> unit

    Remove the given file name from the file system.

    val rename : string -> string -> unit

    Rename a file. rename oldpath newpath renames the file called oldpath, giving it newpath as its new name, moving it between directories if needed. If newpath already exists, its contents will be replaced with those of oldpath. Depending on the operating system, the metadata (permissions, owner, etc) of newpath can either be preserved or be replaced by those of oldpath.

    • since 4.06 concerning the "replace existing file" behavior
    val getenv : string -> string

    Return the value associated to a variable in the process environment.

    • raises Not_found

      if the variable is unbound.

    val getenv_opt : string -> string option

    Return the value associated to a variable in the process environment or None if the variable is unbound.

    • since 4.05
    val command : string -> int

    Execute the given shell command and return its exit code.

    The argument of Sys.command is generally the name of a command followed by zero, one or several arguments, separated by whitespace. The given argument is interpreted by a shell: either the Windows shell cmd.exe for the Win32 ports of OCaml, or the POSIX shell sh for other ports. It can contain shell builtin commands such as echo, and also special characters such as file redirections > and <, which will be honored by the shell.

    Conversely, whitespace or special shell characters occurring in command names or in their arguments must be quoted or escaped so that the shell does not interpret them. The quoting rules vary between the POSIX shell and the Windows shell. The Filename.quote_command performs the appropriate quoting given a command name, a list of arguments, and optional file redirections.

    val time : unit -> float

    Return the processor time, in seconds, used by the program since the beginning of execution.

    val chdir : string -> unit

    Change the current working directory of the process.

    val mkdir : string -> int -> unit

    Create a directory with the given permissions.

    • since 4.12.0
    val rmdir : string -> unit

    Remove an empty directory.

    • since 4.12.0
    val getcwd : unit -> string

    Return the current working directory of the process.

    val readdir : string -> string array

    Return the names of all files present in the given directory. Names denoting the current directory and the parent directory ("." and ".." in Unix) are not returned. Each string in the result is a file name rather than a complete path. There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

    val interactive : bool ref

    This reference is initially set to false in standalone programs and to true if the code is being executed under the interactive toplevel system ocaml.

    val os_type : string

    Operating system currently executing the OCaml program. One of

    • "Unix" (for all Unix versions, including Linux and Mac OS X),
    • "Win32" (for MS-Windows, OCaml compiled with MSVC++ or Mingw),
    • "Cygwin" (for MS-Windows, OCaml compiled with Cygwin).
    type backend_type =
    1. | Native
    2. | Bytecode
    3. | Other of string

    Currently, the official distribution only supports Native and Bytecode, but it can be other backends with alternative compilers, for example, javascript.

    • since 4.04.0
    val backend_type : backend_type

    Backend type currently executing the OCaml program.

    • since 4.04.0
    val unix : bool

    True if Sys.os_type = "Unix".

    • since 4.01.0
    val win32 : bool

    True if Sys.os_type = "Win32".

    • since 4.01.0
    val cygwin : bool

    True if Sys.os_type = "Cygwin".

    • since 4.01.0
    val word_size : int

    Size of one word on the machine currently executing the OCaml program, in bits: 32 or 64.

    val int_size : int

    Size of int, in bits. It is 31 (resp. 63) when using OCaml on a 32-bit (resp. 64-bit) platform. It may differ for other implementations, e.g. it can be 32 bits when compiling to JavaScript.

    • since 4.03.0
    val big_endian : bool

    Whether the machine currently executing the Caml program is big-endian.

    • since 4.00.0
    val max_string_length : int

    Maximum length of strings and byte sequences.

    val max_array_length : int

    Maximum length of a normal array (i.e. any array whose elements are not of type float). The maximum length of a float array is max_floatarray_length if OCaml was configured with --enable-flat-float-array and max_array_length if configured with --disable-flat-float-array.

    val max_floatarray_length : int

    Maximum length of a floatarray. This is also the maximum length of a float array when OCaml is configured with --enable-flat-float-array.

    val runtime_variant : unit -> string

    Return the name of the runtime variant the program is running on. This is normally the argument given to -runtime-variant at compile time, but for byte-code it can be changed after compilation.

    • since 4.03.0
    val runtime_parameters : unit -> string

    Return the value of the runtime parameters, in the same format as the contents of the OCAMLRUNPARAM environment variable.

    • since 4.03.0

    Signal handling

    type signal_behavior =
    1. | Signal_default
    2. | Signal_ignore
    3. | Signal_handle of int -> unit

    What to do when receiving a signal:

    • Signal_default: take the default behavior (usually: abort the program)
    • Signal_ignore: ignore the signal
    • Signal_handle f: call function f, giving it the signal number as argument.
    val signal : int -> signal_behavior -> signal_behavior

    Set the behavior of the system on receipt of a given signal. The first argument is the signal number. Return the behavior previously associated with the signal. If the signal number is invalid (or not available on your system), an Invalid_argument exception is raised.

    val set_signal : int -> signal_behavior -> unit

    Same as Sys.signal but return value is ignored.

    Signal numbers for the standard POSIX signals.

    val sigabrt : int

    Abnormal termination

    val sigalrm : int

    Timeout

    val sigfpe : int

    Arithmetic exception

    val sighup : int

    Hangup on controlling terminal

    val sigill : int

    Invalid hardware instruction

    val sigint : int

    Interactive interrupt (ctrl-C)

    val sigkill : int

    Termination (cannot be ignored)

    val sigpipe : int

    Broken pipe

    val sigquit : int

    Interactive termination

    val sigsegv : int

    Invalid memory reference

    val sigterm : int

    Termination

    val sigusr1 : int

    Application-defined signal 1

    val sigusr2 : int

    Application-defined signal 2

    val sigchld : int

    Child process terminated

    val sigcont : int

    Continue

    val sigstop : int

    Stop

    val sigtstp : int

    Interactive stop

    val sigttin : int

    Terminal read from background process

    val sigttou : int

    Terminal write from background process

    val sigvtalrm : int

    Timeout in virtual time

    val sigprof : int

    Profiling interrupt

    val sigbus : int

    Bus error

    • since 4.03
    val sigpoll : int

    Pollable event

    • since 4.03
    val sigsys : int

    Bad argument to routine

    • since 4.03
    val sigtrap : int

    Trace/breakpoint trap

    • since 4.03
    val sigurg : int

    Urgent condition on socket

    • since 4.03
    val sigxcpu : int

    Timeout in cpu time

    • since 4.03
    val sigxfsz : int

    File size limit exceeded

    • since 4.03
    exception Break

    Exception raised on interactive interrupt if Sys.catch_break is on.

    val catch_break : bool -> unit

    catch_break governs whether interactive interrupt (ctrl-C) terminates the program or raises the Break exception. Call catch_break true to enable raising Break, and catch_break false to let the system terminate the program on user interrupt.

    val ocaml_version : string

    ocaml_version is the version of OCaml. It is a string of the form "major.minor[.patchlevel][(+|~)additional-info]", where major, minor, and patchlevel are integers, and additional-info is an arbitrary string. The [.patchlevel] part was absent before version 3.08.0 and became mandatory from 3.08.0 onwards. The [(+|~)additional-info] part may be absent.

    val development_version : bool

    true if this is a development version, false otherwise.

    • since 4.14.0
    type extra_prefix =
    1. | Plus
    2. | Tilde
    type extra_info = extra_prefix * string
    type ocaml_release_info = {
    1. major : int;
    2. minor : int;
    3. patchlevel : int;
    4. extra : extra_info option;
    }
    val ocaml_release : ocaml_release_info
    val enable_runtime_warnings : bool -> unit

    Control whether the OCaml runtime system can emit warnings on stderr. Currently, the only supported warning is triggered when a channel created by open_* functions is finalized without being closed. Runtime warnings are disabled by default.

    • since 4.03.0
    val runtime_warnings_enabled : unit -> bool

    Return whether runtime warnings are currently enabled.

    • since 4.03.0

    Optimization

    val opaque_identity : 'a -> 'a

    For the purposes of optimization, opaque_identity behaves like an unknown (and thus possibly side-effecting) function.

    At runtime, opaque_identity disappears altogether.

    A typical use of this function is to prevent pure computations from being optimized away in benchmarking loops. For example:

    for _round = 1 to 100_000 do
    +Sys (ocaml.Stdlib.Sys)

    Module Stdlib.Sys

    System interface.

    Every function in this module raises Sys_error with an informative message when the underlying system call signal an error.

    val argv : string array

    The command line arguments given to the process. The first element is the command name used to invoke the program. The following elements are the command-line arguments given to the program.

    val executable_name : string

    The name of the file containing the executable currently running. This name may be absolute or relative to the current directory, depending on the platform and whether the program was compiled to bytecode or a native executable.

    val file_exists : string -> bool

    Test if a file with the given name exists.

    val is_directory : string -> bool

    Returns true if the given name refers to a directory, false if it refers to another kind of file.

    • raises Sys_error

      if no file exists with the given name.

    • since 3.10.0
    val remove : string -> unit

    Remove the given file name from the file system.

    val rename : string -> string -> unit

    Rename a file. rename oldpath newpath renames the file called oldpath, giving it newpath as its new name, moving it between directories if needed. If newpath already exists, its contents will be replaced with those of oldpath. Depending on the operating system, the metadata (permissions, owner, etc) of newpath can either be preserved or be replaced by those of oldpath.

    • since 4.06 concerning the "replace existing file" behavior
    val getenv : string -> string

    Return the value associated to a variable in the process environment.

    • raises Not_found

      if the variable is unbound.

    val getenv_opt : string -> string option

    Return the value associated to a variable in the process environment or None if the variable is unbound.

    • since 4.05
    val command : string -> int

    Execute the given shell command and return its exit code.

    The argument of Sys.command is generally the name of a command followed by zero, one or several arguments, separated by whitespace. The given argument is interpreted by a shell: either the Windows shell cmd.exe for the Win32 ports of OCaml, or the POSIX shell sh for other ports. It can contain shell builtin commands such as echo, and also special characters such as file redirections > and <, which will be honored by the shell.

    Conversely, whitespace or special shell characters occurring in command names or in their arguments must be quoted or escaped so that the shell does not interpret them. The quoting rules vary between the POSIX shell and the Windows shell. The Filename.quote_command performs the appropriate quoting given a command name, a list of arguments, and optional file redirections.

    val time : unit -> float

    Return the processor time, in seconds, used by the program since the beginning of execution.

    val chdir : string -> unit

    Change the current working directory of the process.

    val mkdir : string -> int -> unit

    Create a directory with the given permissions.

    • since 4.12.0
    val rmdir : string -> unit

    Remove an empty directory.

    • since 4.12.0
    val getcwd : unit -> string

    Return the current working directory of the process.

    val readdir : string -> string array

    Return the names of all files present in the given directory. Names denoting the current directory and the parent directory ("." and ".." in Unix) are not returned. Each string in the result is a file name rather than a complete path. There is no guarantee that the name strings in the resulting array will appear in any specific order; they are not, in particular, guaranteed to appear in alphabetical order.

    val interactive : bool ref

    This reference is initially set to false in standalone programs and to true if the code is being executed under the interactive toplevel system ocaml.

    • alert unsynchronized_access The interactive status is a mutable global state.
    val os_type : string

    Operating system currently executing the OCaml program. One of

    • "Unix" (for all Unix versions, including Linux and Mac OS X),
    • "Win32" (for MS-Windows, OCaml compiled with MSVC++ or Mingw),
    • "Cygwin" (for MS-Windows, OCaml compiled with Cygwin).
    type backend_type =
    1. | Native
    2. | Bytecode
    3. | Other of string

    Currently, the official distribution only supports Native and Bytecode, but it can be other backends with alternative compilers, for example, javascript.

    • since 4.04.0
    val backend_type : backend_type

    Backend type currently executing the OCaml program.

    • since 4.04.0
    val unix : bool

    True if Sys.os_type = "Unix".

    • since 4.01.0
    val win32 : bool

    True if Sys.os_type = "Win32".

    • since 4.01.0
    val cygwin : bool

    True if Sys.os_type = "Cygwin".

    • since 4.01.0
    val word_size : int

    Size of one word on the machine currently executing the OCaml program, in bits: 32 or 64.

    val int_size : int

    Size of int, in bits. It is 31 (resp. 63) when using OCaml on a 32-bit (resp. 64-bit) platform. It may differ for other implementations, e.g. it can be 32 bits when compiling to JavaScript.

    • since 4.03.0
    val big_endian : bool

    Whether the machine currently executing the Caml program is big-endian.

    • since 4.00.0
    val max_string_length : int

    Maximum length of strings and byte sequences.

    val max_array_length : int

    Maximum length of a normal array (i.e. any array whose elements are not of type float). The maximum length of a float array is max_floatarray_length if OCaml was configured with --enable-flat-float-array and max_array_length if configured with --disable-flat-float-array.

    val max_floatarray_length : int

    Maximum length of a floatarray. This is also the maximum length of a float array when OCaml is configured with --enable-flat-float-array.

    val runtime_variant : unit -> string

    Return the name of the runtime variant the program is running on. This is normally the argument given to -runtime-variant at compile time, but for byte-code it can be changed after compilation.

    • since 4.03.0
    val runtime_parameters : unit -> string

    Return the value of the runtime parameters, in the same format as the contents of the OCAMLRUNPARAM environment variable.

    • since 4.03.0

    Signal handling

    type signal_behavior =
    1. | Signal_default
    2. | Signal_ignore
    3. | Signal_handle of int -> unit

    What to do when receiving a signal:

    • Signal_default: take the default behavior (usually: abort the program)
    • Signal_ignore: ignore the signal
    • Signal_handle f: call function f, giving it the signal number as argument.
    val signal : int -> signal_behavior -> signal_behavior

    Set the behavior of the system on receipt of a given signal. The first argument is the signal number. Return the behavior previously associated with the signal. If the signal number is invalid (or not available on your system), an Invalid_argument exception is raised.

    val set_signal : int -> signal_behavior -> unit

    Same as Sys.signal but return value is ignored.

    Signal numbers for the standard POSIX signals.

    val sigabrt : int

    Abnormal termination

    val sigalrm : int

    Timeout

    val sigfpe : int

    Arithmetic exception

    val sighup : int

    Hangup on controlling terminal

    val sigill : int

    Invalid hardware instruction

    val sigint : int

    Interactive interrupt (ctrl-C)

    val sigkill : int

    Termination (cannot be ignored)

    val sigpipe : int

    Broken pipe

    val sigquit : int

    Interactive termination

    val sigsegv : int

    Invalid memory reference

    val sigterm : int

    Termination

    val sigusr1 : int

    Application-defined signal 1

    val sigusr2 : int

    Application-defined signal 2

    val sigchld : int

    Child process terminated

    val sigcont : int

    Continue

    val sigstop : int

    Stop

    val sigtstp : int

    Interactive stop

    val sigttin : int

    Terminal read from background process

    val sigttou : int

    Terminal write from background process

    val sigvtalrm : int

    Timeout in virtual time

    val sigprof : int

    Profiling interrupt

    val sigbus : int

    Bus error

    • since 4.03
    val sigpoll : int

    Pollable event

    • since 4.03
    val sigsys : int

    Bad argument to routine

    • since 4.03
    val sigtrap : int

    Trace/breakpoint trap

    • since 4.03
    val sigurg : int

    Urgent condition on socket

    • since 4.03
    val sigxcpu : int

    Timeout in cpu time

    • since 4.03
    val sigxfsz : int

    File size limit exceeded

    • since 4.03
    exception Break

    Exception raised on interactive interrupt if Sys.catch_break is on.

    val catch_break : bool -> unit

    catch_break governs whether interactive interrupt (ctrl-C) terminates the program or raises the Break exception. Call catch_break true to enable raising Break, and catch_break false to let the system terminate the program on user interrupt.

    val ocaml_version : string

    ocaml_version is the version of OCaml. It is a string of the form "major.minor[.patchlevel][(+|~)additional-info]", where major, minor, and patchlevel are integers, and additional-info is an arbitrary string. The [.patchlevel] part was absent before version 3.08.0 and became mandatory from 3.08.0 onwards. The [(+|~)additional-info] part may be absent.

    val development_version : bool

    true if this is a development version, false otherwise.

    • since 4.14.0
    type extra_prefix =
    1. | Plus
    2. | Tilde
      (*
      • since 4.14
      *)
    type extra_info = extra_prefix * string
    • since 4.14
    type ocaml_release_info = {
    1. major : int;
    2. minor : int;
    3. patchlevel : int;
    4. extra : extra_info option;
    }
    • since 4.14
    val ocaml_release : ocaml_release_info

    ocaml_release is the version of OCaml.

    • since 4.14
    val enable_runtime_warnings : bool -> unit

    Control whether the OCaml runtime system can emit warnings on stderr. Currently, the only supported warning is triggered when a channel created by open_* functions is finalized without being closed. Runtime warnings are disabled by default.

    • since 4.03.0
    • alert unsynchronized_access The status of runtime warnings is a mutable global state.
    val runtime_warnings_enabled : unit -> bool

    Return whether runtime warnings are currently enabled.

    • since 4.03.0
    • alert unsynchronized_access The status of runtime warnings is a mutable global state.

    Optimization

    val opaque_identity : 'a -> 'a

    For the purposes of optimization, opaque_identity behaves like an unknown (and thus possibly side-effecting) function.

    At runtime, opaque_identity disappears altogether.

    A typical use of this function is to prevent pure computations from being optimized away in benchmarking loops. For example:

    for _round = 1 to 100_000 do
       ignore (Sys.opaque_identity (my_pure_computation ()))
     done
    • since 4.03.0
    module Immediate64 : sig ... end

    This module allows to define a type t with the immediate64 attribute. This attribute means that the type is immediate on 64 bit architectures. On other architectures, it might or might not be immediate.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/Weak/index.html b/dev/ocaml/Stdlib/Weak/index.html index c7f9dccb..481ed6a0 100644 --- a/dev/ocaml/Stdlib/Weak/index.html +++ b/dev/ocaml/Stdlib/Weak/index.html @@ -1,2 +1,2 @@ -Weak (ocaml.Stdlib.Weak)

    Module Stdlib.Weak

    Arrays of weak pointers and hash sets of weak pointers.

    Low-level functions

    type !'a t

    The type of arrays of weak pointers (weak arrays). A weak pointer is a value that the garbage collector may erase whenever the value is not used any more (through normal pointers) by the program. Note that finalisation functions are run before the weak pointers are erased, because the finalisation functions can make values alive again (before 4.03 the finalisation functions were run after).

    A weak pointer is said to be full if it points to a value, empty if the value was erased by the GC.

    Notes:

    • Integers are not allocated and cannot be stored in weak arrays.
    • Weak arrays cannot be marshaled using Stdlib.output_value nor the functions of the Marshal module.
    val create : int -> 'a t

    Weak.create n returns a new weak array of length n. All the pointers are initially empty.

    val length : 'a t -> int

    Weak.length ar returns the length (number of elements) of ar.

    val set : 'a t -> int -> 'a option -> unit

    Weak.set ar n (Some el) sets the nth cell of ar to be a (full) pointer to el; Weak.set ar n None sets the nth cell of ar to empty.

    • raises Invalid_argument

      if n is not in the range 0 to Weak.length a - 1.

    val get : 'a t -> int -> 'a option

    Weak.get ar n returns None if the nth cell of ar is empty, Some x (where x is the value) if it is full.

    • raises Invalid_argument

      if n is not in the range 0 to Weak.length a - 1.

    val get_copy : 'a t -> int -> 'a option

    Weak.get_copy ar n returns None if the nth cell of ar is empty, Some x (where x is a (shallow) copy of the value) if it is full. In addition to pitfalls with mutable values, the interesting difference with get is that get_copy does not prevent the incremental GC from erasing the value in its current cycle (get may delay the erasure to the next GC cycle).

    • raises Invalid_argument

      if n is not in the range 0 to Weak.length a - 1.

      If the element is a custom block it is not copied.

    val check : 'a t -> int -> bool

    Weak.check ar n returns true if the nth cell of ar is full, false if it is empty. Note that even if Weak.check ar n returns true, a subsequent Weak.get ar n can return None.

    val fill : 'a t -> int -> int -> 'a option -> unit

    Weak.fill ar ofs len el sets to el all pointers of ar from ofs to ofs + len - 1.

    • raises Invalid_argument

      if ofs and len do not designate a valid subarray of a.

    val blit : 'a t -> int -> 'a t -> int -> int -> unit

    Weak.blit ar1 off1 ar2 off2 len copies len weak pointers from ar1 (starting at off1) to ar2 (starting at off2). It works correctly even if ar1 and ar2 are the same.

    • raises Invalid_argument

      if off1 and len do not designate a valid subarray of ar1, or if off2 and len do not designate a valid subarray of ar2.

    Weak hash sets

    A weak hash set is a hashed set of values. Each value may magically disappear from the set when it is not used by the rest of the program any more. This is normally used to share data structures without inducing memory leaks. Weak hash sets are defined on values from a Hashtbl.HashedType module; the equal relation and hash function are taken from that module. We will say that v is an instance of x if equal x v is true.

    The equal relation must be able to work on a shallow copy of the values and give the same result as with the values themselves.

    module type S = sig ... end

    The output signature of the functor Weak.Make.

    module Make (H : Hashtbl.HashedType) : S with type data = H.t

    Functor building an implementation of the weak hash set structure. H.equal can't be the physical equality, since only shallow copies of the elements in the set are given to it.

    \ No newline at end of file +Weak (ocaml.Stdlib.Weak)

    Module Stdlib.Weak

    Arrays of weak pointers and hash sets of weak pointers.

    Low-level functions

    type !'a t

    The type of arrays of weak pointers (weak arrays). A weak pointer is a value that the garbage collector may erase whenever the value is not used any more (through normal pointers) by the program. Note that finalisation functions are run before the weak pointers are erased, because the finalisation functions can make values alive again (before 4.03 the finalisation functions were run after).

    A weak pointer is said to be full if it points to a value, empty if the value was erased by the GC.

    Notes:

    • Integers are not allocated and cannot be stored in weak arrays.
    • Weak arrays cannot be marshaled using Stdlib.output_value nor the functions of the Marshal module.
    val create : int -> 'a t

    Weak.create n returns a new weak array of length n. All the pointers are initially empty.

    val length : 'a t -> int

    Weak.length ar returns the length (number of elements) of ar.

    val set : 'a t -> int -> 'a option -> unit

    Weak.set ar n (Some el) sets the nth cell of ar to be a (full) pointer to el; Weak.set ar n None sets the nth cell of ar to empty.

    • raises Invalid_argument

      if n is not in the range 0 to Weak.length ar - 1.

    val get : 'a t -> int -> 'a option

    Weak.get ar n returns None if the nth cell of ar is empty, Some x (where x is the value) if it is full.

    • raises Invalid_argument

      if n is not in the range 0 to Weak.length ar - 1.

    val get_copy : 'a t -> int -> 'a option

    Weak.get_copy ar n returns None if the nth cell of ar is empty, Some x (where x is a (shallow) copy of the value) if it is full. In addition to pitfalls with mutable values, the interesting difference with get is that get_copy does not prevent the incremental GC from erasing the value in its current cycle (get may delay the erasure to the next GC cycle).

    • raises Invalid_argument

      if n is not in the range 0 to Weak.length ar - 1.

      If the element is a custom block it is not copied.

    val check : 'a t -> int -> bool

    Weak.check ar n returns true if the nth cell of ar is full, false if it is empty. Note that even if Weak.check ar n returns true, a subsequent Weak.get ar n can return None.

    • raises Invalid_argument

      if n is not in the range 0 to Weak.length ar - 1.

    val fill : 'a t -> int -> int -> 'a option -> unit

    Weak.fill ar ofs len el sets to el all pointers of ar from ofs to ofs + len - 1.

    • raises Invalid_argument

      if ofs and len do not designate a valid subarray of ar.

    val blit : 'a t -> int -> 'a t -> int -> int -> unit

    Weak.blit ar1 off1 ar2 off2 len copies len weak pointers from ar1 (starting at off1) to ar2 (starting at off2). It works correctly even if ar1 and ar2 are the same.

    • raises Invalid_argument

      if off1 and len do not designate a valid subarray of ar1, or if off2 and len do not designate a valid subarray of ar2.

    Weak hash sets

    A weak hash set is a hashed set of values. Each value may magically disappear from the set when it is not used by the rest of the program any more. This is normally used to share data structures without inducing memory leaks. Weak hash sets are defined on values from a Hashtbl.HashedType module; the equal relation and hash function are taken from that module. We will say that v is an instance of x if equal x v is true.

    The equal relation must be able to work on a shallow copy of the values and give the same result as with the values themselves.

    Unsynchronized accesses

    Unsynchronized accesses to weak hash sets are a programming error. Unsynchronized accesses to a weak hash set may lead to an invalid weak hash set state. Thus, concurrent accesses to weak hash sets must be synchronized (for instance with a Mutex.t).

    module type S = sig ... end

    The output signature of the functor Weak.Make.

    module Make (H : Hashtbl.HashedType) : S with type data = H.t

    Functor building an implementation of the weak hash set structure. H.equal can't be the physical equality, since only shallow copies of the elements in the set are given to it.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib/index.html b/dev/ocaml/Stdlib/index.html index cc14779c..ca0ae7f6 100644 --- a/dev/ocaml/Stdlib/index.html +++ b/dev/ocaml/Stdlib/index.html @@ -1,8 +1,8 @@ -Stdlib (ocaml.Stdlib)

    Module Stdlib

    The OCaml Standard library.

    This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by Stdlib.

    It particular, it provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and the standard library modules.

    Exceptions

    val raise : exn -> 'a

    Raise the given exception value

    val raise_notrace : exn -> 'a

    A faster version raise which does not record the backtrace.

    • since 4.02.0
    val invalid_arg : string -> 'a

    Raise exception Invalid_argument with the given string.

    val failwith : string -> 'a

    Raise exception Failure with the given string.

    exception Exit

    The Exit exception is not raised by any library function. It is provided for use in your programs.

    exception Match_failure of string * int * int

    Exception raised when none of the cases of a pattern-matching apply. The arguments are the location of the match keyword in the source code (file name, line number, column number).

    exception Assert_failure of string * int * int

    Exception raised when an assertion fails. The arguments are the location of the assert keyword in the source code (file name, line number, column number).

    exception Invalid_argument of string

    Exception raised by library functions to signal that the given arguments do not make sense. The string gives some information to the programmer. As a general rule, this exception should not be caught, it denotes a programming error and the code should be modified not to trigger it.

    exception Failure of string

    Exception raised by library functions to signal that they are undefined on the given arguments. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Failure _ instead).

    exception Not_found

    Exception raised by search functions when the desired object could not be found.

    exception Out_of_memory

    Exception raised by the garbage collector when there is insufficient memory to complete the computation. (Not reliable for allocations on the minor heap.)

    exception Stack_overflow

    Exception raised by the bytecode interpreter when the evaluation stack reaches its maximal size. This often indicates infinite or excessively deep recursion in the user's program.

    Before 4.10, it was not fully implemented by the native-code compiler.

    exception Sys_error of string

    Exception raised by the input/output functions to report an operating system error. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Sys_error _ instead).

    exception End_of_file

    Exception raised by input functions to signal that the end of file has been reached.

    exception Division_by_zero

    Exception raised by integer division and remainder operations when their second argument is zero.

    exception Sys_blocked_io

    A special case of Sys_error raised when no I/O is possible on a non-blocking I/O channel.

    exception Undefined_recursive_module of string * int * int

    Exception raised when an ill-founded recursive module definition is evaluated. The arguments are the location of the definition in the source code (file name, line number, column number).

    Comparisons

    val (=) : 'a -> 'a -> bool

    e1 = e2 tests for structural equality of e1 and e2. Mutable structures (e.g. references and arrays) are equal if and only if their current contents are structurally equal, even if the two mutable objects are not the same physical object. Equality between functional values raises Invalid_argument. Equality between cyclic data structures may not terminate. Left-associative operator, see Ocaml_operators for more information.

    val (<>) : 'a -> 'a -> bool

    Negation of Stdlib.(=). Left-associative operator, see Ocaml_operators for more information.

    val (<) : 'a -> 'a -> bool

    See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

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

    See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

    val (<=) : 'a -> 'a -> bool

    See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

    val (>=) : 'a -> 'a -> bool

    Structural ordering functions. These functions coincide with the usual orderings over integers, characters, strings, byte sequences and floating-point numbers, and extend them to a total ordering over all types. The ordering is compatible with ( = ). As in the case of ( = ), mutable structures are compared by contents. Comparison between functional values raises Invalid_argument. Comparison between cyclic structures may not terminate. Left-associative operator, see Ocaml_operators for more information.

    val compare : 'a -> 'a -> int

    compare x y returns 0 if x is equal to y, a negative integer if x is less than y, and a positive integer if x is greater than y. The ordering implemented by compare is compatible with the comparison predicates =, < and > defined above, with one difference on the treatment of the float value Stdlib.nan. Namely, the comparison predicates treat nan as different from any other float value, including itself; while compare treats nan as equal to itself and less than any other float value. This treatment of nan ensures that compare defines a total ordering relation.

    compare applied to functional values may raise Invalid_argument. compare applied to cyclic structures may not terminate.

    The compare function can be used as the comparison function required by the Set.Make and Map.Make functors, as well as the List.sort and Array.sort functions.

    val min : 'a -> 'a -> 'a

    Return the smaller of the two arguments. The result is unspecified if one of the arguments contains the float value nan.

    val max : 'a -> 'a -> 'a

    Return the greater of the two arguments. The result is unspecified if one of the arguments contains the float value nan.

    val (==) : 'a -> 'a -> bool

    e1 == e2 tests for physical equality of e1 and e2. On mutable types such as references, arrays, byte sequences, records with mutable fields and objects with mutable instance variables, e1 == e2 is true if and only if physical modification of e1 also affects e2. On non-mutable types, the behavior of ( == ) is implementation-dependent; however, it is guaranteed that e1 == e2 implies compare e1 e2 = 0. Left-associative operator, see Ocaml_operators for more information.

    val (!=) : 'a -> 'a -> bool

    Negation of Stdlib.(==). Left-associative operator, see Ocaml_operators for more information.

    Boolean operations

    val not : bool -> bool

    The boolean negation.

    val (&&) : bool -> bool -> bool

    The boolean 'and'. Evaluation is sequential, left-to-right: in e1 && e2, e1 is evaluated first, and if it returns false, e2 is not evaluated at all. Right-associative operator, see Ocaml_operators for more information.

    val (&) : bool -> bool -> bool
    • deprecated

      Stdlib.(&&) should be used instead. Right-associative operator, see Ocaml_operators for more information.

    val (||) : bool -> bool -> bool

    The boolean 'or'. Evaluation is sequential, left-to-right: in e1 || e2, e1 is evaluated first, and if it returns true, e2 is not evaluated at all. Right-associative operator, see Ocaml_operators for more information.

    val or : bool -> bool -> bool
    • deprecated

      Stdlib.(||) should be used instead. Right-associative operator, see Ocaml_operators for more information.

    Debugging

    val __LOC__ : string

    __LOC__ returns the location at which this expression appears in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d".

    • since 4.02.0
    val __FILE__ : string

    __FILE__ returns the name of the file currently being parsed by the compiler.

    • since 4.02.0
    val __LINE__ : int

    __LINE__ returns the line number at which this expression appears in the file currently being parsed by the compiler.

    • since 4.02.0
    val __MODULE__ : string

    __MODULE__ returns the module name of the file being parsed by the compiler.

    • since 4.02.0
    val __POS__ : string * int * int * int

    __POS__ returns a tuple (file,lnum,cnum,enum), corresponding to the location at which this expression appears in the file currently being parsed by the compiler. file is the current filename, lnum the line number, cnum the character position in the line and enum the last character position in the line.

    • since 4.02.0
    val __FUNCTION__ : string

    __FUNCTION__ returns the name of the current function or method, including any enclosing modules or classes.

    • since 4.12.0
    val __LOC_OF__ : 'a -> string * 'a

    __LOC_OF__ expr returns a pair (loc, expr) where loc is the location of expr in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d".

    • since 4.02.0
    val __LINE_OF__ : 'a -> int * 'a

    __LINE_OF__ expr returns a pair (line, expr), where line is the line number at which the expression expr appears in the file currently being parsed by the compiler.

    • since 4.02.0
    val __POS_OF__ : 'a -> (string * int * int * int) * 'a

    __POS_OF__ expr returns a pair (loc,expr), where loc is a tuple (file,lnum,cnum,enum) corresponding to the location at which the expression expr appears in the file currently being parsed by the compiler. file is the current filename, lnum the line number, cnum the character position in the line and enum the last character position in the line.

    • since 4.02.0

    Composition operators

    val (|>) : 'a -> ('a -> 'b) -> 'b

    Reverse-application operator: x |> f |> g is exactly equivalent to g (f (x)). Left-associative operator, see Ocaml_operators for more information.

    • since 4.01
    val (@@) : ('a -> 'b) -> 'a -> 'b

    Application operator: g @@ f @@ x is exactly equivalent to g (f (x)). Right-associative operator, see Ocaml_operators for more information.

    • since 4.01

    Integer arithmetic

    Integers are Sys.int_size bits wide. All operations are taken modulo 2Sys.int_size. They do not fail on overflow.

    val (~-) : int -> int

    Unary negation. You can also write - e instead of ~- e. Unary operator, see Ocaml_operators for more information.

    val (~+) : int -> int

    Unary addition. You can also write + e instead of ~+ e. Unary operator, see Ocaml_operators for more information.

    • since 3.12.0
    val succ : int -> int

    succ x is x + 1.

    val pred : int -> int

    pred x is x - 1.

    val (+) : int -> int -> int

    Integer addition. Left-associative operator, see Ocaml_operators for more information.

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

    Integer subtraction. Left-associative operator, , see Ocaml_operators for more information.

    val (*) : int -> int -> int

    Integer multiplication. Left-associative operator, see Ocaml_operators for more information.

    val (/) : int -> int -> int

    Integer division. Integer division rounds the real quotient of its arguments towards zero. More precisely, if x >= 0 and y > 0, x / y is the greatest integer less than or equal to the real quotient of x by y. Moreover, (- x) / y = x / (- y) = - (x / y). Left-associative operator, see Ocaml_operators for more information.

    • raises Division_by_zero

      if the second argument is 0.

    val (mod) : int -> int -> int

    Integer remainder. If y is not zero, the result of x mod y satisfies the following properties: x = (x / y) * y + x mod y and abs(x mod y) <= abs(y) - 1. If y = 0, x mod y raises Division_by_zero. Note that x mod y is negative only if x < 0. Left-associative operator, see Ocaml_operators for more information.

    • raises Division_by_zero

      if y is zero.

    val abs : int -> int

    Return the absolute value of the argument. Note that this may be negative if the argument is min_int.

    val max_int : int

    The greatest representable integer.

    val min_int : int

    The smallest representable integer.

    Bitwise operations

    val (land) : int -> int -> int

    Bitwise logical and. Left-associative operator, see Ocaml_operators for more information.

    val (lor) : int -> int -> int

    Bitwise logical or. Left-associative operator, see Ocaml_operators for more information.

    val (lxor) : int -> int -> int

    Bitwise logical exclusive or. Left-associative operator, see Ocaml_operators for more information.

    val lnot : int -> int

    Bitwise logical negation.

    val (lsl) : int -> int -> int

    n lsl m shifts n to the left by m bits. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

    val (lsr) : int -> int -> int

    n lsr m shifts n to the right by m bits. This is a logical shift: zeroes are inserted regardless of the sign of n. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

    val (asr) : int -> int -> int

    n asr m shifts n to the right by m bits. This is an arithmetic shift: the sign bit of n is replicated. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

    Floating-point arithmetic

    OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. Floating-point operations never raise an exception on overflow, underflow, division by zero, etc. Instead, special IEEE numbers are returned as appropriate, such as infinity for 1.0 /. 0.0, neg_infinity for -1.0 /. 0.0, and nan ('not a number') for 0.0 /. 0.0. These special numbers then propagate through floating-point computations as expected: for instance, 1.0 /. infinity is 0.0, basic arithmetic operations (+., -., *., /.) with nan as an argument return nan, ...

    val (~-.) : float -> float

    Unary negation. You can also write -. e instead of ~-. e. Unary operator, see Ocaml_operators for more information.

    val (~+.) : float -> float

    Unary addition. You can also write +. e instead of ~+. e. Unary operator, see Ocaml_operators for more information.

    • since 3.12.0
    val (+.) : float -> float -> float

    Floating-point addition. Left-associative operator, see Ocaml_operators for more information.

    val (-.) : float -> float -> float

    Floating-point subtraction. Left-associative operator, see Ocaml_operators for more information.

    val (*.) : float -> float -> float

    Floating-point multiplication. Left-associative operator, see Ocaml_operators for more information.

    val (/.) : float -> float -> float

    Floating-point division. Left-associative operator, see Ocaml_operators for more information.

    val (**) : float -> float -> float

    Exponentiation. Right-associative operator, see Ocaml_operators for more information.

    val sqrt : float -> float

    Square root.

    val exp : float -> float

    Exponential.

    val log : float -> float

    Natural logarithm.

    val log10 : float -> float

    Base 10 logarithm.

    val expm1 : float -> float

    expm1 x computes exp x -. 1.0, giving numerically-accurate results even if x is close to 0.0.

    • since 3.12.0
    val log1p : float -> float

    log1p x computes log(1.0 +. x) (natural logarithm), giving numerically-accurate results even if x is close to 0.0.

    • since 3.12.0
    val cos : float -> float

    Cosine. Argument is in radians.

    val sin : float -> float

    Sine. Argument is in radians.

    val tan : float -> float

    Tangent. Argument is in radians.

    val acos : float -> float

    Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.

    val asin : float -> float

    Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.

    val atan : float -> float

    Arc tangent. Result is in radians and is between -pi/2 and pi/2.

    val atan2 : float -> float -> float

    atan2 y x returns the arc tangent of y /. x. The signs of x and y are used to determine the quadrant of the result. Result is in radians and is between -pi and pi.

    val hypot : float -> float -> float

    hypot x y returns sqrt(x *. x + y *. y), that is, the length of the hypotenuse of a right-angled triangle with sides of length x and y, or, equivalently, the distance of the point (x,y) to origin. If one of x or y is infinite, returns infinity even if the other is nan.

    • since 4.00.0
    val cosh : float -> float

    Hyperbolic cosine. Argument is in radians.

    val sinh : float -> float

    Hyperbolic sine. Argument is in radians.

    val tanh : float -> float

    Hyperbolic tangent. Argument is in radians.

    val acosh : float -> float

    Hyperbolic arc cosine. The argument must fall within the range [1.0, inf]. Result is in radians and is between 0.0 and inf.

    • since 4.13.0
    val asinh : float -> float

    Hyperbolic arc sine. The argument and result range over the entire real line. Result is in radians.

    • since 4.13.0
    val atanh : float -> float

    Hyperbolic arc tangent. The argument must fall within the range [-1.0, 1.0]. Result is in radians and ranges over the entire real line.

    • since 4.13.0
    val ceil : float -> float

    Round above to an integer value. ceil f returns the least integer value greater than or equal to f. The result is returned as a float.

    val floor : float -> float

    Round below to an integer value. floor f returns the greatest integer value less than or equal to f. The result is returned as a float.

    val abs_float : float -> float

    abs_float f returns the absolute value of f.

    val copysign : float -> float -> float

    copysign x y returns a float whose absolute value is that of x and whose sign is that of y. If x is nan, returns nan. If y is nan, returns either x or -. x, but it is not specified which.

    • since 4.00.0
    val mod_float : float -> float -> float

    mod_float a b returns the remainder of a with respect to b. The returned value is a -. n *. b, where n is the quotient a /. b rounded towards zero to an integer.

    val frexp : float -> float * int

    frexp f returns the pair of the significant and the exponent of f. When f is zero, the significant x and the exponent n of f are equal to zero. When f is non-zero, they are defined by f = x *. 2 ** n and 0.5 <= x < 1.0.

    val ldexp : float -> int -> float

    ldexp x n returns x *. 2 ** n.

    val modf : float -> float * float

    modf f returns the pair of the fractional and integral part of f.

    val float : int -> float
    val float_of_int : int -> float

    Convert an integer to floating-point.

    val truncate : float -> int
    val int_of_float : float -> int

    Truncate the given floating-point number to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

    val infinity : float

    Positive infinity.

    val neg_infinity : float

    Negative infinity.

    val nan : float

    A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for 'not a number'. Any floating-point operation with nan as argument returns nan as result. As for floating-point comparisons, =, <, <=, > and >= return false and <> returns true if one or both of their arguments is nan.

    val max_float : float

    The largest positive finite value of type float.

    val min_float : float

    The smallest positive, non-zero, non-denormalized value of type float.

    val epsilon_float : float

    The difference between 1.0 and the smallest exactly representable floating-point number greater than 1.0.

    type fpclass =
    1. | FP_normal
      (*

      Normal number, none of the below

      *)
    2. | FP_subnormal
      (*

      Number very close to 0.0, has reduced precision

      *)
    3. | FP_zero
      (*

      Number is 0.0 or -0.0

      *)
    4. | FP_infinite
      (*

      Number is positive or negative infinity

      *)
    5. | FP_nan
      (*

      Not a number: result of an undefined operation

      *)

    The five classes of floating-point numbers, as determined by the Stdlib.classify_float function.

    val classify_float : float -> fpclass

    Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.

    String operations

    More string operations are provided in module String.

    val (^) : string -> string -> string

    String concatenation. Right-associative operator, see Ocaml_operators for more information.

    Character operations

    More character operations are provided in module Char.

    val int_of_char : char -> int

    Return the ASCII code of the argument.

    val char_of_int : int -> char

    Return the character with the given ASCII code.

    • raises Invalid_argument

      if the argument is outside the range 0--255.

    Unit operations

    val ignore : 'a -> unit

    Discard the value of its argument and return (). For instance, ignore(f x) discards the result of the side-effecting function f. It is equivalent to f x; (), except that the latter may generate a compiler warning; writing ignore(f x) instead avoids the warning.

    String conversion functions

    val string_of_bool : bool -> string

    Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly.

    val bool_of_string_opt : string -> bool option

    Convert the given string to a boolean.

    Return None if the string is not "true" or "false".

    • since 4.05
    val bool_of_string : string -> bool

    Same as Stdlib.bool_of_string_opt, but raise Invalid_argument "bool_of_string" instead of returning None.

    val string_of_int : int -> string

    Return the string representation of an integer, in decimal.

    val int_of_string_opt : string -> int option

    Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with 0u), in hexadecimal (if it begins with 0x or 0X), in octal (if it begins with 0o or 0O), or in binary (if it begins with 0b or 0B).

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*max_int+1]. If the input exceeds max_int it is converted to the signed integer min_int + input - max_int - 1.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    Return None if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int.

    • since 4.05
    val int_of_string : string -> int

    Same as Stdlib.int_of_string_opt, but raise Failure "int_of_string" instead of returning None.

    val string_of_float : float -> string

    Return a string representation of a floating-point number.

    This conversion can involve a loss of precision. For greater control over the manner in which the number is printed, see Printf.

    val float_of_string_opt : string -> float option

    Convert the given string to a float. The string is read in decimal (by default) or in hexadecimal (marked by 0x or 0X).

    The format of decimal floating-point numbers is [-] dd.ddd (e|E) [+|-] dd , where d stands for a decimal digit.

    The format of hexadecimal floating-point numbers is [-] 0(x|X) hh.hhh (p|P) [+|-] dd , where h stands for an hexadecimal digit and d for a decimal digit.

    In both cases, at least one of the integer and fractional parts must be given; the exponent part is optional.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    Depending on the execution platforms, other representations of floating-point numbers can be accepted, but should not be relied upon.

    Return None if the given string is not a valid representation of a float.

    • since 4.05
    val float_of_string : string -> float

    Same as Stdlib.float_of_string_opt, but raise Failure "float_of_string" instead of returning None.

    Pair operations

    val fst : ('a * 'b) -> 'a

    Return the first component of a pair.

    val snd : ('a * 'b) -> 'b

    Return the second component of a pair.

    List operations

    More list operations are provided in module List.

    val (@) : 'a list -> 'a list -> 'a list

    List concatenation. Not tail-recursive (length of the first argument). Right-associative operator, see Ocaml_operators for more information.

    Input/output

    Note: all input/output functions can raise Sys_error when the system calls they invoke fail.

    type in_channel

    The type of input channel.

    type out_channel

    The type of output channel.

    val stdin : in_channel

    The standard input for the process.

    val stdout : out_channel

    The standard output for the process.

    val stderr : out_channel

    The standard error output for the process.

    Output functions on standard output

    val print_char : char -> unit

    Print a character on standard output.

    val print_string : string -> unit

    Print a string on standard output.

    val print_bytes : bytes -> unit

    Print a byte sequence on standard output.

    • since 4.02.0
    val print_int : int -> unit

    Print an integer, in decimal, on standard output.

    val print_float : float -> unit

    Print a floating-point number, in decimal, on standard output.

    The conversion of the number to a string uses string_of_float and can involve a loss of precision.

    val print_endline : string -> unit

    Print a string, followed by a newline character, on standard output and flush standard output.

    val print_newline : unit -> unit

    Print a newline character on standard output, and flush standard output. This can be used to simulate line buffering of standard output.

    Output functions on standard error

    val prerr_char : char -> unit

    Print a character on standard error.

    val prerr_string : string -> unit

    Print a string on standard error.

    val prerr_bytes : bytes -> unit

    Print a byte sequence on standard error.

    • since 4.02.0
    val prerr_int : int -> unit

    Print an integer, in decimal, on standard error.

    val prerr_float : float -> unit

    Print a floating-point number, in decimal, on standard error.

    The conversion of the number to a string uses string_of_float and can involve a loss of precision.

    val prerr_endline : string -> unit

    Print a string, followed by a newline character on standard error and flush standard error.

    val prerr_newline : unit -> unit

    Print a newline character on standard error, and flush standard error.

    Input functions on standard input

    val read_line : unit -> string

    Flush standard output, then read characters from standard input until a newline character is encountered.

    Return the string of all characters read, without the newline character at the end.

    • raises End_of_file

      if the end of the file is reached at the beginning of line.

    val read_int_opt : unit -> int option

    Flush standard output, then read one line from standard input and convert it to an integer.

    Return None if the line read is not a valid representation of an integer.

    • since 4.05
    val read_int : unit -> int

    Same as Stdlib.read_int_opt, but raise Failure "int_of_string" instead of returning None.

    val read_float_opt : unit -> float option

    Flush standard output, then read one line from standard input and convert it to a floating-point number.

    Return None if the line read is not a valid representation of a floating-point number.

    • since 4.05.0
    val read_float : unit -> float

    Same as Stdlib.read_float_opt, but raise Failure "float_of_string" instead of returning None.

    General output functions

    type open_flag =
    1. | Open_rdonly
      (*

      open for reading.

      *)
    2. | Open_wronly
      (*

      open for writing.

      *)
    3. | Open_append
      (*

      open for appending: always write at end of file.

      *)
    4. | Open_creat
      (*

      create the file if it does not exist.

      *)
    5. | Open_trunc
      (*

      empty the file if it already exists.

      *)
    6. | Open_excl
      (*

      fail if Open_creat and the file already exists.

      *)
    7. | Open_binary
      (*

      open in binary mode (no conversion).

      *)
    8. | Open_text
      (*

      open in text mode (may perform conversions).

      *)
    9. | Open_nonblock
      (*

      open in non-blocking mode.

      *)
    val open_out : string -> out_channel

    Open the named file for writing, and return a new output channel on that file, positioned at the beginning of the file. The file is truncated to zero length if it already exists. It is created if it does not already exists.

    val open_out_bin : string -> out_channel

    Same as Stdlib.open_out, but the file is opened in binary mode, so that no translation takes place during writes. On operating systems that do not distinguish between text mode and binary mode, this function behaves like Stdlib.open_out.

    val open_out_gen : open_flag list -> int -> string -> out_channel

    open_out_gen mode perm filename opens the named file for writing, as described above. The extra argument mode specifies the opening mode. The extra argument perm specifies the file permissions, in case the file must be created. Stdlib.open_out and Stdlib.open_out_bin are special cases of this function.

    val flush : out_channel -> unit

    Flush the buffer associated with the given output channel, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.

    val flush_all : unit -> unit

    Flush all open output channels; ignore errors.

    val output_char : out_channel -> char -> unit

    Write the character on the given output channel.

    val output_string : out_channel -> string -> unit

    Write the string on the given output channel.

    val output_bytes : out_channel -> bytes -> unit

    Write the byte sequence on the given output channel.

    • since 4.02.0
    val output : out_channel -> bytes -> int -> int -> unit

    output oc buf pos len writes len characters from byte sequence buf, starting at offset pos, to the given output channel oc.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val output_substring : out_channel -> string -> int -> int -> unit

    Same as output but take a string as argument instead of a byte sequence.

    • since 4.02.0
    val output_byte : out_channel -> int -> unit

    Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.

    val output_binary_int : out_channel -> int -> unit

    Write one integer in binary format (4 bytes, big-endian) on the given output channel. The given integer is taken modulo 232. The only reliable way to read it back is through the Stdlib.input_binary_int function. The format is compatible across all machines for a given version of OCaml.

    val output_value : out_channel -> 'a -> unit

    Write the representation of a structured value of any type to a channel. Circularities and sharing inside the value are detected and preserved. The object can be read back, by the function Stdlib.input_value. See the description of module Marshal for more information. Stdlib.output_value is equivalent to Marshal.to_channel with an empty list of flags.

    val seek_out : out_channel -> int -> unit

    seek_out chan pos sets the current writing position to pos for channel chan. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.

    val pos_out : out_channel -> int

    Return the current writing position for the given channel. Does not work on channels opened with the Open_append flag (returns unspecified results). For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos_out, then going back to this position using seek_out will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

    val out_channel_length : out_channel -> int

    Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless.

    val close_out : out_channel -> unit

    Close the given channel, flushing all buffered write operations. Output functions raise a Sys_error exception when they are applied to a closed output channel, except close_out and flush, which do nothing when applied to an already closed channel. Note that close_out may raise Sys_error if the operating system signals an error when flushing or closing.

    val close_out_noerr : out_channel -> unit

    Same as close_out, but ignore all errors.

    val set_binary_mode_out : out_channel -> bool -> unit

    set_binary_mode_out oc true sets the channel oc to binary mode: no translations take place during output. set_binary_mode_out oc false sets the channel oc to text mode: depending on the operating system, some translations may take place during output. For instance, under Windows, end-of-lines will be translated from \n to \r\n. This function has no effect under operating systems that do not distinguish between text mode and binary mode.

    General input functions

    val open_in : string -> in_channel

    Open the named file for reading, and return a new input channel on that file, positioned at the beginning of the file.

    val open_in_bin : string -> in_channel

    Same as Stdlib.open_in, but the file is opened in binary mode, so that no translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like Stdlib.open_in.

    val open_in_gen : open_flag list -> int -> string -> in_channel

    open_in_gen mode perm filename opens the named file for reading, as described above. The extra arguments mode and perm specify the opening mode and file permissions. Stdlib.open_in and Stdlib.open_in_bin are special cases of this function.

    val input_char : in_channel -> char

    Read one character from the given input channel.

    • raises End_of_file

      if there are no more characters to read.

    val input_line : in_channel -> string

    Read characters from the given input channel, until a newline character is encountered. Return the string of all characters read, without the newline character at the end.

    • raises End_of_file

      if the end of the file is reached at the beginning of line.

    val input : in_channel -> bytes -> int -> int -> int

    input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached. A return value between 0 and len exclusive means that not all requested len characters were read, either because no more characters were available at that time, or because the implementation found it convenient to do a partial read; input must be called again to read the remaining characters, if desired. (See also Stdlib.really_input for reading exactly len characters.) Exception Invalid_argument "input" is raised if pos and len do not designate a valid range of buf.

    val really_input : in_channel -> bytes -> int -> int -> unit

    really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

    • raises End_of_file

      if the end of file is reached before len characters have been read.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val really_input_string : in_channel -> int -> string

    really_input_string ic len reads len characters from channel ic and returns them in a new string.

    • raises End_of_file

      if the end of file is reached before len characters have been read.

    • since 4.02.0
    val input_byte : in_channel -> int

    Same as Stdlib.input_char, but return the 8-bit integer representing the character.

    • raises End_of_file

      if the end of file was reached.

    val input_binary_int : in_channel -> int

    Read an integer encoded in binary format (4 bytes, big-endian) from the given input channel. See Stdlib.output_binary_int.

    • raises End_of_file

      if the end of file was reached while reading the integer.

    val input_value : in_channel -> 'a

    Read the representation of a structured value, as produced by Stdlib.output_value, and return the corresponding value. This function is identical to Marshal.from_channel; see the description of module Marshal for more information, in particular concerning the lack of type safety.

    val seek_in : in_channel -> int -> unit

    seek_in chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

    val pos_in : in_channel -> int

    Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos_in, then going back to this position using seek_in will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

    val in_channel_length : in_channel -> int

    Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

    val close_in : in_channel -> unit

    Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close_in, which does nothing when applied to an already closed channel.

    val close_in_noerr : in_channel -> unit

    Same as close_in, but ignore all errors.

    val set_binary_mode_in : in_channel -> bool -> unit

    set_binary_mode_in ic true sets the channel ic to binary mode: no translations take place during input. set_binary_mode_out ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n. This function has no effect under operating systems that do not distinguish between text mode and binary mode.

    Operations on large files

    module LargeFile : sig ... end

    Operations on large files. This sub-module provides 64-bit variants of the channel functions that manipulate file positions and file sizes. By representing positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), these alternate functions allow operating on files whose sizes are greater than max_int.

    References

    type 'a ref = {
    1. mutable contents : 'a;
    }

    The type of references (mutable indirection cells) containing a value of type 'a.

    val ref : 'a -> 'a ref

    Return a fresh reference containing the given value.

    val (!) : 'a ref -> 'a

    !r returns the current contents of reference r. Equivalent to fun r -> r.contents. Unary operator, see Ocaml_operators for more information.

    val (:=) : 'a ref -> 'a -> unit

    r := a stores the value of a in reference r. Equivalent to fun r v -> r.contents <- v. Right-associative operator, see Ocaml_operators for more information.

    val incr : int ref -> unit

    Increment the integer contained in the given reference. Equivalent to fun r -> r := succ !r.

    val decr : int ref -> unit

    Decrement the integer contained in the given reference. Equivalent to fun r -> r := pred !r.

    Result type

    type ('a, 'b) result =
    1. | Ok of 'a
    2. | Error of 'b
    • since 4.03.0

    Operations on format strings

    Format strings are character strings with special lexical conventions that defines the functionality of formatted input/output functions. Format strings are used to read data with formatted input functions from module Scanf and to print data with formatted output functions from modules Printf and Format.

    Format strings are made of three kinds of entities:

    • conversions specifications, introduced by the special character '%' followed by one or more characters specifying what kind of argument to read or print,
    • formatting indications, introduced by the special character '@' followed by one or more characters specifying how to read or print the argument,
    • plain characters that are regular characters with usual lexical conventions. Plain characters specify string literals to be read in the input or printed in the output.

    There is an additional lexical rule to escape the special characters '%' and '@' in format strings: if a special character follows a '%' character, it is treated as a plain character. In other words, "%%" is considered as a plain '%' and "%@" as a plain '@'.

    For more information about conversion specifications and formatting indications available, read the documentation of modules Scanf, Printf and Format.

    Format strings have a general and highly polymorphic type ('a, 'b, 'c, 'd, 'e, 'f) format6. The two simplified types, format and format4 below are included for backward compatibility with earlier releases of OCaml.

    The meaning of format string type parameters is as follows:

    • 'a is the type of the parameters of the format for formatted output functions (printf-style functions); 'a is the type of the values read by the format for formatted input functions (scanf-style functions).
    • 'b is the type of input source for formatted input functions and the type of output target for formatted output functions. For printf-style functions from module Printf, 'b is typically out_channel; for printf-style functions from module Format, 'b is typically Format.formatter; for scanf-style functions from module Scanf, 'b is typically Scanf.Scanning.in_channel.

    Type argument 'b is also the type of the first argument given to user's defined printing functions for %a and %t conversions, and user's defined reading functions for %r conversion.

    • 'c is the type of the result of the %a and %t printing functions, and also the type of the argument transmitted to the first argument of kprintf-style functions or to the kscanf-style functions.
    • 'd is the type of parameters for the scanf-style functions.
    • 'e is the type of the receiver function for the scanf-style functions.
    • 'f is the final result type of a formatted input/output function invocation: for the printf-style functions, it is typically unit; for the scanf-style functions, it is typically the result type of the receiver function.
    type ('a, 'b, 'c, 'd, 'e, 'f) format6 = +Stdlib (ocaml.Stdlib)

    Module Stdlib

    The OCaml Standard library.

    This module is automatically opened at the beginning of each compilation. All components of this module can therefore be referred by their short name, without prefixing them by Stdlib.

    In particular, it provides the basic operations over the built-in types (numbers, booleans, byte sequences, strings, exceptions, references, lists, arrays, input-output channels, ...) and the standard library modules.

    Exceptions

    val raise : exn -> 'a

    Raise the given exception value

    val raise_notrace : exn -> 'a

    A faster version raise which does not record the backtrace.

    • since 4.02.0
    val invalid_arg : string -> 'a

    Raise exception Invalid_argument with the given string.

    val failwith : string -> 'a

    Raise exception Failure with the given string.

    exception Exit

    The Exit exception is not raised by any library function. It is provided for use in your programs.

    exception Match_failure of string * int * int

    Exception raised when none of the cases of a pattern-matching apply. The arguments are the location of the match keyword in the source code (file name, line number, column number).

    exception Assert_failure of string * int * int

    Exception raised when an assertion fails. The arguments are the location of the assert keyword in the source code (file name, line number, column number).

    exception Invalid_argument of string

    Exception raised by library functions to signal that the given arguments do not make sense. The string gives some information to the programmer. As a general rule, this exception should not be caught, it denotes a programming error and the code should be modified not to trigger it.

    exception Failure of string

    Exception raised by library functions to signal that they are undefined on the given arguments. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Failure _ instead).

    exception Not_found

    Exception raised by search functions when the desired object could not be found.

    exception Out_of_memory

    Exception raised by the garbage collector when there is insufficient memory to complete the computation. (Not reliable for allocations on the minor heap.)

    exception Stack_overflow

    Exception raised by the bytecode interpreter when the evaluation stack reaches its maximal size. This often indicates infinite or excessively deep recursion in the user's program.

    Before 4.10, it was not fully implemented by the native-code compiler.

    exception Sys_error of string

    Exception raised by the input/output functions to report an operating system error. The string is meant to give some information to the programmer; you must not pattern match on the string literal because it may change in future versions (use Sys_error _ instead).

    exception End_of_file

    Exception raised by input functions to signal that the end of file has been reached.

    exception Division_by_zero

    Exception raised by integer division and remainder operations when their second argument is zero.

    exception Sys_blocked_io

    A special case of Sys_error raised when no I/O is possible on a non-blocking I/O channel.

    exception Undefined_recursive_module of string * int * int

    Exception raised when an ill-founded recursive module definition is evaluated. The arguments are the location of the definition in the source code (file name, line number, column number).

    Comparisons

    val (=) : 'a -> 'a -> bool

    e1 = e2 tests for structural equality of e1 and e2. Mutable structures (e.g. references and arrays) are equal if and only if their current contents are structurally equal, even if the two mutable objects are not the same physical object. Equality between functional values raises Invalid_argument. Equality between cyclic data structures may not terminate. Left-associative operator, see Ocaml_operators for more information.

    val (<>) : 'a -> 'a -> bool

    Negation of Stdlib.(=). Left-associative operator, see Ocaml_operators for more information.

    val (<) : 'a -> 'a -> bool

    See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

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

    See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

    val (<=) : 'a -> 'a -> bool

    See Stdlib.(>=). Left-associative operator, see Ocaml_operators for more information.

    val (>=) : 'a -> 'a -> bool

    Structural ordering functions. These functions coincide with the usual orderings over integers, characters, strings, byte sequences and floating-point numbers, and extend them to a total ordering over all types. The ordering is compatible with ( = ). As in the case of ( = ), mutable structures are compared by contents. Comparison between functional values raises Invalid_argument. Comparison between cyclic structures may not terminate. Left-associative operator, see Ocaml_operators for more information.

    val compare : 'a -> 'a -> int

    compare x y returns 0 if x is equal to y, a negative integer if x is less than y, and a positive integer if x is greater than y. The ordering implemented by compare is compatible with the comparison predicates =, < and > defined above, with one difference on the treatment of the float value Stdlib.nan. Namely, the comparison predicates treat nan as different from any other float value, including itself; while compare treats nan as equal to itself and less than any other float value. This treatment of nan ensures that compare defines a total ordering relation.

    compare applied to functional values may raise Invalid_argument. compare applied to cyclic structures may not terminate.

    The compare function can be used as the comparison function required by the Set.Make and Map.Make functors, as well as the List.sort and Array.sort functions.

    val min : 'a -> 'a -> 'a

    Return the smaller of the two arguments. The result is unspecified if one of the arguments contains the float value nan.

    val max : 'a -> 'a -> 'a

    Return the greater of the two arguments. The result is unspecified if one of the arguments contains the float value nan.

    val (==) : 'a -> 'a -> bool

    e1 == e2 tests for physical equality of e1 and e2. On mutable types such as references, arrays, byte sequences, records with mutable fields and objects with mutable instance variables, e1 == e2 is true if and only if physical modification of e1 also affects e2. On non-mutable types, the behavior of ( == ) is implementation-dependent; however, it is guaranteed that e1 == e2 implies compare e1 e2 = 0. Left-associative operator, see Ocaml_operators for more information.

    val (!=) : 'a -> 'a -> bool

    Negation of Stdlib.(==). Left-associative operator, see Ocaml_operators for more information.

    Boolean operations

    val not : bool -> bool

    The boolean negation.

    val (&&) : bool -> bool -> bool

    The boolean 'and'. Evaluation is sequential, left-to-right: in e1 && e2, e1 is evaluated first, and if it returns false, e2 is not evaluated at all. Right-associative operator, see Ocaml_operators for more information.

    val (||) : bool -> bool -> bool

    The boolean 'or'. Evaluation is sequential, left-to-right: in e1 || e2, e1 is evaluated first, and if it returns true, e2 is not evaluated at all. Right-associative operator, see Ocaml_operators for more information.

    Debugging

    val __LOC__ : string

    __LOC__ returns the location at which this expression appears in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d".

    • since 4.02.0
    val __FILE__ : string

    __FILE__ returns the name of the file currently being parsed by the compiler.

    • since 4.02.0
    val __LINE__ : int

    __LINE__ returns the line number at which this expression appears in the file currently being parsed by the compiler.

    • since 4.02.0
    val __MODULE__ : string

    __MODULE__ returns the module name of the file being parsed by the compiler.

    • since 4.02.0
    val __POS__ : string * int * int * int

    __POS__ returns a tuple (file,lnum,cnum,enum), corresponding to the location at which this expression appears in the file currently being parsed by the compiler. file is the current filename, lnum the line number, cnum the character position in the line and enum the last character position in the line.

    • since 4.02.0
    val __FUNCTION__ : string

    __FUNCTION__ returns the name of the current function or method, including any enclosing modules or classes.

    • since 4.12.0
    val __LOC_OF__ : 'a -> string * 'a

    __LOC_OF__ expr returns a pair (loc, expr) where loc is the location of expr in the file currently being parsed by the compiler, with the standard error format of OCaml: "File %S, line %d, characters %d-%d".

    • since 4.02.0
    val __LINE_OF__ : 'a -> int * 'a

    __LINE_OF__ expr returns a pair (line, expr), where line is the line number at which the expression expr appears in the file currently being parsed by the compiler.

    • since 4.02.0
    val __POS_OF__ : 'a -> (string * int * int * int) * 'a

    __POS_OF__ expr returns a pair (loc,expr), where loc is a tuple (file,lnum,cnum,enum) corresponding to the location at which the expression expr appears in the file currently being parsed by the compiler. file is the current filename, lnum the line number, cnum the character position in the line and enum the last character position in the line.

    • since 4.02.0

    Composition operators

    val (|>) : 'a -> ('a -> 'b) -> 'b

    Reverse-application operator: x |> f |> g is exactly equivalent to g (f (x)). Left-associative operator, see Ocaml_operators for more information.

    • since 4.01
    val (@@) : ('a -> 'b) -> 'a -> 'b

    Application operator: g @@ f @@ x is exactly equivalent to g (f (x)). Right-associative operator, see Ocaml_operators for more information.

    • since 4.01

    Integer arithmetic

    Integers are Sys.int_size bits wide. All operations are taken modulo 2Sys.int_size. They do not fail on overflow.

    val (~-) : int -> int

    Unary negation. You can also write - e instead of ~- e. Unary operator, see Ocaml_operators for more information.

    val (~+) : int -> int

    Unary addition. You can also write + e instead of ~+ e. Unary operator, see Ocaml_operators for more information.

    • since 3.12.0
    val succ : int -> int

    succ x is x + 1.

    val pred : int -> int

    pred x is x - 1.

    val (+) : int -> int -> int

    Integer addition. Left-associative operator, see Ocaml_operators for more information.

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

    Integer subtraction. Left-associative operator, , see Ocaml_operators for more information.

    val (*) : int -> int -> int

    Integer multiplication. Left-associative operator, see Ocaml_operators for more information.

    val (/) : int -> int -> int

    Integer division. Integer division rounds the real quotient of its arguments towards zero. More precisely, if x >= 0 and y > 0, x / y is the greatest integer less than or equal to the real quotient of x by y. Moreover, (- x) / y = x / (- y) = - (x / y). Left-associative operator, see Ocaml_operators for more information.

    • raises Division_by_zero

      if the second argument is 0.

    val (mod) : int -> int -> int

    Integer remainder. If y is not zero, the result of x mod y satisfies the following properties: x = (x / y) * y + x mod y and abs(x mod y) <= abs(y) - 1. If y = 0, x mod y raises Division_by_zero. Note that x mod y is negative only if x < 0. Left-associative operator, see Ocaml_operators for more information.

    • raises Division_by_zero

      if y is zero.

    val abs : int -> int

    abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

    val max_int : int

    The greatest representable integer.

    val min_int : int

    The smallest representable integer.

    Bitwise operations

    val (land) : int -> int -> int

    Bitwise logical and. Left-associative operator, see Ocaml_operators for more information.

    val (lor) : int -> int -> int

    Bitwise logical or. Left-associative operator, see Ocaml_operators for more information.

    val (lxor) : int -> int -> int

    Bitwise logical exclusive or. Left-associative operator, see Ocaml_operators for more information.

    val lnot : int -> int

    Bitwise logical negation.

    val (lsl) : int -> int -> int

    n lsl m shifts n to the left by m bits. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

    val (lsr) : int -> int -> int

    n lsr m shifts n to the right by m bits. This is a logical shift: zeroes are inserted regardless of the sign of n. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

    val (asr) : int -> int -> int

    n asr m shifts n to the right by m bits. This is an arithmetic shift: the sign bit of n is replicated. The result is unspecified if m < 0 or m > Sys.int_size. Right-associative operator, see Ocaml_operators for more information.

    Floating-point arithmetic

    OCaml's floating-point numbers follow the IEEE 754 standard, using double precision (64 bits) numbers. Floating-point operations never raise an exception on overflow, underflow, division by zero, etc. Instead, special IEEE numbers are returned as appropriate, such as infinity for 1.0 /. 0.0, neg_infinity for -1.0 /. 0.0, and nan ('not a number') for 0.0 /. 0.0. These special numbers then propagate through floating-point computations as expected: for instance, 1.0 /. infinity is 0.0, basic arithmetic operations (+., -., *., /.) with nan as an argument return nan, ...

    val (~-.) : float -> float

    Unary negation. You can also write -. e instead of ~-. e. Unary operator, see Ocaml_operators for more information.

    val (~+.) : float -> float

    Unary addition. You can also write +. e instead of ~+. e. Unary operator, see Ocaml_operators for more information.

    • since 3.12.0
    val (+.) : float -> float -> float

    Floating-point addition. Left-associative operator, see Ocaml_operators for more information.

    val (-.) : float -> float -> float

    Floating-point subtraction. Left-associative operator, see Ocaml_operators for more information.

    val (*.) : float -> float -> float

    Floating-point multiplication. Left-associative operator, see Ocaml_operators for more information.

    val (/.) : float -> float -> float

    Floating-point division. Left-associative operator, see Ocaml_operators for more information.

    val (**) : float -> float -> float

    Exponentiation. Right-associative operator, see Ocaml_operators for more information.

    val sqrt : float -> float

    Square root.

    val exp : float -> float

    Exponential.

    val log : float -> float

    Natural logarithm.

    val log10 : float -> float

    Base 10 logarithm.

    val expm1 : float -> float

    expm1 x computes exp x -. 1.0, giving numerically-accurate results even if x is close to 0.0.

    • since 3.12.0
    val log1p : float -> float

    log1p x computes log(1.0 +. x) (natural logarithm), giving numerically-accurate results even if x is close to 0.0.

    • since 3.12.0
    val cos : float -> float

    Cosine. Argument is in radians.

    val sin : float -> float

    Sine. Argument is in radians.

    val tan : float -> float

    Tangent. Argument is in radians.

    val acos : float -> float

    Arc cosine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between 0.0 and pi.

    val asin : float -> float

    Arc sine. The argument must fall within the range [-1.0, 1.0]. Result is in radians and is between -pi/2 and pi/2.

    val atan : float -> float

    Arc tangent. Result is in radians and is between -pi/2 and pi/2.

    val atan2 : float -> float -> float

    atan2 y x returns the arc tangent of y /. x. The signs of x and y are used to determine the quadrant of the result. Result is in radians and is between -pi and pi.

    val hypot : float -> float -> float

    hypot x y returns sqrt(x *. x + y *. y), that is, the length of the hypotenuse of a right-angled triangle with sides of length x and y, or, equivalently, the distance of the point (x,y) to origin. If one of x or y is infinite, returns infinity even if the other is nan.

    • since 4.00.0
    val cosh : float -> float

    Hyperbolic cosine. Argument is in radians.

    val sinh : float -> float

    Hyperbolic sine. Argument is in radians.

    val tanh : float -> float

    Hyperbolic tangent. Argument is in radians.

    val acosh : float -> float

    Hyperbolic arc cosine. The argument must fall within the range [1.0, inf]. Result is in radians and is between 0.0 and inf.

    • since 4.13.0
    val asinh : float -> float

    Hyperbolic arc sine. The argument and result range over the entire real line. Result is in radians.

    • since 4.13.0
    val atanh : float -> float

    Hyperbolic arc tangent. The argument must fall within the range [-1.0, 1.0]. Result is in radians and ranges over the entire real line.

    • since 4.13.0
    val ceil : float -> float

    Round above to an integer value. ceil f returns the least integer value greater than or equal to f. The result is returned as a float.

    val floor : float -> float

    Round below to an integer value. floor f returns the greatest integer value less than or equal to f. The result is returned as a float.

    val abs_float : float -> float

    abs_float f returns the absolute value of f.

    val copysign : float -> float -> float

    copysign x y returns a float whose absolute value is that of x and whose sign is that of y. If x is nan, returns nan. If y is nan, returns either x or -. x, but it is not specified which.

    • since 4.00.0
    val mod_float : float -> float -> float

    mod_float a b returns the remainder of a with respect to b. The returned value is a -. n *. b, where n is the quotient a /. b rounded towards zero to an integer.

    val frexp : float -> float * int

    frexp f returns the pair of the significant and the exponent of f. When f is zero, the significant x and the exponent n of f are equal to zero. When f is non-zero, they are defined by f = x *. 2 ** n and 0.5 <= x < 1.0.

    val ldexp : float -> int -> float

    ldexp x n returns x *. 2 ** n.

    val modf : float -> float * float

    modf f returns the pair of the fractional and integral part of f.

    val float : int -> float
    val float_of_int : int -> float

    Convert an integer to floating-point.

    val truncate : float -> int
    val int_of_float : float -> int

    Truncate the given floating-point number to an integer. The result is unspecified if the argument is nan or falls outside the range of representable integers.

    val infinity : float

    Positive infinity.

    val neg_infinity : float

    Negative infinity.

    val nan : float

    A special floating-point value denoting the result of an undefined operation such as 0.0 /. 0.0. Stands for 'not a number'. Any floating-point operation with nan as argument returns nan as result. As for floating-point comparisons, =, <, <=, > and >= return false and <> returns true if one or both of their arguments is nan.

    val max_float : float

    The largest positive finite value of type float.

    val min_float : float

    The smallest positive, non-zero, non-denormalized value of type float.

    val epsilon_float : float

    The difference between 1.0 and the smallest exactly representable floating-point number greater than 1.0.

    type fpclass =
    1. | FP_normal
      (*

      Normal number, none of the below

      *)
    2. | FP_subnormal
      (*

      Number very close to 0.0, has reduced precision

      *)
    3. | FP_zero
      (*

      Number is 0.0 or -0.0

      *)
    4. | FP_infinite
      (*

      Number is positive or negative infinity

      *)
    5. | FP_nan
      (*

      Not a number: result of an undefined operation

      *)

    The five classes of floating-point numbers, as determined by the Stdlib.classify_float function.

    val classify_float : float -> fpclass

    Return the class of the given floating-point number: normal, subnormal, zero, infinite, or not a number.

    String operations

    More string operations are provided in module String.

    val (^) : string -> string -> string

    String concatenation. Right-associative operator, see Ocaml_operators for more information.

    Character operations

    More character operations are provided in module Char.

    val int_of_char : char -> int

    Return the ASCII code of the argument.

    val char_of_int : int -> char

    Return the character with the given ASCII code.

    • raises Invalid_argument

      if the argument is outside the range 0--255.

    Unit operations

    val ignore : 'a -> unit

    Discard the value of its argument and return (). For instance, ignore(f x) discards the result of the side-effecting function f. It is equivalent to f x; (), except that the latter may generate a compiler warning; writing ignore(f x) instead avoids the warning.

    String conversion functions

    val string_of_bool : bool -> string

    Return the string representation of a boolean. As the returned values may be shared, the user should not modify them directly.

    val bool_of_string_opt : string -> bool option

    Convert the given string to a boolean.

    Return None if the string is not "true" or "false".

    • since 4.05
    val bool_of_string : string -> bool

    Same as Stdlib.bool_of_string_opt, but raise Invalid_argument "bool_of_string" instead of returning None.

    val string_of_int : int -> string

    Return the string representation of an integer, in decimal.

    val int_of_string_opt : string -> int option

    Convert the given string to an integer. The string is read in decimal (by default, or if the string begins with 0u), in hexadecimal (if it begins with 0x or 0X), in octal (if it begins with 0o or 0O), or in binary (if it begins with 0b or 0B).

    The 0u prefix reads the input as an unsigned integer in the range [0, 2*max_int+1]. If the input exceeds max_int it is converted to the signed integer min_int + input - max_int - 1.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    Return None if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type int.

    • since 4.05
    val int_of_string : string -> int

    Same as Stdlib.int_of_string_opt, but raise Failure "int_of_string" instead of returning None.

    val string_of_float : float -> string

    Return a string representation of a floating-point number.

    This conversion can involve a loss of precision. For greater control over the manner in which the number is printed, see Printf.

    val float_of_string_opt : string -> float option

    Convert the given string to a float. The string is read in decimal (by default) or in hexadecimal (marked by 0x or 0X).

    The format of decimal floating-point numbers is [-] dd.ddd (e|E) [+|-] dd , where d stands for a decimal digit.

    The format of hexadecimal floating-point numbers is [-] 0(x|X) hh.hhh (p|P) [+|-] dd , where h stands for an hexadecimal digit and d for a decimal digit.

    In both cases, at least one of the integer and fractional parts must be given; the exponent part is optional.

    The _ (underscore) character can appear anywhere in the string and is ignored.

    Depending on the execution platforms, other representations of floating-point numbers can be accepted, but should not be relied upon.

    Return None if the given string is not a valid representation of a float.

    • since 4.05
    val float_of_string : string -> float

    Same as Stdlib.float_of_string_opt, but raise Failure "float_of_string" instead of returning None.

    Pair operations

    val fst : ('a * 'b) -> 'a

    Return the first component of a pair.

    val snd : ('a * 'b) -> 'b

    Return the second component of a pair.

    List operations

    More list operations are provided in module List.

    val (@) : 'a list -> 'a list -> 'a list

    List concatenation. Not tail-recursive (length of the first argument). Right-associative operator, see Ocaml_operators for more information.

    Input/output

    Note: all input/output functions can raise Sys_error when the system calls they invoke fail.

    type in_channel

    The type of input channel.

    type out_channel

    The type of output channel.

    val stdin : in_channel

    The standard input for the process.

    val stdout : out_channel

    The standard output for the process.

    val stderr : out_channel

    The standard error output for the process.

    Output functions on standard output

    val print_char : char -> unit

    Print a character on standard output.

    val print_string : string -> unit

    Print a string on standard output.

    val print_bytes : bytes -> unit

    Print a byte sequence on standard output.

    • since 4.02.0
    val print_int : int -> unit

    Print an integer, in decimal, on standard output.

    val print_float : float -> unit

    Print a floating-point number, in decimal, on standard output.

    The conversion of the number to a string uses string_of_float and can involve a loss of precision.

    val print_endline : string -> unit

    Print a string, followed by a newline character, on standard output and flush standard output.

    val print_newline : unit -> unit

    Print a newline character on standard output, and flush standard output. This can be used to simulate line buffering of standard output.

    Output functions on standard error

    val prerr_char : char -> unit

    Print a character on standard error.

    val prerr_string : string -> unit

    Print a string on standard error.

    val prerr_bytes : bytes -> unit

    Print a byte sequence on standard error.

    • since 4.02.0
    val prerr_int : int -> unit

    Print an integer, in decimal, on standard error.

    val prerr_float : float -> unit

    Print a floating-point number, in decimal, on standard error.

    The conversion of the number to a string uses string_of_float and can involve a loss of precision.

    val prerr_endline : string -> unit

    Print a string, followed by a newline character on standard error and flush standard error.

    val prerr_newline : unit -> unit

    Print a newline character on standard error, and flush standard error.

    Input functions on standard input

    val read_line : unit -> string

    Flush standard output, then read characters from standard input until a newline character is encountered.

    Return the string of all characters read, without the newline character at the end.

    • raises End_of_file

      if the end of the file is reached at the beginning of line.

    val read_int_opt : unit -> int option

    Flush standard output, then read one line from standard input and convert it to an integer.

    Return None if the line read is not a valid representation of an integer.

    • since 4.05
    val read_int : unit -> int

    Same as Stdlib.read_int_opt, but raise Failure "int_of_string" instead of returning None.

    val read_float_opt : unit -> float option

    Flush standard output, then read one line from standard input and convert it to a floating-point number.

    Return None if the line read is not a valid representation of a floating-point number.

    • since 4.05.0
    val read_float : unit -> float

    Same as Stdlib.read_float_opt, but raise Failure "float_of_string" instead of returning None.

    General output functions

    type open_flag =
    1. | Open_rdonly
      (*

      open for reading.

      *)
    2. | Open_wronly
      (*

      open for writing.

      *)
    3. | Open_append
      (*

      open for appending: always write at end of file.

      *)
    4. | Open_creat
      (*

      create the file if it does not exist.

      *)
    5. | Open_trunc
      (*

      empty the file if it already exists.

      *)
    6. | Open_excl
      (*

      fail if Open_creat and the file already exists.

      *)
    7. | Open_binary
      (*

      open in binary mode (no conversion).

      *)
    8. | Open_text
      (*

      open in text mode (may perform conversions).

      *)
    9. | Open_nonblock
      (*

      open in non-blocking mode.

      *)
    val open_out : string -> out_channel

    Open the named file for writing, and return a new output channel on that file, positioned at the beginning of the file. The file is truncated to zero length if it already exists. It is created if it does not already exists.

    val open_out_bin : string -> out_channel

    Same as Stdlib.open_out, but the file is opened in binary mode, so that no translation takes place during writes. On operating systems that do not distinguish between text mode and binary mode, this function behaves like Stdlib.open_out.

    val open_out_gen : open_flag list -> int -> string -> out_channel

    open_out_gen mode perm filename opens the named file for writing, as described above. The extra argument mode specifies the opening mode. The extra argument perm specifies the file permissions, in case the file must be created. Stdlib.open_out and Stdlib.open_out_bin are special cases of this function.

    val flush : out_channel -> unit

    Flush the buffer associated with the given output channel, performing all pending writes on that channel. Interactive programs must be careful about flushing standard output and standard error at the right time.

    val flush_all : unit -> unit

    Flush all open output channels; ignore errors.

    val output_char : out_channel -> char -> unit

    Write the character on the given output channel.

    val output_string : out_channel -> string -> unit

    Write the string on the given output channel.

    val output_bytes : out_channel -> bytes -> unit

    Write the byte sequence on the given output channel.

    • since 4.02.0
    val output : out_channel -> bytes -> int -> int -> unit

    output oc buf pos len writes len characters from byte sequence buf, starting at offset pos, to the given output channel oc.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val output_substring : out_channel -> string -> int -> int -> unit

    Same as output but take a string as argument instead of a byte sequence.

    • since 4.02.0
    val output_byte : out_channel -> int -> unit

    Write one 8-bit integer (as the single character with that code) on the given output channel. The given integer is taken modulo 256.

    val output_binary_int : out_channel -> int -> unit

    Write one integer in binary format (4 bytes, big-endian) on the given output channel. The given integer is taken modulo 232. The only reliable way to read it back is through the Stdlib.input_binary_int function. The format is compatible across all machines for a given version of OCaml.

    val output_value : out_channel -> 'a -> unit

    Write the representation of a structured value of any type to a channel. Circularities and sharing inside the value are detected and preserved. The object can be read back, by the function Stdlib.input_value. See the description of module Marshal for more information. Stdlib.output_value is equivalent to Marshal.to_channel with an empty list of flags.

    val seek_out : out_channel -> int -> unit

    seek_out chan pos sets the current writing position to pos for channel chan. This works only for regular files. On files of other kinds (such as terminals, pipes and sockets), the behavior is unspecified.

    val pos_out : out_channel -> int

    Return the current writing position for the given channel. Does not work on channels opened with the Open_append flag (returns unspecified results). For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos_out, then going back to this position using seek_out will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

    val out_channel_length : out_channel -> int

    Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless.

    val close_out : out_channel -> unit

    Close the given channel, flushing all buffered write operations. Output functions raise a Sys_error exception when they are applied to a closed output channel, except close_out and flush, which do nothing when applied to an already closed channel. Note that close_out may raise Sys_error if the operating system signals an error when flushing or closing.

    val close_out_noerr : out_channel -> unit

    Same as close_out, but ignore all errors.

    val set_binary_mode_out : out_channel -> bool -> unit

    set_binary_mode_out oc true sets the channel oc to binary mode: no translations take place during output. set_binary_mode_out oc false sets the channel oc to text mode: depending on the operating system, some translations may take place during output. For instance, under Windows, end-of-lines will be translated from \n to \r\n. This function has no effect under operating systems that do not distinguish between text mode and binary mode.

    General input functions

    val open_in : string -> in_channel

    Open the named file for reading, and return a new input channel on that file, positioned at the beginning of the file.

    val open_in_bin : string -> in_channel

    Same as Stdlib.open_in, but the file is opened in binary mode, so that no translation takes place during reads. On operating systems that do not distinguish between text mode and binary mode, this function behaves like Stdlib.open_in.

    val open_in_gen : open_flag list -> int -> string -> in_channel

    open_in_gen mode perm filename opens the named file for reading, as described above. The extra arguments mode and perm specify the opening mode and file permissions. Stdlib.open_in and Stdlib.open_in_bin are special cases of this function.

    val input_char : in_channel -> char

    Read one character from the given input channel.

    • raises End_of_file

      if there are no more characters to read.

    val input_line : in_channel -> string

    Read characters from the given input channel, until a newline character is encountered. Return the string of all characters read, without the newline character at the end.

    • raises End_of_file

      if the end of the file is reached at the beginning of line.

    val input : in_channel -> bytes -> int -> int -> int

    input ic buf pos len reads up to len characters from the given channel ic, storing them in byte sequence buf, starting at character number pos. It returns the actual number of characters read, between 0 and len (inclusive). A return value of 0 means that the end of file was reached. A return value between 0 and len exclusive means that not all requested len characters were read, either because no more characters were available at that time, or because the implementation found it convenient to do a partial read; input must be called again to read the remaining characters, if desired. (See also Stdlib.really_input for reading exactly len characters.) Exception Invalid_argument "input" is raised if pos and len do not designate a valid range of buf.

    val really_input : in_channel -> bytes -> int -> int -> unit

    really_input ic buf pos len reads len characters from channel ic, storing them in byte sequence buf, starting at character number pos.

    • raises End_of_file

      if the end of file is reached before len characters have been read.

    • raises Invalid_argument

      if pos and len do not designate a valid range of buf.

    val really_input_string : in_channel -> int -> string

    really_input_string ic len reads len characters from channel ic and returns them in a new string.

    • raises End_of_file

      if the end of file is reached before len characters have been read.

    • since 4.02.0
    val input_byte : in_channel -> int

    Same as Stdlib.input_char, but return the 8-bit integer representing the character.

    • raises End_of_file

      if the end of file was reached.

    val input_binary_int : in_channel -> int

    Read an integer encoded in binary format (4 bytes, big-endian) from the given input channel. See Stdlib.output_binary_int.

    • raises End_of_file

      if the end of file was reached while reading the integer.

    val input_value : in_channel -> 'a

    Read the representation of a structured value, as produced by Stdlib.output_value, and return the corresponding value. This function is identical to Marshal.from_channel; see the description of module Marshal for more information, in particular concerning the lack of type safety.

    val seek_in : in_channel -> int -> unit

    seek_in chan pos sets the current reading position to pos for channel chan. This works only for regular files. On files of other kinds, the behavior is unspecified.

    val pos_in : in_channel -> int

    Return the current reading position for the given channel. For files opened in text mode under Windows, the returned position is approximate (owing to end-of-line conversion); in particular, saving the current position with pos_in, then going back to this position using seek_in will not work. For this programming idiom to work reliably and portably, the file must be opened in binary mode.

    val in_channel_length : in_channel -> int

    Return the size (number of characters) of the regular file on which the given channel is opened. If the channel is opened on a file that is not a regular file, the result is meaningless. The returned size does not take into account the end-of-line translations that can be performed when reading from a channel opened in text mode.

    val close_in : in_channel -> unit

    Close the given channel. Input functions raise a Sys_error exception when they are applied to a closed input channel, except close_in, which does nothing when applied to an already closed channel.

    val close_in_noerr : in_channel -> unit

    Same as close_in, but ignore all errors.

    val set_binary_mode_in : in_channel -> bool -> unit

    set_binary_mode_in ic true sets the channel ic to binary mode: no translations take place during input. set_binary_mode_out ic false sets the channel ic to text mode: depending on the operating system, some translations may take place during input. For instance, under Windows, end-of-lines will be translated from \r\n to \n. This function has no effect under operating systems that do not distinguish between text mode and binary mode.

    Operations on large files

    module LargeFile : sig ... end

    Operations on large files. This sub-module provides 64-bit variants of the channel functions that manipulate file positions and file sizes. By representing positions and sizes by 64-bit integers (type int64) instead of regular integers (type int), these alternate functions allow operating on files whose sizes are greater than max_int.

    References

    type 'a ref = {
    1. mutable contents : 'a;
    }

    The type of references (mutable indirection cells) containing a value of type 'a.

    val ref : 'a -> 'a ref

    Return a fresh reference containing the given value.

    val (!) : 'a ref -> 'a

    !r returns the current contents of reference r. Equivalent to fun r -> r.contents. Unary operator, see Ocaml_operators for more information.

    val (:=) : 'a ref -> 'a -> unit

    r := a stores the value of a in reference r. Equivalent to fun r v -> r.contents <- v. Right-associative operator, see Ocaml_operators for more information.

    val incr : int ref -> unit

    Increment the integer contained in the given reference. Equivalent to fun r -> r := succ !r.

    val decr : int ref -> unit

    Decrement the integer contained in the given reference. Equivalent to fun r -> r := pred !r.

    Result type

    type ('a, 'b) result =
    1. | Ok of 'a
    2. | Error of 'b
    • since 4.03.0

    Operations on format strings

    Format strings are character strings with special lexical conventions that defines the functionality of formatted input/output functions. Format strings are used to read data with formatted input functions from module Scanf and to print data with formatted output functions from modules Printf and Format.

    Format strings are made of three kinds of entities:

    • conversions specifications, introduced by the special character '%' followed by one or more characters specifying what kind of argument to read or print,
    • formatting indications, introduced by the special character '@' followed by one or more characters specifying how to read or print the argument,
    • plain characters that are regular characters with usual lexical conventions. Plain characters specify string literals to be read in the input or printed in the output.

    There is an additional lexical rule to escape the special characters '%' and '@' in format strings: if a special character follows a '%' character, it is treated as a plain character. In other words, "%%" is considered as a plain '%' and "%@" as a plain '@'.

    For more information about conversion specifications and formatting indications available, read the documentation of modules Scanf, Printf and Format.

    Format strings have a general and highly polymorphic type ('a, 'b, 'c, 'd, 'e, 'f) format6. The two simplified types, format and format4 below are included for backward compatibility with earlier releases of OCaml.

    The meaning of format string type parameters is as follows:

    • 'a is the type of the parameters of the format for formatted output functions (printf-style functions); 'a is the type of the values read by the format for formatted input functions (scanf-style functions).
    • 'b is the type of input source for formatted input functions and the type of output target for formatted output functions. For printf-style functions from module Printf, 'b is typically out_channel; for printf-style functions from module Format, 'b is typically Format.formatter; for scanf-style functions from module Scanf, 'b is typically Scanf.Scanning.in_channel.

    Type argument 'b is also the type of the first argument given to user's defined printing functions for %a and %t conversions, and user's defined reading functions for %r conversion.

    • 'c is the type of the result of the %a and %t printing functions, and also the type of the argument transmitted to the first argument of kprintf-style functions or to the kscanf-style functions.
    • 'd is the type of parameters for the scanf-style functions.
    • 'e is the type of the receiver function for the scanf-style functions.
    • 'f is the final result type of a formatted input/output function invocation: for the printf-style functions, it is typically unit; for the scanf-style functions, it is typically the result type of the receiver function.
    type ('a, 'b, 'c, 'd, 'e, 'f) format6 = ('a, 'b, 'c, 'd, 'e, 'f) CamlinternalFormatBasics.format6
    type ('a, 'b, 'c, 'd) format4 = ('a, 'b, 'c, 'c, 'c, 'd) format6
    type ('a, 'b, 'c) format = ('a, 'b, 'c, 'c) format4
    val string_of_format : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> string

    Converts a format string into a string.

    val format_of_string : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('a, 'b, 'c, 'd, 'e, 'f) format6

    format_of_string s returns a format string read from the string literal s. Note: format_of_string can not convert a string argument that is not a literal. If you need this functionality, use the more general Scanf.format_from_string function.

    val (^^) : ('a, 'b, 'c, 'd, 'e, 'f) format6 -> ('f, 'b, 'c, 'e, 'g, 'h) format6 -> - ('a, 'b, 'c, 'd, 'g, 'h) format6

    f1 ^^ f2 catenates format strings f1 and f2. The result is a format string that behaves as the concatenation of format strings f1 and f2: in case of formatted output, it accepts arguments from f1, then arguments from f2; in case of formatted input, it returns results from f1, then results from f2. Right-associative operator, see Ocaml_operators for more information.

    Program termination

    val exit : int -> 'a

    Terminate the process, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. All open output channels are flushed with flush_all. An implicit exit 0 is performed each time a program terminates normally. An implicit exit 2 is performed if the program terminates early because of an uncaught exception.

    val at_exit : (unit -> unit) -> unit

    Register the given function to be called at program termination time. The functions registered with at_exit will be called when the program does any of the following:

    • executes Stdlib.exit
    • terminates, either normally or because of an uncaught exception
    • executes the C function caml_shutdown. The functions are called in 'last in, first out' order: the function most recently added with at_exit is called first.

    Standard library modules

    module Arg : sig ... end

    Parsing of command line arguments.

    module Array : sig ... end

    Array operations.

    module ArrayLabels : sig ... end

    Array operations.

    module Atomic : sig ... end

    This module provides a purely sequential implementation of the concurrent atomic references provided by the Multicore OCaml standard library:

    module Bigarray : sig ... end

    Large, multi-dimensional, numerical arrays.

    module Bool : sig ... end

    Boolean values.

    module Buffer : sig ... end

    Extensible buffers.

    module Bytes : sig ... end

    Byte sequence operations.

    module BytesLabels : sig ... end

    Byte sequence operations.

    module Callback : sig ... end

    Registering OCaml values with the C runtime.

    module Char : sig ... end

    Character operations.

    module Complex : sig ... end

    Complex numbers.

    module Digest : sig ... end

    MD5 message digest.

    module Either : sig ... end

    Either type.

    module Ephemeron : sig ... end

    Ephemerons and weak hash tables.

    module Filename : sig ... end

    Operations on file names.

    module Float : sig ... end

    Floating-point arithmetic.

    module Format : sig ... end

    Pretty-printing.

    module Fun : sig ... end

    Function manipulation.

    module Gc : sig ... end

    Memory management control and statistics; finalised values.

    module Genlex : sig ... end
    module Hashtbl : sig ... end

    Hash tables and hash functions.

    module In_channel : sig ... end

    Input channels.

    module Int : sig ... end

    Integer values.

    module Int32 : sig ... end

    32-bit integers.

    module Int64 : sig ... end

    64-bit integers.

    module Lazy : sig ... end

    Deferred computations.

    module Lexing : sig ... end

    The run-time library for lexers generated by ocamllex.

    module List : sig ... end

    List operations.

    module ListLabels : sig ... end

    List operations.

    module Map : sig ... end

    Association tables over ordered types.

    module Marshal : sig ... end

    Marshaling of data structures.

    module MoreLabels : sig ... end

    Extra labeled libraries.

    module Nativeint : sig ... end

    Processor-native integers.

    module Obj : sig ... end

    Operations on internal representations of values.

    module Oo : sig ... end

    Operations on objects

    module Option : sig ... end

    Option values.

    module Out_channel : sig ... end

    Output channels.

    module Parsing : sig ... end

    The run-time library for parsers generated by ocamlyacc.

    module Pervasives : sig ... end
    module Printexc : sig ... end

    Facilities for printing exceptions and inspecting current call stack.

    module Printf : sig ... end

    Formatted output functions.

    module Queue : sig ... end

    First-in first-out queues.

    module Random : sig ... end

    Pseudo-random number generators (PRNG).

    module Result : sig ... end

    Result values.

    module Scanf : sig ... end

    Formatted input functions.

    module Seq : sig ... end

    Sequences.

    module Set : sig ... end

    Sets over ordered types.

    module Stack : sig ... end

    Last-in first-out stacks.

    module StdLabels : sig ... end

    Standard labeled libraries.

    module Stream : sig ... end
    module String : sig ... end

    Strings.

    module StringLabels : sig ... end

    Strings.

    module Sys : sig ... end

    System interface.

    module Uchar : sig ... end

    Unicode characters.

    module Unit : sig ... end

    Unit values.

    module Weak : sig ... end

    Arrays of weak pointers and hash sets of weak pointers.

    \ No newline at end of file + ('a, 'b, 'c, 'd, 'g, 'h) format6

    f1 ^^ f2 catenates format strings f1 and f2. The result is a format string that behaves as the concatenation of format strings f1 and f2: in case of formatted output, it accepts arguments from f1, then arguments from f2; in case of formatted input, it returns results from f1, then results from f2. Right-associative operator, see Ocaml_operators for more information.

    Program termination

    val exit : int -> 'a

    Terminate the process, returning the given status code to the operating system: usually 0 to indicate no errors, and a small positive integer to indicate failure. All open output channels are flushed with flush_all. The callbacks registered with Domain.at_exit are called followed by those registered with Stdlib.at_exit.

    An implicit exit 0 is performed each time a program terminates normally. An implicit exit 2 is performed if the program terminates early because of an uncaught exception.

    val at_exit : (unit -> unit) -> unit

    Register the given function to be called at program termination time. The functions registered with at_exit will be called when the program does any of the following:

    • executes Stdlib.exit
    • terminates, either normally or because of an uncaught exception
    • executes the C function caml_shutdown. The functions are called in 'last in, first out' order: the function most recently added with at_exit is called first.

    Standard library modules

    module Arg : sig ... end

    Parsing of command line arguments.

    module Array : sig ... end

    Array operations.

    module ArrayLabels : sig ... end

    Array operations.

    module Atomic : sig ... end

    Atomic references.

    module Bigarray : sig ... end

    Large, multi-dimensional, numerical arrays.

    module Bool : sig ... end

    Boolean values.

    module Buffer : sig ... end

    Extensible buffers.

    module Bytes : sig ... end

    Byte sequence operations.

    module BytesLabels : sig ... end

    Byte sequence operations.

    module Callback : sig ... end

    Registering OCaml values with the C runtime.

    module Char : sig ... end

    Character operations.

    module Complex : sig ... end

    Complex numbers.

    module Condition : sig ... end

    Condition variables.

    module Digest : sig ... end

    MD5 message digest.

    module Domain : sig ... end
    module Effect : sig ... end
    module Either : sig ... end

    Either type.

    module Ephemeron : sig ... end

    Ephemerons and weak hash tables.

    module Filename : sig ... end

    Operations on file names.

    module Float : sig ... end

    Floating-point arithmetic.

    module Format : sig ... end

    Pretty-printing.

    module Fun : sig ... end

    Function manipulation.

    module Gc : sig ... end

    Memory management control and statistics; finalised values.

    module Hashtbl : sig ... end

    Hash tables and hash functions.

    module In_channel : sig ... end

    Input channels.

    module Int : sig ... end

    Integer values.

    module Int32 : sig ... end

    32-bit integers.

    module Int64 : sig ... end

    64-bit integers.

    module Lazy : sig ... end

    Deferred computations.

    module Lexing : sig ... end

    The run-time library for lexers generated by ocamllex.

    module List : sig ... end

    List operations.

    module ListLabels : sig ... end

    List operations.

    module Map : sig ... end

    Association tables over ordered types.

    module Marshal : sig ... end

    Marshaling of data structures.

    module MoreLabels : sig ... end

    Extra labeled libraries.

    module Mutex : sig ... end

    Locks for mutual exclusion.

    module Nativeint : sig ... end

    Processor-native integers.

    module Obj : sig ... end

    Operations on internal representations of values.

    module Oo : sig ... end

    Operations on objects

    module Option : sig ... end

    Option values.

    module Out_channel : sig ... end

    Output channels.

    module Parsing : sig ... end

    The run-time library for parsers generated by ocamlyacc.

    module Printexc : sig ... end

    Facilities for printing exceptions and inspecting current call stack.

    module Printf : sig ... end

    Formatted output functions.

    module Queue : sig ... end

    First-in first-out queues.

    module Random : sig ... end

    Pseudo-random number generators (PRNG).

    module Result : sig ... end

    Result values.

    module Scanf : sig ... end

    Formatted input functions.

    module Semaphore : sig ... end

    Semaphores

    module Seq : sig ... end

    Sequences.

    module Set : sig ... end

    Sets over ordered types.

    module Stack : sig ... end

    Last-in first-out stacks.

    module StdLabels : sig ... end

    Standard labeled libraries.

    module String : sig ... end

    Strings.

    module StringLabels : sig ... end

    Strings.

    module Sys : sig ... end

    System interface.

    module Uchar : sig ... end

    Unicode characters.

    module Unit : sig ... end

    Unit values.

    module Weak : sig ... end

    Arrays of weak pointers and hash sets of weak pointers.

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib__Condition/index.html b/dev/ocaml/Stdlib__Condition/index.html new file mode 100644 index 00000000..f03d538a --- /dev/null +++ b/dev/ocaml/Stdlib__Condition/index.html @@ -0,0 +1,2 @@ + +Stdlib__Condition (ocaml.Stdlib__Condition)

    Module Stdlib__Condition

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib__Genlex/index.html b/dev/ocaml/Stdlib__Domain/index.html similarity index 72% rename from dev/ocaml/Stdlib__Genlex/index.html rename to dev/ocaml/Stdlib__Domain/index.html index 25d2601a..d1dbe5ba 100644 --- a/dev/ocaml/Stdlib__Genlex/index.html +++ b/dev/ocaml/Stdlib__Domain/index.html @@ -1,2 +1,2 @@ -Stdlib__Genlex (ocaml.Stdlib__Genlex)

    Module Stdlib__Genlex

    \ No newline at end of file +Stdlib__Domain (ocaml.Stdlib__Domain)

    Module Stdlib__Domain

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib__Stream/index.html b/dev/ocaml/Stdlib__Effect/index.html similarity index 72% rename from dev/ocaml/Stdlib__Stream/index.html rename to dev/ocaml/Stdlib__Effect/index.html index f344f4d8..6e295b0e 100644 --- a/dev/ocaml/Stdlib__Stream/index.html +++ b/dev/ocaml/Stdlib__Effect/index.html @@ -1,2 +1,2 @@ -Stdlib__Stream (ocaml.Stdlib__Stream)

    Module Stdlib__Stream

    \ No newline at end of file +Stdlib__Effect (ocaml.Stdlib__Effect)

    Module Stdlib__Effect

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib__Mutex/index.html b/dev/ocaml/Stdlib__Mutex/index.html new file mode 100644 index 00000000..047474b0 --- /dev/null +++ b/dev/ocaml/Stdlib__Mutex/index.html @@ -0,0 +1,2 @@ + +Stdlib__Mutex (ocaml.Stdlib__Mutex)

    Module Stdlib__Mutex

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib__Pervasives/index.html b/dev/ocaml/Stdlib__Pervasives/index.html deleted file mode 100644 index 1ff6addd..00000000 --- a/dev/ocaml/Stdlib__Pervasives/index.html +++ /dev/null @@ -1,2 +0,0 @@ - -Stdlib__Pervasives (ocaml.Stdlib__Pervasives)

    Module Stdlib__Pervasives

    \ No newline at end of file diff --git a/dev/ocaml/Stdlib__Semaphore/index.html b/dev/ocaml/Stdlib__Semaphore/index.html new file mode 100644 index 00000000..7027947c --- /dev/null +++ b/dev/ocaml/Stdlib__Semaphore/index.html @@ -0,0 +1,2 @@ + +Stdlib__Semaphore (ocaml.Stdlib__Semaphore)

    Module Stdlib__Semaphore

    \ No newline at end of file diff --git a/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Map/index.html b/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Map/index.html index ee14f878..efb429c1 100644 --- a/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Map/index.html +++ b/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Set/index.html b/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Set/index.html index c6e7fd09..6247bc4d 100644 --- a/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Set/index.html +++ b/dev/ocaml/Strongly_connected_components/Make/argument-1-Id/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Strongly_connected_components.Make.Id.Set)

    Module Id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Strongly_connected_components.Make.Id.Set)

    Module Id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Strongly_connected_components/module-type-S/Id/Map/index.html b/dev/ocaml/Strongly_connected_components/module-type-S/Id/Map/index.html index e43cf323..f80fecf5 100644 --- a/dev/ocaml/Strongly_connected_components/module-type-S/Id/Map/index.html +++ b/dev/ocaml/Strongly_connected_components/module-type-S/Id/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Strongly_connected_components/module-type-S/Id/Set/index.html b/dev/ocaml/Strongly_connected_components/module-type-S/Id/Set/index.html index 53f63fbc..8841afb4 100644 --- a/dev/ocaml/Strongly_connected_components/module-type-S/Id/Set/index.html +++ b/dev/ocaml/Strongly_connected_components/module-type-S/Id/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Strongly_connected_components.S.Id.Set)

    Module Id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Strongly_connected_components.S.Id.Set)

    Module Id.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Symbol/Map/index.html b/dev/ocaml/Symbol/Map/index.html index 7faeb9a5..8da646c9 100644 --- a/dev/ocaml/Symbol/Map/index.html +++ b/dev/ocaml/Symbol/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Symbol/Set/index.html b/dev/ocaml/Symbol/Set/index.html index 663f523a..03b642ac 100644 --- a/dev/ocaml/Symbol/Set/index.html +++ b/dev/ocaml/Symbol/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Symbol.Set)

    Module Symbol.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Symbol.Set)

    Module Symbol.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Syntaxerr/index.html b/dev/ocaml/Syntaxerr/index.html index 0945b83d..3f7e6569 100644 --- a/dev/ocaml/Syntaxerr/index.html +++ b/dev/ocaml/Syntaxerr/index.html @@ -1,2 +1,2 @@ -Syntaxerr (ocaml.Syntaxerr)

    Module Syntaxerr

    Auxiliary type for reporting syntax errors

    Warning: this module is unstable and part of compiler-libs.

    type error =
    1. | Unclosed of Location.t * string * Location.t * string
    2. | Expecting of Location.t * string
    3. | Not_expecting of Location.t * string
    4. | Applicative_path of Location.t
    5. | Variable_in_scope of Location.t * string
    6. | Other of Location.t
    7. | Ill_formed_ast of Location.t * string
    8. | Invalid_package_type of Location.t * string
    exception Error of error
    exception Escape_error
    val location_of_error : error -> Location.t
    val ill_formed_ast : Location.t -> string -> 'a
    \ No newline at end of file +Syntaxerr (ocaml.Syntaxerr)

    Module Syntaxerr

    Auxiliary type for reporting syntax errors

    Warning: this module is unstable and part of compiler-libs.

    type error =
    1. | Unclosed of Location.t * string * Location.t * string
    2. | Expecting of Location.t * string
    3. | Not_expecting of Location.t * string
    4. | Applicative_path of Location.t
    5. | Variable_in_scope of Location.t * string
    6. | Other of Location.t
    7. | Ill_formed_ast of Location.t * string
    8. | Invalid_package_type of Location.t * string
    9. | Removed_string_set of Location.t
    exception Error of error
    exception Escape_error
    val location_of_error : error -> Location.t
    val ill_formed_ast : Location.t -> string -> 'a
    \ No newline at end of file diff --git a/dev/ocaml/Tag/Map/index.html b/dev/ocaml/Tag/Map/index.html index 1a38ad78..662a5f2f 100644 --- a/dev/ocaml/Tag/Map/index.html +++ b/dev/ocaml/Tag/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Tag/Set/index.html b/dev/ocaml/Tag/Set/index.html index 955c5d81..bc4525b4 100644 --- a/dev/ocaml/Tag/Set/index.html +++ b/dev/ocaml/Tag/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Tag.Set)

    Module Tag.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Tag.Set)

    Module Tag.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Targetint/index.html b/dev/ocaml/Targetint/index.html index d84e0efd..a8f985b8 100644 --- a/dev/ocaml/Targetint/index.html +++ b/dev/ocaml/Targetint/index.html @@ -1,3 +1,3 @@ Targetint (ocaml.Targetint)

    Module Targetint

    Target processor-native integers.

    This module provides operations on the type of signed 32-bit integers (on 32-bit target platforms) or signed 64-bit integers (on 64-bit target platforms). This integer type has exactly the same width as that of a pointer type in the C compiler. All arithmetic operations over are taken modulo 232 or 264 depending on the word size of the target architecture.

    Warning: this module is unstable and part of compiler-libs.

    type t

    The type of target integers.

    val zero : t

    The target integer 0.

    val one : t

    The target integer 1.

    val minus_one : t

    The target integer -1.

    val neg : t -> t

    Unary negation.

    val add : t -> t -> t

    Addition.

    val sub : t -> t -> t

    Subtraction.

    val mul : t -> t -> t

    Multiplication.

    val div : t -> t -> t

    Integer division. Raise Division_by_zero if the second argument is zero. This division rounds the real quotient of its arguments towards zero, as specified for Stdlib.(/).

    val unsigned_div : t -> t -> t

    Same as div, except that arguments and result are interpreted as unsigned integers.

    val rem : t -> t -> t

    Integer remainder. If y is not zero, the result of Targetint.rem x y satisfies the following properties: Targetint.zero <= Nativeint.rem x y < Targetint.abs y and x = Targetint.add (Targetint.mul (Targetint.div x y) y) - (Targetint.rem x y). If y = 0, Targetint.rem x y raises Division_by_zero.

    val unsigned_rem : t -> t -> t

    Same as rem, except that arguments and result are interpreted as unsigned integers.

    val succ : t -> t

    Successor. Targetint.succ x is Targetint.add x Targetint.one.

    val pred : t -> t

    Predecessor. Targetint.pred x is Targetint.sub x Targetint.one.

    val abs : t -> t

    Return the absolute value of its argument.

    val size : int

    The size in bits of a target native integer.

    val max_int : t

    The greatest representable target integer, either 231 - 1 on a 32-bit platform, or 263 - 1 on a 64-bit platform.

    val min_int : t

    The smallest representable target integer, either -231 on a 32-bit platform, or -263 on a 64-bit platform.

    val logand : t -> t -> t

    Bitwise logical and.

    val logor : t -> t -> t

    Bitwise logical or.

    val logxor : t -> t -> t

    Bitwise logical exclusive or.

    val lognot : t -> t

    Bitwise logical negation.

    val shift_left : t -> int -> t

    Targetint.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

    val shift_right : t -> int -> t

    Targetint.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

    val shift_right_logical : t -> int -> t

    Targetint.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

    val of_int : int -> t

    Convert the given integer (type int) to a target integer (type t), module the target word size.

    val of_int_exn : int -> t

    Convert the given integer (type int) to a target integer (type t). Raises a fatal error if the conversion is not exact.

    val to_int : t -> int

    Convert the given target integer (type t) to an integer (type int). The high-order bit is lost during the conversion.

    val of_float : float -> t

    Convert the given floating-point number to a target integer, discarding the fractional part (truncate towards 0). The result of the conversion is undefined if, after truncation, the number is outside the range [Targetint.min_int, Targetint.max_int].

    val to_float : t -> float

    Convert the given target integer to a floating-point number.

    val of_int32 : int32 -> t

    Convert the given 32-bit integer (type int32) to a target integer.

    val to_int32 : t -> int32

    Convert the given target integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.

    val of_int64 : int64 -> t

    Convert the given 64-bit integer (type int64) to a target integer.

    val to_int64 : t -> int64

    Convert the given target integer to a 64-bit integer (type int64).

    val of_string : string -> t

    Convert the given string to a target integer. The string is read in decimal (by default) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively. Raise Failure "int_of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type nativeint.

    val to_string : t -> string

    Return the string representation of its argument, in decimal.

    val compare : t -> t -> int

    The comparison function for target integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Targetint to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned integers.

    val equal : t -> t -> bool

    The equal function for target ints.

    type repr =
    1. | Int32 of int32
    2. | Int64 of int64
    val repr : t -> repr

    The concrete representation of a native integer.

    val print : Stdlib.Format.formatter -> t -> unit

    Print a target integer to a formatter.

    \ No newline at end of file + (Targetint.rem x y)
    . If y = 0, Targetint.rem x y raises Division_by_zero.

    val unsigned_rem : t -> t -> t

    Same as rem, except that arguments and result are interpreted as unsigned integers.

    val succ : t -> t

    Successor. Targetint.succ x is Targetint.add x Targetint.one.

    val pred : t -> t

    Predecessor. Targetint.pred x is Targetint.sub x Targetint.one.

    val abs : t -> t

    abs x is the absolute value of x. On min_int this is min_int itself and thus remains negative.

    val size : int

    The size in bits of a target native integer.

    val max_int : t

    The greatest representable target integer, either 231 - 1 on a 32-bit platform, or 263 - 1 on a 64-bit platform.

    val min_int : t

    The smallest representable target integer, either -231 on a 32-bit platform, or -263 on a 64-bit platform.

    val logand : t -> t -> t

    Bitwise logical and.

    val logor : t -> t -> t

    Bitwise logical or.

    val logxor : t -> t -> t

    Bitwise logical exclusive or.

    val lognot : t -> t

    Bitwise logical negation.

    val shift_left : t -> int -> t

    Targetint.shift_left x y shifts x to the left by y bits. The result is unspecified if y < 0 or y >= bitsize, where bitsize is 32 on a 32-bit platform and 64 on a 64-bit platform.

    val shift_right : t -> int -> t

    Targetint.shift_right x y shifts x to the right by y bits. This is an arithmetic shift: the sign bit of x is replicated and inserted in the vacated bits. The result is unspecified if y < 0 or y >= bitsize.

    val shift_right_logical : t -> int -> t

    Targetint.shift_right_logical x y shifts x to the right by y bits. This is a logical shift: zeroes are inserted in the vacated bits regardless of the sign of x. The result is unspecified if y < 0 or y >= bitsize.

    val of_int : int -> t

    Convert the given integer (type int) to a target integer (type t), module the target word size.

    val of_int_exn : int -> t

    Convert the given integer (type int) to a target integer (type t). Raises a fatal error if the conversion is not exact.

    val to_int : t -> int

    Convert the given target integer (type t) to an integer (type int). The high-order bit is lost during the conversion.

    val of_float : float -> t

    Convert the given floating-point number to a target integer, discarding the fractional part (truncate towards 0). The result of the conversion is undefined if, after truncation, the number is outside the range [Targetint.min_int, Targetint.max_int].

    val to_float : t -> float

    Convert the given target integer to a floating-point number.

    val of_int32 : int32 -> t

    Convert the given 32-bit integer (type int32) to a target integer.

    val to_int32 : t -> int32

    Convert the given target integer to a 32-bit integer (type int32). On 64-bit platforms, the 64-bit native integer is taken modulo 232, i.e. the top 32 bits are lost. On 32-bit platforms, the conversion is exact.

    val of_int64 : int64 -> t

    Convert the given 64-bit integer (type int64) to a target integer.

    val to_int64 : t -> int64

    Convert the given target integer to a 64-bit integer (type int64).

    val of_string : string -> t

    Convert the given string to a target integer. The string is read in decimal (by default) or in hexadecimal, octal or binary if the string begins with 0x, 0o or 0b respectively. Raise Failure "int_of_string" if the given string is not a valid representation of an integer, or if the integer represented exceeds the range of integers representable in type nativeint.

    val to_string : t -> string

    Return the string representation of its argument, in decimal.

    val compare : t -> t -> int

    The comparison function for target integers, with the same specification as Stdlib.compare. Along with the type t, this function compare allows the module Targetint to be passed as argument to the functors Set.Make and Map.Make.

    val unsigned_compare : t -> t -> int

    Same as compare, except that arguments are interpreted as unsigned integers.

    val equal : t -> t -> bool

    The equal function for target ints.

    type repr =
    1. | Int32 of int32
    2. | Int64 of int64
    val repr : t -> repr

    The concrete representation of a native integer.

    val print : Stdlib.Format.formatter -> t -> unit

    Print a target integer to a formatter.

    \ No newline at end of file diff --git a/dev/ocaml/Thread/index.html b/dev/ocaml/Thread/index.html index db56854a..ec5116d4 100644 --- a/dev/ocaml/Thread/index.html +++ b/dev/ocaml/Thread/index.html @@ -1,7 +1,7 @@ -Thread (ocaml.Thread)

    Module Thread

    Lightweight threads for Posix 1003.1c and Win32.

    type t

    The type of thread handles.

    Thread creation and termination

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

    Thread.create funct arg creates a new thread of control, in which the function application funct arg is executed concurrently with the other threads of the program. The application of Thread.create returns the handle of the newly created thread. The new thread terminates when the application funct arg returns, either normally or by raising the Thread.Exit exception or by raising any other uncaught exception. In the last case, the uncaught exception is printed on standard error, but not propagated back to the parent thread. Similarly, the result of the application funct arg is discarded and not directly accessible to the parent thread.

    val self : unit -> t

    Return the handle for the thread currently executing.

    val id : t -> int

    Return the identifier of the given thread. A thread identifier is an integer that identifies uniquely the thread. It can be used to build data structures indexed by threads.

    exception Exit

    Exception that can be raised by user code to initiate termination of the current thread. Compared to calling the Thread.exit function, raising the Thread.Exit exception will trigger Fun.finally finalizers and catch-all exception handlers. It is the recommended way to terminate threads prematurely.

    • since 4.14.0
    val exit : unit -> unit

    Terminate prematurely the currently executing thread.

    val kill : t -> unit

    This function was supposed to terminate prematurely the thread whose handle is given. It is not currently implemented due to problems with cleanup handlers on many POSIX 1003.1c implementations. It always raises the Invalid_argument exception.

    • deprecated Not implemented, do not use

    Suspending threads

    val delay : float -> unit

    delay d suspends the execution of the calling thread for d seconds. The other program threads continue to run during this time.

    val join : t -> unit

    join th suspends the execution of the calling thread until the thread th has terminated.

    val yield : unit -> unit

    Re-schedule the calling thread without suspending it. This function can be used to give scheduling hints, telling the scheduler that now is a good time to switch to other threads.

    Waiting for file descriptors or processes

    The functions below are leftovers from an earlier, VM-based threading system. The Unix module provides equivalent functionality, in a more general and more standard-conformant manner. It is recommended to use Unix functions directly.

    val wait_read : Unix.file_descr -> unit

    This function does nothing in the current implementation of the threading library and can be removed from all user programs.

    • deprecated This function no longer does anything
    val wait_write : Unix.file_descr -> unit

    This function does nothing in the current implementation of the threading library and can be removed from all user programs.

    • deprecated This function no longer does anything
    val wait_timed_read : Unix.file_descr -> float -> bool
    val wait_timed_write : Unix.file_descr -> float -> bool

    Suspend the execution of the calling thread until at least one character or EOF is available for reading (wait_timed_read) or one character can be written without blocking (wait_timed_write) on the given Unix file descriptor. Wait for at most the amount of time given as second argument (in seconds). Return true if the file descriptor is ready for input/output and false if the timeout expired. The same functionality can be achieved with Unix.select.

    val select : +Thread (ocaml.Thread)

    Module Thread

    Lightweight threads for Posix 1003.1c and Win32.

    type t

    The type of thread handles.

    Thread creation and termination

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

    Thread.create funct arg creates a new thread of control, in which the function application funct arg is executed concurrently with the other threads of the domain. The application of Thread.create returns the handle of the newly created thread. The new thread terminates when the application funct arg returns, either normally or by raising the Thread.Exit exception or by raising any other uncaught exception. In the last case, the uncaught exception is printed on standard error, but not propagated back to the parent thread. Similarly, the result of the application funct arg is discarded and not directly accessible to the parent thread.

    See also Domain.spawn if you want parallel execution instead.

    val self : unit -> t

    Return the handle for the thread currently executing.

    val id : t -> int

    Return the identifier of the given thread. A thread identifier is an integer that identifies uniquely the thread. It can be used to build data structures indexed by threads.

    exception Exit

    Exception raised by user code to initiate termination of the current thread. In a thread created by Thread.create funct arg, if the Thread.Exit exception reaches the top of the application funct arg, it has the effect of terminating the current thread silently. In other contexts, there is no implicit handling of the Thread.Exit exception.

    val exit : unit -> unit

    Raise the Thread.Exit exception. In a thread created by Thread.create, this will cause the thread to terminate prematurely, unless the thread function handles the exception itself. Fun.protect finalizers and catch-all exception handlers will be executed.

    To make it clear that an exception is raised and will trigger finalizers and catch-all exception handlers, it is recommended to write raise Thread.Exit instead of Thread.exit ().

    • before 5.0

      A different implementation was used, not based on raising an exception, and not running finalizers and catch-all handlers. The previous implementation had a different behavior when called outside of a thread created by Thread.create.

    • deprecated Use 'raise Thread.Exit' instead.

    Suspending threads

    val delay : float -> unit

    delay d suspends the execution of the calling thread for d seconds. The other program threads continue to run during this time.

    val join : t -> unit

    join th suspends the execution of the calling thread until the thread th has terminated.

    val yield : unit -> unit

    Re-schedule the calling thread without suspending it. This function can be used to give scheduling hints, telling the scheduler that now is a good time to switch to other threads.

    Waiting for file descriptors or processes

    The functions below are leftovers from an earlier, VM-based threading system. The Unix module provides equivalent functionality, in a more general and more standard-conformant manner. It is recommended to use Unix functions directly.

    val wait_timed_read : Unix.file_descr -> float -> bool

    See Thread.wait_timed_write.

    • deprecated Use Unix.select instead.
    val wait_timed_write : Unix.file_descr -> float -> bool

    Suspend the execution of the calling thread until at least one character or EOF is available for reading (wait_timed_read) or one character can be written without blocking (wait_timed_write) on the given Unix file descriptor. Wait for at most the amount of time given as second argument (in seconds). Return true if the file descriptor is ready for input/output and false if the timeout expired. The same functionality can be achieved with Unix.select.

    • deprecated Use Unix.select instead.
    val select : Unix.file_descr list -> Unix.file_descr list -> Unix.file_descr list -> float -> - Unix.file_descr list * Unix.file_descr list * Unix.file_descr list

    Same function as Unix.select. Suspend the execution of the calling thread until input/output becomes possible on the given Unix file descriptors. The arguments and results have the same meaning as for Unix.select.

    val wait_pid : int -> int * Unix.process_status

    Same function as Unix.waitpid. wait_pid p suspends the execution of the calling thread until the process specified by the process identifier p terminates. Returns the pid of the child caught and its termination status, as per Unix.wait.

    Management of signals

    Signal handling follows the POSIX thread model: signals generated by a thread are delivered to that thread; signals generated externally are delivered to one of the threads that does not block it. Each thread possesses a set of blocked signals, which can be modified using Thread.sigmask. This set is inherited at thread creation time. Per-thread signal masks are supported only by the system thread library under Unix, but not under Win32, nor by the VM thread library.

    val sigmask : Unix.sigprocmask_command -> int list -> int list

    sigmask cmd sigs changes the set of blocked signals for the calling thread. If cmd is SIG_SETMASK, blocked signals are set to those in the list sigs. If cmd is SIG_BLOCK, the signals in sigs are added to the set of blocked signals. If cmd is SIG_UNBLOCK, the signals in sigs are removed from the set of blocked signals. sigmask returns the set of previously blocked signals for the thread.

    val wait_signal : int list -> int

    wait_signal sigs suspends the execution of the calling thread until the process receives one of the signals specified in the list sigs. It then returns the number of the signal received. Signal handlers attached to the signals in sigs will not be invoked. The signals sigs are expected to be blocked before calling wait_signal.

    Uncaught exceptions

    val default_uncaught_exception_handler : exn -> unit

    Thread.default_uncaught_exception_handler will print the thread's id, exception and backtrace (if available).

    val set_uncaught_exception_handler : (exn -> unit) -> unit

    Thread.set_uncaught_exception_handler fn registers fn as the handler for uncaught exceptions.

    If the newly set uncaught exception handler raise an exception, default_uncaught_exception_handler will be called.

    \ No newline at end of file + Unix.file_descr list * Unix.file_descr list * Unix.file_descr list

    Same function as Unix.select. Suspend the execution of the calling thread until input/output becomes possible on the given Unix file descriptors. The arguments and results have the same meaning as for Unix.select.

    • deprecated Use Unix.select instead.
    val wait_pid : int -> int * Unix.process_status

    Same function as Unix.waitpid. wait_pid p suspends the execution of the calling thread until the process specified by the process identifier p terminates. Returns the pid of the child caught and its termination status, as per Unix.wait.

    • deprecated Use Unix.waitpid instead.

    Management of signals

    Signal handling follows the POSIX thread model: signals generated by a thread are delivered to that thread; signals generated externally are delivered to one of the threads that does not block it. Each thread possesses a set of blocked signals, which can be modified using Thread.sigmask. This set is inherited at thread creation time. Per-thread signal masks are supported only by the system thread library under Unix, but not under Win32, nor by the VM thread library.

    val sigmask : Unix.sigprocmask_command -> int list -> int list

    sigmask cmd sigs changes the set of blocked signals for the calling thread. If cmd is SIG_SETMASK, blocked signals are set to those in the list sigs. If cmd is SIG_BLOCK, the signals in sigs are added to the set of blocked signals. If cmd is SIG_UNBLOCK, the signals in sigs are removed from the set of blocked signals. sigmask returns the set of previously blocked signals for the thread.

    val wait_signal : int list -> int

    wait_signal sigs suspends the execution of the calling thread until the process receives one of the signals specified in the list sigs. It then returns the number of the signal received. Signal handlers attached to the signals in sigs will not be invoked. The signals sigs are expected to be blocked before calling wait_signal.

    Uncaught exceptions

    val default_uncaught_exception_handler : exn -> unit

    Thread.default_uncaught_exception_handler will print the thread's id, exception and backtrace (if available).

    val set_uncaught_exception_handler : (exn -> unit) -> unit

    Thread.set_uncaught_exception_handler fn registers fn as the handler for uncaught exceptions.

    If the newly set uncaught exception handler raise an exception, default_uncaught_exception_handler will be called.

    \ No newline at end of file diff --git a/dev/ocaml/ThreadUnix/index.html b/dev/ocaml/ThreadUnix/index.html deleted file mode 100644 index 3eac4b27..00000000 --- a/dev/ocaml/ThreadUnix/index.html +++ /dev/null @@ -1,47 +0,0 @@ - -ThreadUnix (ocaml.ThreadUnix)

    Module ThreadUnix

    Thread-compatible system calls.

    Process handling

    val execv : string -> string array -> unit
    val execve : string -> string array -> string array -> unit
    val execvp : string -> string array -> unit
    val wait : unit -> int * Unix.process_status
    val waitpid : Unix.wait_flag list -> int -> int * Unix.process_status
    val system : string -> Unix.process_status

    Basic input/output

    val read : Unix.file_descr -> bytes -> int -> int -> int
    val write : Unix.file_descr -> bytes -> int -> int -> int
    val write_substring : Unix.file_descr -> string -> int -> int -> int

    Input/output with timeout

    val timed_read : Unix.file_descr -> bytes -> int -> int -> float -> int
    val timed_write : Unix.file_descr -> bytes -> int -> int -> float -> int

    Behave as ThreadUnix.read and ThreadUnix.write, except that Unix_error(ETIMEDOUT,_,_) is raised if no data is available for reading or ready for writing after d seconds. The delay d is given in the fifth argument, in seconds.

    val timed_write_substring : - Unix.file_descr -> - string -> - int -> - int -> - float -> - int

    Polling

    val select : - Unix.file_descr list -> - Unix.file_descr list -> - Unix.file_descr list -> - float -> - Unix.file_descr list * Unix.file_descr list * Unix.file_descr list

    Pipes and redirections

    val pipe : ?cloexec:bool -> unit -> Unix.file_descr * Unix.file_descr
    val open_process_in : string -> in_channel
    val open_process_out : string -> out_channel
    val open_process : string -> in_channel * out_channel

    Time

    val sleep : int -> unit

    Sockets

    val socket : - ?cloexec:bool -> - Unix.socket_domain -> - Unix.socket_type -> - int -> - Unix.file_descr
    val accept : - ?cloexec:bool -> - Unix.file_descr -> - Unix.file_descr * Unix.sockaddr
    val connect : Unix.file_descr -> Unix.sockaddr -> unit
    val recv : Unix.file_descr -> bytes -> int -> int -> Unix.msg_flag list -> int
    val recvfrom : - Unix.file_descr -> - bytes -> - int -> - int -> - Unix.msg_flag list -> - int * Unix.sockaddr
    val send : Unix.file_descr -> bytes -> int -> int -> Unix.msg_flag list -> int
    val send_substring : - Unix.file_descr -> - string -> - int -> - int -> - Unix.msg_flag list -> - int
    val sendto : - Unix.file_descr -> - bytes -> - int -> - int -> - Unix.msg_flag list -> - Unix.sockaddr -> - int
    val sendto_substring : - Unix.file_descr -> - string -> - int -> - int -> - Unix.msg_flag list -> - Unix.sockaddr -> - int
    val open_connection : Unix.sockaddr -> in_channel * out_channel
    \ No newline at end of file diff --git a/dev/ocaml/Toploop/index.html b/dev/ocaml/Toploop/index.html index d2cc960c..a47a33c7 100644 --- a/dev/ocaml/Toploop/index.html +++ b/dev/ocaml/Toploop/index.html @@ -1,5 +1,5 @@ -Toploop (ocaml.Toploop)

    Module Toploop

    type input =
    1. | Stdin
    2. | File of string
    3. | String of string
    val getvalue : string -> Stdlib.Obj.t
    val setvalue : string -> Stdlib.Obj.t -> unit
    val filename_of_input : input -> string
    val set_paths : unit -> unit
    val loop : Stdlib.Format.formatter -> unit
    val run_script : Stdlib.Format.formatter -> input -> string array -> bool
    type directive_fun =
    1. | Directive_none of unit -> unit
    2. | Directive_string of string -> unit
    3. | Directive_int of int -> unit
    4. | Directive_ident of Longident.t -> unit
    5. | Directive_bool of bool -> unit
    type directive_info = {
    1. section : string;
    2. doc : string;
    }
    val add_directive : string -> directive_fun -> directive_info -> unit
    val get_directive : string -> directive_fun option
    val get_directive_info : string -> directive_info option
    val all_directive_names : unit -> string list
    val directive_table : (string, directive_fun) Stdlib.Hashtbl.t
    • deprecated
    val directive_info_table : (string, directive_info) Stdlib.Hashtbl.t
    • deprecated
    val toplevel_env : Env.t ref
    val initialize_toplevel_env : unit -> unit
    val print_exception_outcome : Stdlib.Format.formatter -> exn -> unit
    val execute_phrase : +Toploop (ocaml.Toploop)

    Module Toploop

    type input =
    1. | Stdin
    2. | File of string
    3. | String of string
    val getvalue : string -> Stdlib.Obj.t
    val setvalue : string -> Stdlib.Obj.t -> unit
    val filename_of_input : input -> string
    val set_paths : ?auto_include:Load_path.auto_include_callback -> unit -> unit
    val loop : Stdlib.Format.formatter -> unit
    val run_script : Stdlib.Format.formatter -> input -> string array -> bool
    type directive_fun =
    1. | Directive_none of unit -> unit
    2. | Directive_string of string -> unit
    3. | Directive_int of int -> unit
    4. | Directive_ident of Longident.t -> unit
    5. | Directive_bool of bool -> unit
    type directive_info = {
    1. section : string;
    2. doc : string;
    }
    val add_directive : string -> directive_fun -> directive_info -> unit
    val get_directive : string -> directive_fun option
    val get_directive_info : string -> directive_info option
    val all_directive_names : unit -> string list
    val directive_table : (string, directive_fun) Stdlib.Hashtbl.t
    • deprecated
    val directive_info_table : (string, directive_info) Stdlib.Hashtbl.t
    • deprecated
    val toplevel_env : Env.t ref
    val initialize_toplevel_env : unit -> unit
    val print_exception_outcome : Stdlib.Format.formatter -> exn -> unit
    val execute_phrase : bool -> Stdlib.Format.formatter -> Parsetree.toplevel_phrase -> diff --git a/dev/ocaml/Typedtree/index.html b/dev/ocaml/Typedtree/index.html index 8bf1b6f5..12434bee 100644 --- a/dev/ocaml/Typedtree/index.html +++ b/dev/ocaml/Typedtree/index.html @@ -33,7 +33,7 @@ * string option Asttypes.loc * Types.module_presence * module_expr - * expression
  • | Texp_letexception of extension_constructor * expression
  • | Texp_assert of expression
  • | Texp_lazy of expression
  • | Texp_object of class_structure * string list
  • | Texp_pack of module_expr
  • | Texp_letop of {
    1. let_ : binding_op;
    2. ands : binding_op list;
    3. param : Ident.t;
    4. body : value case;
    5. partial : partial;
    }
  • | Texp_unreachable
  • | Texp_extension_constructor of Longident.t Asttypes.loc * Path.t
  • | Texp_open of open_declaration * expression
    (*

    let open! M in e

    *)
  • and meth =
    1. | Tmeth_name of string
    2. | Tmeth_val of Ident.t
    3. | Tmeth_ancestor of Ident.t * Path.t
    and 'k case = {
    1. c_lhs : 'k general_pattern;
    2. c_guard : expression option;
    3. c_rhs : expression;
    }
    and record_label_definition =
    1. | Kept of Types.type_expr
    2. | Overridden of Longident.t Asttypes.loc * expression
    and binding_op = {
    1. bop_op_path : Path.t;
    2. bop_op_name : string Asttypes.loc;
    3. bop_op_val : Types.value_description;
    4. bop_op_type : Types.type_expr;
    5. bop_exp : expression;
    6. bop_loc : Location.t;
    }
    and class_expr = {
    1. cl_desc : class_expr_desc;
    2. cl_loc : Location.t;
    3. cl_type : Types.class_type;
    4. cl_env : Env.t;
    5. cl_attributes : attributes;
    }
    and class_expr_desc =
    1. | Tcl_ident of Path.t * Longident.t Asttypes.loc * core_type list
    2. | Tcl_structure of class_structure
    3. | Tcl_fun of Asttypes.arg_label + * expression
    4. | Texp_letexception of extension_constructor * expression
    5. | Texp_assert of expression
    6. | Texp_lazy of expression
    7. | Texp_object of class_structure * string list
    8. | Texp_pack of module_expr
    9. | Texp_letop of {
      1. let_ : binding_op;
      2. ands : binding_op list;
      3. param : Ident.t;
      4. body : value case;
      5. partial : partial;
      }
    10. | Texp_unreachable
    11. | Texp_extension_constructor of Longident.t Asttypes.loc * Path.t
    12. | Texp_open of open_declaration * expression
      (*

      let open! M in e

      *)
    and meth =
    1. | Tmeth_name of string
    2. | Tmeth_val of Ident.t
    3. | Tmeth_ancestor of Ident.t * Path.t
    and 'k case = {
    1. c_lhs : 'k general_pattern;
    2. c_guard : expression option;
    3. c_rhs : expression;
    }
    and record_label_definition =
    1. | Kept of Types.type_expr * Asttypes.mutable_flag
    2. | Overridden of Longident.t Asttypes.loc * expression
    and binding_op = {
    1. bop_op_path : Path.t;
    2. bop_op_name : string Asttypes.loc;
    3. bop_op_val : Types.value_description;
    4. bop_op_type : Types.type_expr;
    5. bop_exp : expression;
    6. bop_loc : Location.t;
    }
    and class_expr = {
    1. cl_desc : class_expr_desc;
    2. cl_loc : Location.t;
    3. cl_type : Types.class_type;
    4. cl_env : Env.t;
    5. cl_attributes : attributes;
    }
    and class_expr_desc =
    1. | Tcl_ident of Path.t * Longident.t Asttypes.loc * core_type list
    2. | Tcl_structure of class_structure
    3. | Tcl_fun of Asttypes.arg_label * pattern * (Ident.t * expression) list * class_expr diff --git a/dev/ocaml/Typemod/index.html b/dev/ocaml/Typemod/index.html index 2d3bb3f1..74a2da2c 100644 --- a/dev/ocaml/Typemod/index.html +++ b/dev/ocaml/Typemod/index.html @@ -33,7 +33,6 @@ string -> Typedtree.module_coercion
    val initial_env : loc:Location.t -> - safe_string:bool -> initially_opened_module:string option -> open_implicit_modules:string list -> Env.t
    module Sig_component_kind : sig ... end
    type hiding_error =
    1. | Illegal_shadowing of {
      1. shadowed_item_id : Ident.t;
      2. shadowed_item_kind : Sig_component_kind.t;
      3. shadowed_item_loc : Location.t;
      4. shadower_id : Ident.t;
      5. user_id : Ident.t;
      6. user_kind : Sig_component_kind.t;
      7. user_loc : Location.t;
      }
    2. | Appears_in_signature of {
      1. opened_item_id : Ident.t;
      2. opened_item_kind : Sig_component_kind.t;
      3. user_id : Ident.t;
      4. user_kind : Sig_component_kind.t;
      5. user_loc : Location.t;
      }
    type error =
    1. | Cannot_apply of Types.module_type
    2. | Not_included of Includemod.explanation
    3. | Cannot_eliminate_dependency of Types.module_type
    4. | Signature_expected
    5. | Structure_expected of Types.module_type
    6. | With_no_component of Longident.t
    7. | With_mismatch of Longident.t * Includemod.explanation
    8. | With_makes_applicative_functor_ill_typed of Longident.t diff --git a/dev/ocaml/Types/MethSet/index.html b/dev/ocaml/Types/MethSet/index.html index 530572c4..88f0cb3a 100644 --- a/dev/ocaml/Types/MethSet/index.html +++ b/dev/ocaml/Types/MethSet/index.html @@ -1,3 +1,3 @@ MethSet (ocaml.Types.MethSet)

      Module Types.MethSet

      type elt = string

      The type of the set elements.

      type t

      The type of sets.

      val empty : t

      The empty set.

      val is_empty : t -> bool

      Test whether a set is empty or not.

      val mem : elt -> t -> bool

      mem x s tests whether x belongs to the set s.

      val add : elt -> t -> t

      add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

      • before 4.03

        Physical equality was not ensured.

      val singleton : elt -> t

      singleton x returns the one-element set containing only x.

      val remove : elt -> t -> t

      remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

      • before 4.03

        Physical equality was not ensured.

      val union : t -> t -> t

      Set union.

      val inter : t -> t -> t

      Set intersection.

      val disjoint : t -> t -> bool

      Test if two sets are disjoint.

      • since 4.08.0
      val diff : t -> t -> t

      Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

      val compare : t -> t -> int

      Total ordering between sets. Can be used as the ordering function for doing sets of sets.

      val equal : t -> t -> bool

      equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

      val subset : t -> t -> bool

      subset s1 s2 tests whether the set s1 is a subset of the set s2.

      val iter : (elt -> unit) -> t -> unit

      iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

      val map : (elt -> elt) -> t -> t

      map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

      The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

      If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

      • since 4.04.0
      val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

      fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

      val for_all : (elt -> bool) -> t -> bool

      for_all f s checks if all elements of the set satisfy the predicate f.

      val exists : (elt -> bool) -> t -> bool

      exists f s checks if at least one element of the set satisfies the predicate f.

      val filter : (elt -> bool) -> t -> t

      filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

      • before 4.03

        Physical equality was not ensured.

      val filter_map : (elt -> elt option) -> t -> t

      filter_map f s returns the set of all v such that f x = Some v for some element x of s.

      For example,

      filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

      is the set of halves of the even elements of s.

      If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

      • since 4.11.0
      val partition : (elt -> bool) -> t -> t * t

      partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

      val cardinal : t -> int

      Return the number of elements of a set.

      val elements : t -> elt list

      Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

      val min_elt : t -> elt

      Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

      val min_elt_opt : t -> elt option

      Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

      • since 4.05
      val max_elt : t -> elt

      Same as min_elt, but returns the largest element of the given set.

      val max_elt_opt : t -> elt option

      Same as min_elt_opt, but returns the largest element of the given set.

      • since 4.05
      val choose : t -> elt

      Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

      val choose_opt : t -> elt option

      Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

      • since 4.05
      val split : elt -> t -> t * bool * t

      split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

      val find : elt -> t -> elt

      find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

      • since 4.01.0
      val find_opt : elt -> t -> elt option

      find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

      • since 4.05
      val find_first : (elt -> bool) -> t -> elt

      find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

      For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

      • since 4.05
      val find_first_opt : (elt -> bool) -> t -> elt option

      find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

      • since 4.05
      val find_last : (elt -> bool) -> t -> elt

      find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

      • since 4.05
      val find_last_opt : (elt -> bool) -> t -> elt option

      find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

      • since 4.05
      val of_list : elt list -> t

      of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

      • since 4.02.0

      Iterators

      val to_seq_from : elt -> t -> elt Seq.t

      to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

      • since 4.07
      val to_seq : t -> elt Seq.t

      Iterate on the whole set, in ascending order

      • since 4.07
      val to_rev_seq : t -> elt Seq.t

      Iterate on the whole set, in descending order

      • since 4.12
      val add_seq : elt Seq.t -> t -> t

      Add the given elements to the set, in order.

      • since 4.07
      val of_seq : elt Seq.t -> t

      Build a set from the given bindings

      • since 4.07
      \ No newline at end of file + aN
      , where a0,a1...aN are the elements of s.

      The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

      If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

      • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Types/Meths/index.html b/dev/ocaml/Types/Meths/index.html index 9ffa28d5..848f89f7 100644 --- a/dev/ocaml/Types/Meths/index.html +++ b/dev/ocaml/Types/Meths/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Types/VarSet/index.html b/dev/ocaml/Types/VarSet/index.html index b8faa319..1f34840a 100644 --- a/dev/ocaml/Types/VarSet/index.html +++ b/dev/ocaml/Types/VarSet/index.html @@ -1,3 +1,3 @@ VarSet (ocaml.Types.VarSet)

    Module Types.VarSet

    type elt = string

    The type of the set elements.

    type t

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val map : (elt -> elt) -> t -> t

    map f s is the set whose elements are f a0,f a1... f - aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    • since 4.04.0
    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file + aN, where a0,a1...aN are the elements of s.

    The elements are passed to f in increasing order with respect to the ordering over the type of the elements.

    If no element of s is changed by f, s is returned unchanged. (If each output of f is physically equal to its input, the returned set is physically equal to s.)

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val of_list : elt list -> t

    of_list l creates a set from a list of elements. This is usually more efficient than folding add over the list, except perhaps for lists with many duplicated elements.

    • since 4.02.0

    Iterators

    val to_seq_from : elt -> t -> elt Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Types/Vars/index.html b/dev/ocaml/Types/Vars/index.html index 9948b5c7..680605b0 100644 --- a/dev/ocaml/Types/Vars/index.html +++ b/dev/ocaml/Types/Vars/index.html @@ -5,4 +5,4 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    \ No newline at end of file diff --git a/dev/ocaml/Unix/index.html b/dev/ocaml/Unix/index.html index 21df7e0d..7c243a59 100644 --- a/dev/ocaml/Unix/index.html +++ b/dev/ocaml/Unix/index.html @@ -6,7 +6,7 @@ 'c Stdlib.Bigarray.layout -> bool -> int array -> - ('a, 'b, 'c) Stdlib.Bigarray.Genarray.t

    Memory mapping of a file as a Bigarray. map_file fd kind layout shared dims returns a Bigarray of kind kind, layout layout, and dimensions as specified in dims. The data contained in this Bigarray are the contents of the file referred to by the file descriptor fd (as opened previously with openfile, for example). The optional pos parameter is the byte offset in the file of the data being mapped; it defaults to 0 (map from the beginning of the file).

    If shared is true, all modifications performed on the array are reflected in the file. This requires that fd be opened with write permissions. If shared is false, modifications performed on the array are done in memory only, using copy-on-write of the modified pages; the underlying file is not affected.

    Genarray.map_file is much more efficient than reading the whole file in a Bigarray, modifying that Bigarray, and writing it afterwards.

    To adjust automatically the dimensions of the Bigarray to the actual size of the file, the major dimension (that is, the first dimension for an array with C layout, and the last dimension for an array with Fortran layout) can be given as -1. Genarray.map_file then determines the major dimension from the size of the file. The file must contain an integral number of sub-arrays as determined by the non-major dimensions, otherwise Failure is raised.

    If all dimensions of the Bigarray are given, the file size is matched against the size of the Bigarray. If the file is larger than the Bigarray, only the initial portion of the file is mapped to the Bigarray. If the file is smaller than the big array, the file is automatically grown to the size of the Bigarray. This requires write permissions on fd.

    Array accesses are bounds-checked, but the bounds are determined by the initial call to map_file. Therefore, you should make sure no other process modifies the mapped file while you're accessing it, or a SIGBUS signal may be raised. This happens, for instance, if the file is shrunk.

    Invalid_argument or Failure may be raised in cases where argument validation fails.

    Operations on file names

    Removes the named file.

    If the named file is a directory, raises:

    • EPERM on POSIX compliant system
    • EISDIR on Linux >= 2.1.132
    • EACCESS on Windows
    val rename : string -> string -> unit

    rename src dst changes the name of a file from src to dst, moving it between directories if needed. If dst already exists, its contents will be replaced with those of src. Depending on the operating system, the metadata (permissions, owner, etc) of dst can either be preserved or be replaced by those of src.

    link ?follow src dst creates a hard link named dst to the file named src.

    • parameter follow

      indicates whether a src symlink is followed or a hardlink to src itself will be created. On Unix systems this is done using the linkat(2) function. If ?follow is not provided, then the link(2) function is used whose behaviour is OS-dependent, but more widely available.

    • raises ENOSYS

      On Unix if ~follow:_ is requested, but linkat is unavailable.

    • raises ENOSYS

      On Windows if ~follow:false is requested.

    val realpath : string -> string

    realpath p is an absolute pathname for p obtained by resolving all extra / characters, relative path segments and symbolic links.

    • since 4.13.0

    File permissions and ownership

    type access_permission =
    1. | R_OK
      (*

      Read permission

      *)
    2. | W_OK
      (*

      Write permission

      *)
    3. | X_OK
      (*

      Execution permission

      *)
    4. | F_OK
      (*

      File exists

      *)

    Flags for the access call.

    val chmod : string -> file_perm -> unit

    Change the permissions of the named file.

    val fchmod : file_descr -> file_perm -> unit

    Change the permissions of an opened file.

    • raises Invalid_argument

      on Windows

    val chown : string -> int -> int -> unit

    Change the owner uid and owner gid of the named file.

    • raises Invalid_argument

      on Windows

    val fchown : file_descr -> int -> int -> unit

    Change the owner uid and owner gid of an opened file.

    • raises Invalid_argument

      on Windows

    val umask : int -> int

    Set the process's file mode creation mask, and return the previous mask.

    • raises Invalid_argument

      on Windows

    val access : string -> access_permission list -> unit

    Check that the process has the given permissions over the named file.

    On Windows: execute permission X_OK cannot be tested, just tests for read permission instead.

    • raises Unix_error

      otherwise.

    Operations on file descriptors

    val dup : ?cloexec:bool -> file_descr -> file_descr

    Return a new file descriptor referencing the same file as the given descriptor. See set_close_on_exec for documentation on the cloexec optional argument.

    val dup2 : ?cloexec:bool -> file_descr -> file_descr -> unit

    dup2 src dst duplicates src to dst, closing dst if already opened. See set_close_on_exec for documentation on the cloexec optional argument.

    val set_nonblock : file_descr -> unit

    Set the ``non-blocking'' flag on the given descriptor. When the non-blocking flag is set, reading on a descriptor on which there is temporarily no data available raises the EAGAIN or EWOULDBLOCK error instead of blocking; writing on a descriptor on which there is temporarily no room for writing also raises EAGAIN or EWOULDBLOCK.

    val clear_nonblock : file_descr -> unit

    Clear the ``non-blocking'' flag on the given descriptor. See set_nonblock.

    val set_close_on_exec : file_descr -> unit

    Set the ``close-on-exec'' flag on the given descriptor. A descriptor with the close-on-exec flag is automatically closed when the current process starts another program with one of the exec, create_process and open_process functions.

    It is often a security hole to leak file descriptors opened on, say, a private file to an external program: the program, then, gets access to the private file and can do bad things with it. Hence, it is highly recommended to set all file descriptors ``close-on-exec'', except in the very few cases where a file descriptor actually needs to be transmitted to another program.

    The best way to set a file descriptor ``close-on-exec'' is to create it in this state. To this end, the openfile function has O_CLOEXEC and O_KEEPEXEC flags to enforce ``close-on-exec'' mode or ``keep-on-exec'' mode, respectively. All other operations in the Unix module that create file descriptors have an optional argument ?cloexec:bool to indicate whether the file descriptor should be created in ``close-on-exec'' mode (by writing ~cloexec:true) or in ``keep-on-exec'' mode (by writing ~cloexec:false). For historical reasons, the default file descriptor creation mode is ``keep-on-exec'', if no cloexec optional argument is given. This is not a safe default, hence it is highly recommended to pass explicit cloexec arguments to operations that create file descriptors.

    The cloexec optional arguments and the O_KEEPEXEC flag were introduced in OCaml 4.05. Earlier, the common practice was to create file descriptors in the default, ``keep-on-exec'' mode, then call set_close_on_exec on those freshly-created file descriptors. This is not as safe as creating the file descriptor in ``close-on-exec'' mode because, in multithreaded programs, a window of vulnerability exists between the time when the file descriptor is created and the time set_close_on_exec completes. If another thread spawns another program during this window, the descriptor will leak, as it is still in the ``keep-on-exec'' mode.

    Regarding the atomicity guarantees given by ~cloexec:true or by the use of the O_CLOEXEC flag: on all platforms it is guaranteed that a concurrently-executing Caml thread cannot leak the descriptor by starting a new process. On Linux, this guarantee extends to concurrently-executing C threads. As of Feb 2017, other operating systems lack the necessary system calls and still expose a window of vulnerability during which a C thread can see the newly-created file descriptor in ``keep-on-exec'' mode.

    val clear_close_on_exec : file_descr -> unit

    Clear the ``close-on-exec'' flag on the given descriptor. See set_close_on_exec.

    Directories

    val mkdir : string -> file_perm -> unit

    Create a directory with the given permissions (see umask).

    val rmdir : string -> unit

    Remove an empty directory.

    val chdir : string -> unit

    Change the process working directory.

    val getcwd : unit -> string

    Return the name of the current working directory.

    val chroot : string -> unit

    Change the process root directory.

    • raises Invalid_argument

      on Windows

    type dir_handle

    The type of descriptors over opened directories.

    val opendir : string -> dir_handle

    Open a descriptor on a directory

    val readdir : dir_handle -> string

    Return the next entry in a directory.

    • raises End_of_file

      when the end of the directory has been reached.

    val rewinddir : dir_handle -> unit

    Reposition the descriptor to the beginning of the directory

    val closedir : dir_handle -> unit

    Close a directory descriptor.

    Pipes and redirections

    val pipe : ?cloexec:bool -> unit -> file_descr * file_descr

    Create a pipe. The first component of the result is opened for reading, that's the exit to the pipe. The second component is opened for writing, that's the entrance to the pipe. See set_close_on_exec for documentation on the cloexec optional argument.

    val mkfifo : string -> file_perm -> unit

    Create a named pipe with the given permissions (see umask).

    • raises Invalid_argument

      on Windows

    High-level process and redirection management

    val create_process : + ('a, 'b, 'c) Stdlib.Bigarray.Genarray.t

    Memory mapping of a file as a Bigarray. map_file fd kind layout shared dims returns a Bigarray of kind kind, layout layout, and dimensions as specified in dims. The data contained in this Bigarray are the contents of the file referred to by the file descriptor fd (as opened previously with openfile, for example). The optional pos parameter is the byte offset in the file of the data being mapped; it defaults to 0 (map from the beginning of the file).

    If shared is true, all modifications performed on the array are reflected in the file. This requires that fd be opened with write permissions. If shared is false, modifications performed on the array are done in memory only, using copy-on-write of the modified pages; the underlying file is not affected.

    map_file is much more efficient than reading the whole file in a Bigarray, modifying that Bigarray, and writing it afterwards.

    To adjust automatically the dimensions of the Bigarray to the actual size of the file, the major dimension (that is, the first dimension for an array with C layout, and the last dimension for an array with Fortran layout) can be given as -1. map_file then determines the major dimension from the size of the file. The file must contain an integral number of sub-arrays as determined by the non-major dimensions, otherwise Failure is raised.

    If all dimensions of the Bigarray are given, the file size is matched against the size of the Bigarray. If the file is larger than the Bigarray, only the initial portion of the file is mapped to the Bigarray. If the file is smaller than the big array, the file is automatically grown to the size of the Bigarray. This requires write permissions on fd.

    Array accesses are bounds-checked, but the bounds are determined by the initial call to map_file. Therefore, you should make sure no other process modifies the mapped file while you're accessing it, or a SIGBUS signal may be raised. This happens, for instance, if the file is shrunk.

    Invalid_argument or Failure may be raised in cases where argument validation fails.

    • since 4.06.0

    Operations on file names

    Removes the named file.

    If the named file is a directory, raises:

    • EPERM on POSIX compliant system
    • EISDIR on Linux >= 2.1.132
    • EACCESS on Windows
    val rename : string -> string -> unit

    rename src dst changes the name of a file from src to dst, moving it between directories if needed. If dst already exists, its contents will be replaced with those of src. Depending on the operating system, the metadata (permissions, owner, etc) of dst can either be preserved or be replaced by those of src.

    link ?follow src dst creates a hard link named dst to the file named src.

    • parameter follow

      indicates whether a src symlink is followed or a hardlink to src itself will be created. On Unix systems this is done using the linkat(2) function. If ?follow is not provided, then the link(2) function is used whose behaviour is OS-dependent, but more widely available.

    • raises ENOSYS

      On Unix if ~follow:_ is requested, but linkat is unavailable.

    • raises ENOSYS

      On Windows if ~follow:false is requested.

    val realpath : string -> string

    realpath p is an absolute pathname for p obtained by resolving all extra / characters, relative path segments and symbolic links.

    • since 4.13.0

    File permissions and ownership

    type access_permission =
    1. | R_OK
      (*

      Read permission

      *)
    2. | W_OK
      (*

      Write permission

      *)
    3. | X_OK
      (*

      Execution permission

      *)
    4. | F_OK
      (*

      File exists

      *)

    Flags for the access call.

    val chmod : string -> file_perm -> unit

    Change the permissions of the named file.

    val fchmod : file_descr -> file_perm -> unit

    Change the permissions of an opened file.

    • raises Invalid_argument

      on Windows

    val chown : string -> int -> int -> unit

    Change the owner uid and owner gid of the named file.

    • raises Invalid_argument

      on Windows

    val fchown : file_descr -> int -> int -> unit

    Change the owner uid and owner gid of an opened file.

    • raises Invalid_argument

      on Windows

    val umask : int -> int

    Set the process's file mode creation mask, and return the previous mask.

    • raises Invalid_argument

      on Windows

    val access : string -> access_permission list -> unit

    Check that the process has the given permissions over the named file.

    On Windows: execute permission X_OK cannot be tested, just tests for read permission instead.

    • raises Unix_error

      otherwise.

    Operations on file descriptors

    val dup : ?cloexec:bool -> file_descr -> file_descr

    Return a new file descriptor referencing the same file as the given descriptor. See set_close_on_exec for documentation on the cloexec optional argument.

    val dup2 : ?cloexec:bool -> file_descr -> file_descr -> unit

    dup2 src dst duplicates src to dst, closing dst if already opened. See set_close_on_exec for documentation on the cloexec optional argument.

    val set_nonblock : file_descr -> unit

    Set the ``non-blocking'' flag on the given descriptor. When the non-blocking flag is set, reading on a descriptor on which there is temporarily no data available raises the EAGAIN or EWOULDBLOCK error instead of blocking; writing on a descriptor on which there is temporarily no room for writing also raises EAGAIN or EWOULDBLOCK.

    val clear_nonblock : file_descr -> unit

    Clear the ``non-blocking'' flag on the given descriptor. See set_nonblock.

    val set_close_on_exec : file_descr -> unit

    Set the ``close-on-exec'' flag on the given descriptor. A descriptor with the close-on-exec flag is automatically closed when the current process starts another program with one of the exec, create_process and open_process functions.

    It is often a security hole to leak file descriptors opened on, say, a private file to an external program: the program, then, gets access to the private file and can do bad things with it. Hence, it is highly recommended to set all file descriptors ``close-on-exec'', except in the very few cases where a file descriptor actually needs to be transmitted to another program.

    The best way to set a file descriptor ``close-on-exec'' is to create it in this state. To this end, the openfile function has O_CLOEXEC and O_KEEPEXEC flags to enforce ``close-on-exec'' mode or ``keep-on-exec'' mode, respectively. All other operations in the Unix module that create file descriptors have an optional argument ?cloexec:bool to indicate whether the file descriptor should be created in ``close-on-exec'' mode (by writing ~cloexec:true) or in ``keep-on-exec'' mode (by writing ~cloexec:false). For historical reasons, the default file descriptor creation mode is ``keep-on-exec'', if no cloexec optional argument is given. This is not a safe default, hence it is highly recommended to pass explicit cloexec arguments to operations that create file descriptors.

    The cloexec optional arguments and the O_KEEPEXEC flag were introduced in OCaml 4.05. Earlier, the common practice was to create file descriptors in the default, ``keep-on-exec'' mode, then call set_close_on_exec on those freshly-created file descriptors. This is not as safe as creating the file descriptor in ``close-on-exec'' mode because, in multithreaded programs, a window of vulnerability exists between the time when the file descriptor is created and the time set_close_on_exec completes. If another thread spawns another program during this window, the descriptor will leak, as it is still in the ``keep-on-exec'' mode.

    Regarding the atomicity guarantees given by ~cloexec:true or by the use of the O_CLOEXEC flag: on all platforms it is guaranteed that a concurrently-executing Caml thread cannot leak the descriptor by starting a new process. On Linux, this guarantee extends to concurrently-executing C threads. As of Feb 2017, other operating systems lack the necessary system calls and still expose a window of vulnerability during which a C thread can see the newly-created file descriptor in ``keep-on-exec'' mode.

    val clear_close_on_exec : file_descr -> unit

    Clear the ``close-on-exec'' flag on the given descriptor. See set_close_on_exec.

    Directories

    val mkdir : string -> file_perm -> unit

    Create a directory with the given permissions (see umask).

    val rmdir : string -> unit

    Remove an empty directory.

    val chdir : string -> unit

    Change the process working directory.

    val getcwd : unit -> string

    Return the name of the current working directory.

    val chroot : string -> unit

    Change the process root directory.

    • raises Invalid_argument

      on Windows

    type dir_handle

    The type of descriptors over opened directories.

    val opendir : string -> dir_handle

    Open a descriptor on a directory

    val readdir : dir_handle -> string

    Return the next entry in a directory.

    • raises End_of_file

      when the end of the directory has been reached.

    val rewinddir : dir_handle -> unit

    Reposition the descriptor to the beginning of the directory

    val closedir : dir_handle -> unit

    Close a directory descriptor.

    Pipes and redirections

    val pipe : ?cloexec:bool -> unit -> file_descr * file_descr

    Create a pipe. The first component of the result is opened for reading, that's the exit to the pipe. The second component is opened for writing, that's the entrance to the pipe. See set_close_on_exec for documentation on the cloexec optional argument.

    val mkfifo : string -> file_perm -> unit

    Create a named pipe with the given permissions (see umask).

    • raises Invalid_argument

      on Windows

    High-level process and redirection management

    val create_process : string -> string array -> file_descr -> @@ -41,7 +41,7 @@ socket_domain -> socket_type -> int -> - file_descr * file_descr

    Create a pair of unnamed sockets, connected together. See set_close_on_exec for documentation on the cloexec optional argument.

    • raises Invalid_argument

      on Windows

    val accept : ?cloexec:bool -> file_descr -> file_descr * sockaddr

    Accept connections on the given socket. The returned descriptor is a socket connected to the client; the returned address is the address of the connecting client. See set_close_on_exec for documentation on the cloexec optional argument.

    val bind : file_descr -> sockaddr -> unit

    Bind a socket to an address.

    val connect : file_descr -> sockaddr -> unit

    Connect a socket to an address.

    val listen : file_descr -> int -> unit

    Set up a socket for receiving connection requests. The integer argument is the maximal number of pending requests.

    type shutdown_command =
    1. | SHUTDOWN_RECEIVE
      (*

      Close for receiving

      *)
    2. | SHUTDOWN_SEND
      (*

      Close for sending

      *)
    3. | SHUTDOWN_ALL
      (*

      Close both

      *)

    The type of commands for shutdown.

    val shutdown : file_descr -> shutdown_command -> unit

    Shutdown a socket connection. SHUTDOWN_SEND as second argument causes reads on the other end of the connection to return an end-of-file condition. SHUTDOWN_RECEIVE causes writes on the other end of the connection to return a closed pipe condition (SIGPIPE signal).

    val getsockname : file_descr -> sockaddr

    Return the address of the given socket.

    val getpeername : file_descr -> sockaddr

    Return the address of the host connected to the given socket.

    type msg_flag =
    1. | MSG_OOB
    2. | MSG_DONTROUTE
    3. | MSG_PEEK

    The flags for recv, recvfrom, send and sendto.

    val recv : file_descr -> bytes -> int -> int -> msg_flag list -> int

    Receive data from a connected socket.

    val recvfrom : + file_descr * file_descr

    Create a pair of unnamed sockets, connected together. See set_close_on_exec for documentation on the cloexec optional argument.

    val accept : ?cloexec:bool -> file_descr -> file_descr * sockaddr

    Accept connections on the given socket. The returned descriptor is a socket connected to the client; the returned address is the address of the connecting client. See set_close_on_exec for documentation on the cloexec optional argument.

    val bind : file_descr -> sockaddr -> unit

    Bind a socket to an address.

    val connect : file_descr -> sockaddr -> unit

    Connect a socket to an address.

    val listen : file_descr -> int -> unit

    Set up a socket for receiving connection requests. The integer argument is the maximal number of pending requests.

    type shutdown_command =
    1. | SHUTDOWN_RECEIVE
      (*

      Close for receiving

      *)
    2. | SHUTDOWN_SEND
      (*

      Close for sending

      *)
    3. | SHUTDOWN_ALL
      (*

      Close both

      *)

    The type of commands for shutdown.

    val shutdown : file_descr -> shutdown_command -> unit

    Shutdown a socket connection. SHUTDOWN_SEND as second argument causes reads on the other end of the connection to return an end-of-file condition. SHUTDOWN_RECEIVE causes writes on the other end of the connection to return a closed pipe condition (SIGPIPE signal).

    val getsockname : file_descr -> sockaddr

    Return the address of the given socket.

    val getpeername : file_descr -> sockaddr

    Return the address of the host connected to the given socket.

    type msg_flag =
    1. | MSG_OOB
    2. | MSG_DONTROUTE
    3. | MSG_PEEK

    The flags for recv, recvfrom, send and sendto.

    val recv : file_descr -> bytes -> int -> int -> msg_flag list -> int

    Receive data from a connected socket.

    val recvfrom : file_descr -> bytes -> int -> @@ -61,7 +61,7 @@ int -> msg_flag list -> sockaddr -> - int

    Same as sendto, but take the data from a string instead of a byte sequence.

    • since 4.02.0

    Socket options

    type socket_bool_option =
    1. | SO_DEBUG
      (*

      Record debugging information

      *)
    2. | SO_BROADCAST
      (*

      Permit sending of broadcast messages

      *)
    3. | SO_REUSEADDR
      (*

      Allow reuse of local addresses for bind

      *)
    4. | SO_KEEPALIVE
      (*

      Keep connection active

      *)
    5. | SO_DONTROUTE
      (*

      Bypass the standard routing algorithms

      *)
    6. | SO_OOBINLINE
      (*

      Leave out-of-band data in line

      *)
    7. | SO_ACCEPTCONN
      (*

      Report whether socket listening is enabled

      *)
    8. | TCP_NODELAY
      (*

      Control the Nagle algorithm for TCP sockets

      *)
    9. | IPV6_ONLY
      (*

      Forbid binding an IPv6 socket to an IPv4 address

      *)
    10. | SO_REUSEPORT
      (*

      Allow reuse of address and port bindings

      *)

    The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

    type socket_int_option =
    1. | SO_SNDBUF
      (*

      Size of send buffer

      *)
    2. | SO_RCVBUF
      (*

      Size of received buffer

      *)
    3. | SO_ERROR
      (*

      Deprecated. Use getsockopt_error instead.

      *)
    4. | SO_TYPE
      (*

      Report the socket type

      *)
    5. | SO_RCVLOWAT
      (*

      Minimum number of bytes to process for input operations

      *)
    6. | SO_SNDLOWAT
      (*

      Minimum number of bytes to process for output operations

      *)

    The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

    type socket_optint_option =
    1. | SO_LINGER
      (*

      Whether to linger on closed connections that have data present, and for how long (in seconds)

      *)

    The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

    type socket_float_option =
    1. | SO_RCVTIMEO
      (*

      Timeout for input operations

      *)
    2. | SO_SNDTIMEO
      (*

      Timeout for output operations

      *)

    The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

    val getsockopt : file_descr -> socket_bool_option -> bool

    Return the current status of a boolean-valued option in the given socket.

    val setsockopt : file_descr -> socket_bool_option -> bool -> unit

    Set or clear a boolean-valued option in the given socket.

    val getsockopt_int : file_descr -> socket_int_option -> int

    Same as getsockopt for an integer-valued socket option.

    val setsockopt_int : file_descr -> socket_int_option -> int -> unit

    Same as setsockopt for an integer-valued socket option.

    val getsockopt_optint : file_descr -> socket_optint_option -> int option

    Same as getsockopt for a socket option whose value is an int option.

    val setsockopt_optint : + int

    Same as sendto, but take the data from a string instead of a byte sequence.

    • since 4.02.0

    Socket options

    type socket_bool_option =
    1. | SO_DEBUG
      (*

      Record debugging information

      *)
    2. | SO_BROADCAST
      (*

      Permit sending of broadcast messages

      *)
    3. | SO_REUSEADDR
      (*

      Allow reuse of local addresses for bind

      *)
    4. | SO_KEEPALIVE
      (*

      Keep connection active

      *)
    5. | SO_DONTROUTE
      (*

      Bypass the standard routing algorithms

      *)
    6. | SO_OOBINLINE
      (*

      Leave out-of-band data in line

      *)
    7. | SO_ACCEPTCONN
      (*

      Report whether socket listening is enabled

      *)
    8. | TCP_NODELAY
      (*

      Control the Nagle algorithm for TCP sockets

      *)
    9. | IPV6_ONLY
      (*

      Forbid binding an IPv6 socket to an IPv4 address

      *)
    10. | SO_REUSEPORT
      (*

      Allow reuse of address and port bindings

      *)

    The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

    type socket_int_option =
    1. | SO_SNDBUF
      (*

      Size of send buffer

      *)
    2. | SO_RCVBUF
      (*

      Size of received buffer

      *)
    3. | SO_ERROR
      (*

      Deprecated. Use getsockopt_error instead.

      • deprecated Use Unix.getsockopt_error instead.
      *)
    4. | SO_TYPE
      (*

      Report the socket type

      *)
    5. | SO_RCVLOWAT
      (*

      Minimum number of bytes to process for input operations

      *)
    6. | SO_SNDLOWAT
      (*

      Minimum number of bytes to process for output operations

      *)

    The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

    type socket_optint_option =
    1. | SO_LINGER
      (*

      Whether to linger on closed connections that have data present, and for how long (in seconds)

      *)

    The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

    type socket_float_option =
    1. | SO_RCVTIMEO
      (*

      Timeout for input operations

      *)
    2. | SO_SNDTIMEO
      (*

      Timeout for output operations

      *)

    The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

    val getsockopt : file_descr -> socket_bool_option -> bool

    Return the current status of a boolean-valued option in the given socket.

    val setsockopt : file_descr -> socket_bool_option -> bool -> unit

    Set or clear a boolean-valued option in the given socket.

    val getsockopt_int : file_descr -> socket_int_option -> int

    Same as getsockopt for an integer-valued socket option.

    val setsockopt_int : file_descr -> socket_int_option -> int -> unit

    Same as setsockopt for an integer-valued socket option.

    val getsockopt_optint : file_descr -> socket_optint_option -> int option

    Same as getsockopt for a socket option whose value is an int option.

    val setsockopt_optint : file_descr -> socket_optint_option -> int option -> diff --git a/dev/ocaml/UnixLabels/index.html b/dev/ocaml/UnixLabels/index.html index 2839de81..faa92612 100644 --- a/dev/ocaml/UnixLabels/index.html +++ b/dev/ocaml/UnixLabels/index.html @@ -11,7 +11,7 @@ layout:'c Stdlib.Bigarray.layout -> shared:bool -> dims:int array -> - ('a, 'b, 'c) Stdlib.Bigarray.Genarray.t

    Memory mapping of a file as a Bigarray. map_file fd ~kind ~layout ~shared ~dims returns a Bigarray of kind kind, layout layout, and dimensions as specified in dims. The data contained in this Bigarray are the contents of the file referred to by the file descriptor fd (as opened previously with openfile, for example). The optional pos parameter is the byte offset in the file of the data being mapped; it defaults to 0 (map from the beginning of the file).

    If shared is true, all modifications performed on the array are reflected in the file. This requires that fd be opened with write permissions. If shared is false, modifications performed on the array are done in memory only, using copy-on-write of the modified pages; the underlying file is not affected.

    Genarray.map_file is much more efficient than reading the whole file in a Bigarray, modifying that Bigarray, and writing it afterwards.

    To adjust automatically the dimensions of the Bigarray to the actual size of the file, the major dimension (that is, the first dimension for an array with C layout, and the last dimension for an array with Fortran layout) can be given as -1. Genarray.map_file then determines the major dimension from the size of the file. The file must contain an integral number of sub-arrays as determined by the non-major dimensions, otherwise Failure is raised.

    If all dimensions of the Bigarray are given, the file size is matched against the size of the Bigarray. If the file is larger than the Bigarray, only the initial portion of the file is mapped to the Bigarray. If the file is smaller than the big array, the file is automatically grown to the size of the Bigarray. This requires write permissions on fd.

    Array accesses are bounds-checked, but the bounds are determined by the initial call to map_file. Therefore, you should make sure no other process modifies the mapped file while you're accessing it, or a SIGBUS signal may be raised. This happens, for instance, if the file is shrunk.

    Invalid_argument or Failure may be raised in cases where argument validation fails.

    • since 4.06.0

    Operations on file names

    Removes the named file.

    If the named file is a directory, raises:

    • EPERM on POSIX compliant system
    • EISDIR on Linux >= 2.1.132
    • EACCESS on Windows
    val rename : src:string -> dst:string -> unit

    rename ~src ~dst changes the name of a file from src to dst, moving it between directories if needed. If dst already exists, its contents will be replaced with those of src. Depending on the operating system, the metadata (permissions, owner, etc) of dst can either be preserved or be replaced by those of src.

    link ?follow ~src ~dst creates a hard link named dst to the file named src.

    • parameter follow

      indicates whether a src symlink is followed or a hardlink to src itself will be created. On Unix systems this is done using the linkat(2) function. If ?follow is not provided, then the link(2) function is used whose behaviour is OS-dependent, but more widely available.

    • raises ENOSYS

      On Unix if ~follow:_ is requested, but linkat is unavailable.

    • raises ENOSYS

      On Windows if ~follow:false is requested.

    val realpath : string -> string

    realpath p is an absolute pathname for p obtained by resolving all extra / characters, relative path segments and symbolic links.

    • since 4.13.0

    File permissions and ownership

    type access_permission = Unix.access_permission =
    1. | R_OK
      (*

      Read permission

      *)
    2. | W_OK
      (*

      Write permission

      *)
    3. | X_OK
      (*

      Execution permission

      *)
    4. | F_OK
      (*

      File exists

      *)

    Flags for the access call.

    val chmod : string -> perm:file_perm -> unit

    Change the permissions of the named file.

    val fchmod : file_descr -> perm:file_perm -> unit

    Change the permissions of an opened file.

    • raises Invalid_argument

      on Windows

    val chown : string -> uid:int -> gid:int -> unit

    Change the owner uid and owner gid of the named file.

    • raises Invalid_argument

      on Windows

    val fchown : file_descr -> uid:int -> gid:int -> unit

    Change the owner uid and owner gid of an opened file.

    • raises Invalid_argument

      on Windows

    val umask : int -> int

    Set the process's file mode creation mask, and return the previous mask.

    • raises Invalid_argument

      on Windows

    val access : string -> perm:access_permission list -> unit

    Check that the process has the given permissions over the named file.

    On Windows: execute permission X_OK cannot be tested, just tests for read permission instead.

    • raises Unix_error

      otherwise.

    Operations on file descriptors

    val dup : ?cloexec:bool -> file_descr -> file_descr

    Return a new file descriptor referencing the same file as the given descriptor. See set_close_on_exec for documentation on the cloexec optional argument.

    val dup2 : ?cloexec:bool -> src:file_descr -> dst:file_descr -> unit

    dup2 ~src ~dst duplicates src to dst, closing dst if already opened. See set_close_on_exec for documentation on the cloexec optional argument.

    val set_nonblock : file_descr -> unit

    Set the ``non-blocking'' flag on the given descriptor. When the non-blocking flag is set, reading on a descriptor on which there is temporarily no data available raises the EAGAIN or EWOULDBLOCK error instead of blocking; writing on a descriptor on which there is temporarily no room for writing also raises EAGAIN or EWOULDBLOCK.

    val clear_nonblock : file_descr -> unit

    Clear the ``non-blocking'' flag on the given descriptor. See set_nonblock.

    val set_close_on_exec : file_descr -> unit

    Set the ``close-on-exec'' flag on the given descriptor. A descriptor with the close-on-exec flag is automatically closed when the current process starts another program with one of the exec, create_process and open_process functions.

    It is often a security hole to leak file descriptors opened on, say, a private file to an external program: the program, then, gets access to the private file and can do bad things with it. Hence, it is highly recommended to set all file descriptors ``close-on-exec'', except in the very few cases where a file descriptor actually needs to be transmitted to another program.

    The best way to set a file descriptor ``close-on-exec'' is to create it in this state. To this end, the openfile function has O_CLOEXEC and O_KEEPEXEC flags to enforce ``close-on-exec'' mode or ``keep-on-exec'' mode, respectively. All other operations in the Unix module that create file descriptors have an optional argument ?cloexec:bool to indicate whether the file descriptor should be created in ``close-on-exec'' mode (by writing ~cloexec:true) or in ``keep-on-exec'' mode (by writing ~cloexec:false). For historical reasons, the default file descriptor creation mode is ``keep-on-exec'', if no cloexec optional argument is given. This is not a safe default, hence it is highly recommended to pass explicit cloexec arguments to operations that create file descriptors.

    The cloexec optional arguments and the O_KEEPEXEC flag were introduced in OCaml 4.05. Earlier, the common practice was to create file descriptors in the default, ``keep-on-exec'' mode, then call set_close_on_exec on those freshly-created file descriptors. This is not as safe as creating the file descriptor in ``close-on-exec'' mode because, in multithreaded programs, a window of vulnerability exists between the time when the file descriptor is created and the time set_close_on_exec completes. If another thread spawns another program during this window, the descriptor will leak, as it is still in the ``keep-on-exec'' mode.

    Regarding the atomicity guarantees given by ~cloexec:true or by the use of the O_CLOEXEC flag: on all platforms it is guaranteed that a concurrently-executing Caml thread cannot leak the descriptor by starting a new process. On Linux, this guarantee extends to concurrently-executing C threads. As of Feb 2017, other operating systems lack the necessary system calls and still expose a window of vulnerability during which a C thread can see the newly-created file descriptor in ``keep-on-exec'' mode.

    val clear_close_on_exec : file_descr -> unit

    Clear the ``close-on-exec'' flag on the given descriptor. See set_close_on_exec.

    Directories

    val mkdir : string -> perm:file_perm -> unit

    Create a directory with the given permissions (see umask).

    val rmdir : string -> unit

    Remove an empty directory.

    val chdir : string -> unit

    Change the process working directory.

    val getcwd : unit -> string

    Return the name of the current working directory.

    val chroot : string -> unit

    Change the process root directory.

    • raises Invalid_argument

      on Windows

    type dir_handle = Unix.dir_handle

    The type of descriptors over opened directories.

    val opendir : string -> dir_handle

    Open a descriptor on a directory

    val readdir : dir_handle -> string

    Return the next entry in a directory.

    • raises End_of_file

      when the end of the directory has been reached.

    val rewinddir : dir_handle -> unit

    Reposition the descriptor to the beginning of the directory

    val closedir : dir_handle -> unit

    Close a directory descriptor.

    Pipes and redirections

    val pipe : ?cloexec:bool -> unit -> file_descr * file_descr

    Create a pipe. The first component of the result is opened for reading, that's the exit to the pipe. The second component is opened for writing, that's the entrance to the pipe. See set_close_on_exec for documentation on the cloexec optional argument.

    val mkfifo : string -> perm:file_perm -> unit

    Create a named pipe with the given permissions (see umask).

    • raises Invalid_argument

      on Windows

    High-level process and redirection management

    val create_process : + ('a, 'b, 'c) Stdlib.Bigarray.Genarray.t

    Memory mapping of a file as a Bigarray. map_file fd ~kind ~layout ~shared ~dims returns a Bigarray of kind kind, layout layout, and dimensions as specified in dims. The data contained in this Bigarray are the contents of the file referred to by the file descriptor fd (as opened previously with openfile, for example). The optional pos parameter is the byte offset in the file of the data being mapped; it defaults to 0 (map from the beginning of the file).

    If shared is true, all modifications performed on the array are reflected in the file. This requires that fd be opened with write permissions. If shared is false, modifications performed on the array are done in memory only, using copy-on-write of the modified pages; the underlying file is not affected.

    map_file is much more efficient than reading the whole file in a Bigarray, modifying that Bigarray, and writing it afterwards.

    To adjust automatically the dimensions of the Bigarray to the actual size of the file, the major dimension (that is, the first dimension for an array with C layout, and the last dimension for an array with Fortran layout) can be given as -1. map_file then determines the major dimension from the size of the file. The file must contain an integral number of sub-arrays as determined by the non-major dimensions, otherwise Failure is raised.

    If all dimensions of the Bigarray are given, the file size is matched against the size of the Bigarray. If the file is larger than the Bigarray, only the initial portion of the file is mapped to the Bigarray. If the file is smaller than the big array, the file is automatically grown to the size of the Bigarray. This requires write permissions on fd.

    Array accesses are bounds-checked, but the bounds are determined by the initial call to map_file. Therefore, you should make sure no other process modifies the mapped file while you're accessing it, or a SIGBUS signal may be raised. This happens, for instance, if the file is shrunk.

    Invalid_argument or Failure may be raised in cases where argument validation fails.

    • since 4.06.0

    Operations on file names

    Removes the named file.

    If the named file is a directory, raises:

    • EPERM on POSIX compliant system
    • EISDIR on Linux >= 2.1.132
    • EACCESS on Windows
    val rename : src:string -> dst:string -> unit

    rename ~src ~dst changes the name of a file from src to dst, moving it between directories if needed. If dst already exists, its contents will be replaced with those of src. Depending on the operating system, the metadata (permissions, owner, etc) of dst can either be preserved or be replaced by those of src.

    link ?follow ~src ~dst creates a hard link named dst to the file named src.

    • parameter follow

      indicates whether a src symlink is followed or a hardlink to src itself will be created. On Unix systems this is done using the linkat(2) function. If ?follow is not provided, then the link(2) function is used whose behaviour is OS-dependent, but more widely available.

    • raises ENOSYS

      On Unix if ~follow:_ is requested, but linkat is unavailable.

    • raises ENOSYS

      On Windows if ~follow:false is requested.

    val realpath : string -> string

    realpath p is an absolute pathname for p obtained by resolving all extra / characters, relative path segments and symbolic links.

    • since 4.13.0

    File permissions and ownership

    type access_permission = Unix.access_permission =
    1. | R_OK
      (*

      Read permission

      *)
    2. | W_OK
      (*

      Write permission

      *)
    3. | X_OK
      (*

      Execution permission

      *)
    4. | F_OK
      (*

      File exists

      *)

    Flags for the access call.

    val chmod : string -> perm:file_perm -> unit

    Change the permissions of the named file.

    val fchmod : file_descr -> perm:file_perm -> unit

    Change the permissions of an opened file.

    • raises Invalid_argument

      on Windows

    val chown : string -> uid:int -> gid:int -> unit

    Change the owner uid and owner gid of the named file.

    • raises Invalid_argument

      on Windows

    val fchown : file_descr -> uid:int -> gid:int -> unit

    Change the owner uid and owner gid of an opened file.

    • raises Invalid_argument

      on Windows

    val umask : int -> int

    Set the process's file mode creation mask, and return the previous mask.

    • raises Invalid_argument

      on Windows

    val access : string -> perm:access_permission list -> unit

    Check that the process has the given permissions over the named file.

    On Windows: execute permission X_OK cannot be tested, just tests for read permission instead.

    • raises Unix_error

      otherwise.

    Operations on file descriptors

    val dup : ?cloexec:bool -> file_descr -> file_descr

    Return a new file descriptor referencing the same file as the given descriptor. See set_close_on_exec for documentation on the cloexec optional argument.

    val dup2 : ?cloexec:bool -> src:file_descr -> dst:file_descr -> unit

    dup2 ~src ~dst duplicates src to dst, closing dst if already opened. See set_close_on_exec for documentation on the cloexec optional argument.

    val set_nonblock : file_descr -> unit

    Set the ``non-blocking'' flag on the given descriptor. When the non-blocking flag is set, reading on a descriptor on which there is temporarily no data available raises the EAGAIN or EWOULDBLOCK error instead of blocking; writing on a descriptor on which there is temporarily no room for writing also raises EAGAIN or EWOULDBLOCK.

    val clear_nonblock : file_descr -> unit

    Clear the ``non-blocking'' flag on the given descriptor. See set_nonblock.

    val set_close_on_exec : file_descr -> unit

    Set the ``close-on-exec'' flag on the given descriptor. A descriptor with the close-on-exec flag is automatically closed when the current process starts another program with one of the exec, create_process and open_process functions.

    It is often a security hole to leak file descriptors opened on, say, a private file to an external program: the program, then, gets access to the private file and can do bad things with it. Hence, it is highly recommended to set all file descriptors ``close-on-exec'', except in the very few cases where a file descriptor actually needs to be transmitted to another program.

    The best way to set a file descriptor ``close-on-exec'' is to create it in this state. To this end, the openfile function has O_CLOEXEC and O_KEEPEXEC flags to enforce ``close-on-exec'' mode or ``keep-on-exec'' mode, respectively. All other operations in the Unix module that create file descriptors have an optional argument ?cloexec:bool to indicate whether the file descriptor should be created in ``close-on-exec'' mode (by writing ~cloexec:true) or in ``keep-on-exec'' mode (by writing ~cloexec:false). For historical reasons, the default file descriptor creation mode is ``keep-on-exec'', if no cloexec optional argument is given. This is not a safe default, hence it is highly recommended to pass explicit cloexec arguments to operations that create file descriptors.

    The cloexec optional arguments and the O_KEEPEXEC flag were introduced in OCaml 4.05. Earlier, the common practice was to create file descriptors in the default, ``keep-on-exec'' mode, then call set_close_on_exec on those freshly-created file descriptors. This is not as safe as creating the file descriptor in ``close-on-exec'' mode because, in multithreaded programs, a window of vulnerability exists between the time when the file descriptor is created and the time set_close_on_exec completes. If another thread spawns another program during this window, the descriptor will leak, as it is still in the ``keep-on-exec'' mode.

    Regarding the atomicity guarantees given by ~cloexec:true or by the use of the O_CLOEXEC flag: on all platforms it is guaranteed that a concurrently-executing Caml thread cannot leak the descriptor by starting a new process. On Linux, this guarantee extends to concurrently-executing C threads. As of Feb 2017, other operating systems lack the necessary system calls and still expose a window of vulnerability during which a C thread can see the newly-created file descriptor in ``keep-on-exec'' mode.

    val clear_close_on_exec : file_descr -> unit

    Clear the ``close-on-exec'' flag on the given descriptor. See set_close_on_exec.

    Directories

    val mkdir : string -> perm:file_perm -> unit

    Create a directory with the given permissions (see umask).

    val rmdir : string -> unit

    Remove an empty directory.

    val chdir : string -> unit

    Change the process working directory.

    val getcwd : unit -> string

    Return the name of the current working directory.

    val chroot : string -> unit

    Change the process root directory.

    • raises Invalid_argument

      on Windows

    type dir_handle = Unix.dir_handle

    The type of descriptors over opened directories.

    val opendir : string -> dir_handle

    Open a descriptor on a directory

    val readdir : dir_handle -> string

    Return the next entry in a directory.

    • raises End_of_file

      when the end of the directory has been reached.

    val rewinddir : dir_handle -> unit

    Reposition the descriptor to the beginning of the directory

    val closedir : dir_handle -> unit

    Close a directory descriptor.

    Pipes and redirections

    val pipe : ?cloexec:bool -> unit -> file_descr * file_descr

    Create a pipe. The first component of the result is opened for reading, that's the exit to the pipe. The second component is opened for writing, that's the entrance to the pipe. See set_close_on_exec for documentation on the cloexec optional argument.

    val mkfifo : string -> perm:file_perm -> unit

    Create a named pipe with the given permissions (see umask).

    • raises Invalid_argument

      on Windows

    High-level process and redirection management

    val create_process : prog:string -> args:string array -> stdin:file_descr -> @@ -51,7 +51,7 @@ domain:socket_domain -> kind:socket_type -> protocol:int -> - file_descr * file_descr

    Create a pair of unnamed sockets, connected together. See set_close_on_exec for documentation on the cloexec optional argument.

    • raises Invalid_argument

      on Windows

    val accept : ?cloexec:bool -> file_descr -> file_descr * sockaddr

    Accept connections on the given socket. The returned descriptor is a socket connected to the client; the returned address is the address of the connecting client. See set_close_on_exec for documentation on the cloexec optional argument.

    val bind : file_descr -> addr:sockaddr -> unit

    Bind a socket to an address.

    val connect : file_descr -> addr:sockaddr -> unit

    Connect a socket to an address.

    val listen : file_descr -> max:int -> unit

    Set up a socket for receiving connection requests. The integer argument is the maximal number of pending requests.

    type shutdown_command = Unix.shutdown_command =
    1. | SHUTDOWN_RECEIVE
      (*

      Close for receiving

      *)
    2. | SHUTDOWN_SEND
      (*

      Close for sending

      *)
    3. | SHUTDOWN_ALL
      (*

      Close both

      *)

    The type of commands for shutdown.

    val shutdown : file_descr -> mode:shutdown_command -> unit

    Shutdown a socket connection. SHUTDOWN_SEND as second argument causes reads on the other end of the connection to return an end-of-file condition. SHUTDOWN_RECEIVE causes writes on the other end of the connection to return a closed pipe condition (SIGPIPE signal).

    val getsockname : file_descr -> sockaddr

    Return the address of the given socket.

    val getpeername : file_descr -> sockaddr

    Return the address of the host connected to the given socket.

    type msg_flag = Unix.msg_flag =
    1. | MSG_OOB
    2. | MSG_DONTROUTE
    3. | MSG_PEEK

    The flags for recv, recvfrom, send and sendto.

    val recv : + file_descr * file_descr

    Create a pair of unnamed sockets, connected together. See set_close_on_exec for documentation on the cloexec optional argument.

    val accept : ?cloexec:bool -> file_descr -> file_descr * sockaddr

    Accept connections on the given socket. The returned descriptor is a socket connected to the client; the returned address is the address of the connecting client. See set_close_on_exec for documentation on the cloexec optional argument.

    val bind : file_descr -> addr:sockaddr -> unit

    Bind a socket to an address.

    val connect : file_descr -> addr:sockaddr -> unit

    Connect a socket to an address.

    val listen : file_descr -> max:int -> unit

    Set up a socket for receiving connection requests. The integer argument is the maximal number of pending requests.

    type shutdown_command = Unix.shutdown_command =
    1. | SHUTDOWN_RECEIVE
      (*

      Close for receiving

      *)
    2. | SHUTDOWN_SEND
      (*

      Close for sending

      *)
    3. | SHUTDOWN_ALL
      (*

      Close both

      *)

    The type of commands for shutdown.

    val shutdown : file_descr -> mode:shutdown_command -> unit

    Shutdown a socket connection. SHUTDOWN_SEND as second argument causes reads on the other end of the connection to return an end-of-file condition. SHUTDOWN_RECEIVE causes writes on the other end of the connection to return a closed pipe condition (SIGPIPE signal).

    val getsockname : file_descr -> sockaddr

    Return the address of the given socket.

    val getpeername : file_descr -> sockaddr

    Return the address of the host connected to the given socket.

    type msg_flag = Unix.msg_flag =
    1. | MSG_OOB
    2. | MSG_DONTROUTE
    3. | MSG_PEEK

    The flags for recv, recvfrom, send and sendto.

    val recv : file_descr -> buf:bytes -> pos:int -> @@ -89,7 +89,7 @@ len:int -> mode:msg_flag list -> sockaddr -> - int

    Same as sendto, but take the data from a string instead of a byte sequence.

    • since 4.02.0

    Socket options

    type socket_bool_option = Unix.socket_bool_option =
    1. | SO_DEBUG
      (*

      Record debugging information

      *)
    2. | SO_BROADCAST
      (*

      Permit sending of broadcast messages

      *)
    3. | SO_REUSEADDR
      (*

      Allow reuse of local addresses for bind

      *)
    4. | SO_KEEPALIVE
      (*

      Keep connection active

      *)
    5. | SO_DONTROUTE
      (*

      Bypass the standard routing algorithms

      *)
    6. | SO_OOBINLINE
      (*

      Leave out-of-band data in line

      *)
    7. | SO_ACCEPTCONN
      (*

      Report whether socket listening is enabled

      *)
    8. | TCP_NODELAY
      (*

      Control the Nagle algorithm for TCP sockets

      *)
    9. | IPV6_ONLY
      (*

      Forbid binding an IPv6 socket to an IPv4 address

      *)
    10. | SO_REUSEPORT
      (*

      Allow reuse of address and port bindings

      *)

    The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

    type socket_int_option = Unix.socket_int_option =
    1. | SO_SNDBUF
      (*

      Size of send buffer

      *)
    2. | SO_RCVBUF
      (*

      Size of received buffer

      *)
    3. | SO_ERROR
      (*

      Deprecated. Use getsockopt_error instead.

      *)
    4. | SO_TYPE
      (*

      Report the socket type

      *)
    5. | SO_RCVLOWAT
      (*

      Minimum number of bytes to process for input operations

      *)
    6. | SO_SNDLOWAT
      (*

      Minimum number of bytes to process for output operations

      *)

    The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

    type socket_optint_option = Unix.socket_optint_option =
    1. | SO_LINGER
      (*

      Whether to linger on closed connections that have data present, and for how long (in seconds)

      *)

    The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

    type socket_float_option = Unix.socket_float_option =
    1. | SO_RCVTIMEO
      (*

      Timeout for input operations

      *)
    2. | SO_SNDTIMEO
      (*

      Timeout for output operations

      *)

    The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

    val getsockopt : file_descr -> socket_bool_option -> bool

    Return the current status of a boolean-valued option in the given socket.

    val setsockopt : file_descr -> socket_bool_option -> bool -> unit

    Set or clear a boolean-valued option in the given socket.

    val getsockopt_int : file_descr -> socket_int_option -> int

    Same as getsockopt for an integer-valued socket option.

    val setsockopt_int : file_descr -> socket_int_option -> int -> unit

    Same as setsockopt for an integer-valued socket option.

    val getsockopt_optint : file_descr -> socket_optint_option -> int option

    Same as getsockopt for a socket option whose value is an int option.

    val setsockopt_optint : + int

    Same as sendto, but take the data from a string instead of a byte sequence.

    • since 4.02.0

    Socket options

    type socket_bool_option = Unix.socket_bool_option =
    1. | SO_DEBUG
      (*

      Record debugging information

      *)
    2. | SO_BROADCAST
      (*

      Permit sending of broadcast messages

      *)
    3. | SO_REUSEADDR
      (*

      Allow reuse of local addresses for bind

      *)
    4. | SO_KEEPALIVE
      (*

      Keep connection active

      *)
    5. | SO_DONTROUTE
      (*

      Bypass the standard routing algorithms

      *)
    6. | SO_OOBINLINE
      (*

      Leave out-of-band data in line

      *)
    7. | SO_ACCEPTCONN
      (*

      Report whether socket listening is enabled

      *)
    8. | TCP_NODELAY
      (*

      Control the Nagle algorithm for TCP sockets

      *)
    9. | IPV6_ONLY
      (*

      Forbid binding an IPv6 socket to an IPv4 address

      *)
    10. | SO_REUSEPORT
      (*

      Allow reuse of address and port bindings

      *)

    The socket options that can be consulted with getsockopt and modified with setsockopt. These options have a boolean (true/false) value.

    type socket_int_option = Unix.socket_int_option =
    1. | SO_SNDBUF
      (*

      Size of send buffer

      *)
    2. | SO_RCVBUF
      (*

      Size of received buffer

      *)
    3. | SO_ERROR
      (*

      Deprecated. Use getsockopt_error instead.

      • deprecated Use Unix.getsockopt_error instead.
      *)
    4. | SO_TYPE
      (*

      Report the socket type

      *)
    5. | SO_RCVLOWAT
      (*

      Minimum number of bytes to process for input operations

      *)
    6. | SO_SNDLOWAT
      (*

      Minimum number of bytes to process for output operations

      *)

    The socket options that can be consulted with getsockopt_int and modified with setsockopt_int. These options have an integer value.

    type socket_optint_option = Unix.socket_optint_option =
    1. | SO_LINGER
      (*

      Whether to linger on closed connections that have data present, and for how long (in seconds)

      *)

    The socket options that can be consulted with getsockopt_optint and modified with setsockopt_optint. These options have a value of type int option, with None meaning ``disabled''.

    type socket_float_option = Unix.socket_float_option =
    1. | SO_RCVTIMEO
      (*

      Timeout for input operations

      *)
    2. | SO_SNDTIMEO
      (*

      Timeout for output operations

      *)

    The socket options that can be consulted with getsockopt_float and modified with setsockopt_float. These options have a floating-point value representing a time in seconds. The value 0 means infinite timeout.

    val getsockopt : file_descr -> socket_bool_option -> bool

    Return the current status of a boolean-valued option in the given socket.

    val setsockopt : file_descr -> socket_bool_option -> bool -> unit

    Set or clear a boolean-valued option in the given socket.

    val getsockopt_int : file_descr -> socket_int_option -> int

    Same as getsockopt for an integer-valued socket option.

    val setsockopt_int : file_descr -> socket_int_option -> int -> unit

    Same as setsockopt for an integer-valued socket option.

    val getsockopt_optint : file_descr -> socket_optint_option -> int option

    Same as getsockopt for a socket option whose value is an int option.

    val setsockopt_optint : file_descr -> socket_optint_option -> int option -> diff --git a/dev/ocaml/Var_within_closure/Map/index.html b/dev/ocaml/Var_within_closure/Map/index.html index c2c10dbd..9153f9e9 100644 --- a/dev/ocaml/Var_within_closure/Map/index.html +++ b/dev/ocaml/Var_within_closure/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Var_within_closure/Set/index.html b/dev/ocaml/Var_within_closure/Set/index.html index 92ce8b40..d43da9e4 100644 --- a/dev/ocaml/Var_within_closure/Set/index.html +++ b/dev/ocaml/Var_within_closure/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Var_within_closure.Set)

    Module Var_within_closure.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Var_within_closure.Set)

    Module Var_within_closure.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Variable/Map/index.html b/dev/ocaml/Variable/Map/index.html index 5f4ca99a..03b17e9d 100644 --- a/dev/ocaml/Variable/Map/index.html +++ b/dev/ocaml/Variable/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Variable/Pair/Map/index.html b/dev/ocaml/Variable/Pair/Map/index.html index 7fad4ad9..4a7dfc26 100644 --- a/dev/ocaml/Variable/Pair/Map/index.html +++ b/dev/ocaml/Variable/Pair/Map/index.html @@ -5,7 +5,7 @@ 'b t -> 'c t

    merge f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. The presence of each such binding, and the corresponding value, is determined with the function f. In terms of the find_opt operation, we have find_opt x (merge f m1 m2) = f x (find_opt x m1) (find_opt x m2) for any key x, provided that f x None None = None.

    • since 3.12.0
    val union : (key -> 'a -> 'a -> 'a option) -> 'a t -> 'a t -> 'a t

    union f m1 m2 computes a map whose keys are a subset of the keys of m1 and of m2. When the same binding is defined in both arguments, the function f is used to combine them. This is a special case of merge: union f m1 m2 is equivalent to merge f' m1 m2, where

    • f' _key None None = None
    • f' _key (Some v) None = Some v
    • f' _key None (Some v) = Some v
    • f' key (Some v1) (Some v2) = f key v1 v2
    • since 4.03.0
    val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int

    Total ordering between maps. The first argument is a total ordering used to compare data associated with equal keys in the two maps.

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

    equal cmp m1 m2 tests whether the maps m1 and m2 are equal, that is, contain equal keys and associate them with equal data. cmp is the equality predicate used to compare the data associated with the keys.

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

    iter f m applies f to all bindings in map m. f receives the key as first argument, and the associated value as second argument. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

    val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b

    fold f m init computes (f kN dN ... (f k1 d1 init)...), where k1 ... kN are the keys of all bindings in m (in increasing order), and d1 ... dN are the associated data.

    val for_all : (key -> 'a -> bool) -> 'a t -> bool

    for_all f m checks if all the bindings of the map satisfy the predicate f.

    • since 3.12.0
    val exists : (key -> 'a -> bool) -> 'a t -> bool

    exists f m checks if at least one binding of the map satisfies the predicate f.

    • since 3.12.0
    val filter : (key -> 'a -> bool) -> 'a t -> 'a t

    filter f m returns the map with all the bindings in m that satisfy predicate p. If every binding in m satisfies f, m is returned unchanged (the result of the function is then physically equal to m)

    • since 3.12.0
    • before 4.03

      Physical equality was not ensured.

    val filter_map : (key -> 'a -> 'b option) -> 'a t -> 'b t

    filter_map f m applies the function f to every binding of m, and builds a map from the results. For each binding (k, v) in the input map:

    • if f k v is None then k is not in the result,
    • if f k v is Some v' then the binding (k, v') is in the output map.

    For example, the following function on maps whose values are lists

    filter_map
       (fun _k li -> match li with [] -> None | _::tl -> Some tl)
    -  m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : + m

    drops all bindings of m whose value is an empty list, and pops the first element of each value that is non-empty.

    • since 4.11.0
    val partition : (key -> 'a -> bool) -> 'a t -> 'a t * 'a t

    partition f m returns a pair of maps (m1, m2), where m1 contains all the bindings of m that satisfy the predicate f, and m2 is the map with all the bindings of m that do not satisfy f.

    • since 3.12.0
    val cardinal : 'a t -> int

    Return the number of bindings of a map.

    • since 3.12.0
    val bindings : 'a t -> (key * 'a) list

    Return the list of all bindings of the given map. The returned list is sorted in increasing order of keys with respect to the ordering Ord.compare, where Ord is the argument given to Map.Make.

    • since 3.12.0
    val min_binding : 'a t -> key * 'a

    Return the binding with the smallest key in a given map (with respect to the Ord.compare ordering), or raise Not_found if the map is empty.

    • since 3.12.0
    val min_binding_opt : 'a t -> (key * 'a) option

    Return the binding with the smallest key in the given map (with respect to the Ord.compare ordering), or None if the map is empty.

    • since 4.05
    val max_binding : 'a t -> key * 'a

    Same as min_binding, but returns the binding with the largest key in the given map.

    • since 3.12.0
    val max_binding_opt : 'a t -> (key * 'a) option

    Same as min_binding_opt, but returns the binding with the largest key in the given map.

    • since 4.05
    val choose : 'a t -> key * 'a

    Return one binding of the given map, or raise Not_found if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 3.12.0
    val choose_opt : 'a t -> (key * 'a) option

    Return one binding of the given map, or None if the map is empty. Which binding is chosen is unspecified, but equal bindings will be chosen for equal maps.

    • since 4.05
    val split : key -> 'a t -> 'a t * 'a option * 'a t

    split x m returns a triple (l, data, r), where l is the map with all the bindings of m whose key is strictly less than x; r is the map with all the bindings of m whose key is strictly greater than x; data is None if m contains no binding for x, or Some v if m binds v to x.

    • since 3.12.0
    val find : key -> 'a t -> 'a

    find x m returns the current value of x in m, or raises Not_found if no binding for x exists.

    val find_opt : key -> 'a t -> 'a option

    find_opt x m returns Some v if the current value of x in m is v, or None if no binding for x exists.

    • since 4.05
    val find_first : (key -> bool) -> 'a t -> key * 'a

    find_first f m, where f is a monotonically increasing function, returns the binding of m with the lowest key k such that f k, or raises Not_found if no such key exists.

    For example, find_first (fun k -> Ord.compare k x >= 0) m will return the first binding k, v of m where Ord.compare k x >= 0 (intuitively: k >= x), or raise Not_found if x is greater than any element of m.

    • since 4.05
    val find_first_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_first_opt f m, where f is a monotonically increasing function, returns an option containing the binding of m with the lowest key k such that f k, or None if no such key exists.

    • since 4.05
    val find_last : (key -> bool) -> 'a t -> key * 'a

    find_last f m, where f is a monotonically decreasing function, returns the binding of m with the highest key k such that f k, or raises Not_found if no such key exists.

    • since 4.05
    val find_last_opt : (key -> bool) -> 'a t -> (key * 'a) option

    find_last_opt f m, where f is a monotonically decreasing function, returns an option containing the binding of m with the highest key k such that f k, or None if no such key exists.

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

    map f m returns a map with same domain as m, where the associated value a of all bindings of m has been replaced by the result of the application of f to a. The bindings are passed to f in increasing order with respect to the ordering over the type of the keys.

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

    Same as map, but the function receives as arguments both the key and the associated value for each binding of the map.

    Maps and Sequences

    val to_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in ascending order of keys

    • since 4.07
    val to_rev_seq : 'a t -> (key * 'a) Stdlib.Seq.t

    Iterate on the whole map, in descending order of keys

    • since 4.12
    val to_seq_from : key -> 'a t -> (key * 'a) Stdlib.Seq.t

    to_seq_from k m iterates on a subset of the bindings of m, in ascending order of keys, from key k or above.

    • since 4.07
    val add_seq : (key * 'a) Stdlib.Seq.t -> 'a t -> 'a t

    Add the given bindings to the map, in order.

    • since 4.07
    val of_seq : (key * 'a) Stdlib.Seq.t -> 'a t

    Build a map from the given bindings

    • since 4.07
    val of_list : (key * 'a) list -> 'a t
    val disjoint_union : ?eq:('a -> 'a -> bool) -> ?print:(Stdlib.Format.formatter -> 'a -> unit) -> 'a t -> diff --git a/dev/ocaml/Variable/Pair/Set/index.html b/dev/ocaml/Variable/Pair/Set/index.html index 86f374ac..974037de 100644 --- a/dev/ocaml/Variable/Pair/Set/index.html +++ b/dev/ocaml/Variable/Pair/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Variable.Pair.Set)

    Module Pair.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Variable.Pair.Set)

    Module Pair.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Variable/Set/index.html b/dev/ocaml/Variable/Set/index.html index 13d86368..da383aec 100644 --- a/dev/ocaml/Variable/Set/index.html +++ b/dev/ocaml/Variable/Set/index.html @@ -1,2 +1,2 @@ -Set (ocaml.Variable.Set)

    Module Variable.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Stdlib.Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file +Set (ocaml.Variable.Set)

    Module Variable.Set

    include Set.S with type elt = T.t and type t = Set.Make(T).t
    type elt = T.t

    The type of the set elements.

    The type of sets.

    val empty : t

    The empty set.

    val is_empty : t -> bool

    Test whether a set is empty or not.

    val mem : elt -> t -> bool

    mem x s tests whether x belongs to the set s.

    val add : elt -> t -> t

    add x s returns a set containing all elements of s, plus x. If x was already in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val singleton : elt -> t

    singleton x returns the one-element set containing only x.

    val remove : elt -> t -> t

    remove x s returns a set containing all elements of s, except x. If x was not in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val union : t -> t -> t

    Set union.

    val inter : t -> t -> t

    Set intersection.

    val disjoint : t -> t -> bool

    Test if two sets are disjoint.

    • since 4.08.0
    val diff : t -> t -> t

    Set difference: diff s1 s2 contains the elements of s1 that are not in s2.

    val compare : t -> t -> int

    Total ordering between sets. Can be used as the ordering function for doing sets of sets.

    val equal : t -> t -> bool

    equal s1 s2 tests whether the sets s1 and s2 are equal, that is, contain equal elements.

    val subset : t -> t -> bool

    subset s1 s2 tests whether the set s1 is a subset of the set s2.

    val iter : (elt -> unit) -> t -> unit

    iter f s applies f in turn to all elements of s. The elements of s are presented to f in increasing order with respect to the ordering over the type of the elements.

    val fold : (elt -> 'a -> 'a) -> t -> 'a -> 'a

    fold f s init computes (f xN ... (f x2 (f x1 init))...), where x1 ... xN are the elements of s, in increasing order.

    val for_all : (elt -> bool) -> t -> bool

    for_all f s checks if all elements of the set satisfy the predicate f.

    val exists : (elt -> bool) -> t -> bool

    exists f s checks if at least one element of the set satisfies the predicate f.

    val filter : (elt -> bool) -> t -> t

    filter f s returns the set of all elements in s that satisfy predicate f. If f satisfies every element in s, s is returned unchanged (the result of the function is then physically equal to s).

    • before 4.03

      Physical equality was not ensured.

    val filter_map : (elt -> elt option) -> t -> t

    filter_map f s returns the set of all v such that f x = Some v for some element x of s.

    For example,

    filter_map (fun n -> if n mod 2 = 0 then Some (n / 2) else None) s

    is the set of halves of the even elements of s.

    If no element of s is changed or dropped by f (if f x = Some x for each element x), then s is returned unchanged: the result of the function is then physically equal to s.

    • since 4.11.0
    val partition : (elt -> bool) -> t -> t * t

    partition f s returns a pair of sets (s1, s2), where s1 is the set of all the elements of s that satisfy the predicate f, and s2 is the set of all the elements of s that do not satisfy f.

    val cardinal : t -> int

    Return the number of elements of a set.

    val elements : t -> elt list

    Return the list of all elements of the given set. The returned list is sorted in increasing order with respect to the ordering Ord.compare, where Ord is the argument given to Set.Make.

    val min_elt : t -> elt

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or raise Not_found if the set is empty.

    val min_elt_opt : t -> elt option

    Return the smallest element of the given set (with respect to the Ord.compare ordering), or None if the set is empty.

    • since 4.05
    val max_elt : t -> elt

    Same as min_elt, but returns the largest element of the given set.

    val max_elt_opt : t -> elt option

    Same as min_elt_opt, but returns the largest element of the given set.

    • since 4.05
    val choose : t -> elt

    Return one element of the given set, or raise Not_found if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    val choose_opt : t -> elt option

    Return one element of the given set, or None if the set is empty. Which element is chosen is unspecified, but equal elements will be chosen for equal sets.

    • since 4.05
    val split : elt -> t -> t * bool * t

    split x s returns a triple (l, present, r), where l is the set of elements of s that are strictly less than x; r is the set of elements of s that are strictly greater than x; present is false if s contains no element equal to x, or true if s contains an element equal to x.

    val find : elt -> t -> elt

    find x s returns the element of s equal to x (according to Ord.compare), or raise Not_found if no such element exists.

    • since 4.01.0
    val find_opt : elt -> t -> elt option

    find_opt x s returns the element of s equal to x (according to Ord.compare), or None if no such element exists.

    • since 4.05
    val find_first : (elt -> bool) -> t -> elt

    find_first f s, where f is a monotonically increasing function, returns the lowest element e of s such that f e, or raises Not_found if no such element exists.

    For example, find_first (fun e -> Ord.compare e x >= 0) s will return the first element e of s where Ord.compare e x >= 0 (intuitively: e >= x), or raise Not_found if x is greater than any element of s.

    • since 4.05
    val find_first_opt : (elt -> bool) -> t -> elt option

    find_first_opt f s, where f is a monotonically increasing function, returns an option containing the lowest element e of s such that f e, or None if no such element exists.

    • since 4.05
    val find_last : (elt -> bool) -> t -> elt

    find_last f s, where f is a monotonically decreasing function, returns the highest element e of s such that f e, or raises Not_found if no such element exists.

    • since 4.05
    val find_last_opt : (elt -> bool) -> t -> elt option

    find_last_opt f s, where f is a monotonically decreasing function, returns an option containing the highest element e of s such that f e, or None if no such element exists.

    • since 4.05

    Iterators

    val to_seq_from : elt -> t -> elt Stdlib.Seq.t

    to_seq_from x s iterates on a subset of the elements of s in ascending order, from x or above.

    • since 4.07
    val to_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in ascending order

    • since 4.07
    val to_rev_seq : t -> elt Stdlib.Seq.t

    Iterate on the whole set, in descending order

    • since 4.12
    val add_seq : elt Stdlib.Seq.t -> t -> t

    Add the given elements to the set, in order.

    • since 4.07
    val of_seq : elt Stdlib.Seq.t -> t

    Build a set from the given bindings

    • since 4.07
    val output : out_channel -> t -> unit
    val print : Stdlib.Format.formatter -> t -> unit
    val to_string : t -> string
    val of_list : elt list -> t
    val map : (elt -> elt) -> t -> t
    \ No newline at end of file diff --git a/dev/ocaml/Warnings/index.html b/dev/ocaml/Warnings/index.html index 01f78ed9..a54ce59e 100644 --- a/dev/ocaml/Warnings/index.html +++ b/dev/ocaml/Warnings/index.html @@ -1,2 +1,2 @@ -Warnings (ocaml.Warnings)

    Module Warnings

    Warning definitions

    Warning: this module is unstable and part of compiler-libs.

    type loc = {
    1. loc_start : Stdlib.Lexing.position;
    2. loc_end : Stdlib.Lexing.position;
    3. loc_ghost : bool;
    }
    type field_usage_warning =
    1. | Unused
    2. | Not_read
    3. | Not_mutated
    type constructor_usage_warning =
    1. | Unused
    2. | Not_constructed
    3. | Only_exported_private
    type t =
    1. | Comment_start
    2. | Comment_not_end
    3. | Fragile_match of string
    4. | Ignored_partial_application
    5. | Labels_omitted of string list
    6. | Method_override of string list
    7. | Partial_match of string
    8. | Missing_record_field_pattern of string
    9. | Non_unit_statement
    10. | Redundant_case
    11. | Redundant_subpat
    12. | Instance_variable_override of string list
    13. | Illegal_backslash
    14. | Implicit_public_methods of string list
    15. | Unerasable_optional_argument
    16. | Undeclared_virtual_method of string
    17. | Not_principal of string
    18. | Non_principal_labels of string
    19. | Ignored_extra_argument
    20. | Nonreturning_statement
    21. | Preprocessor of string
    22. | Useless_record_with
    23. | Bad_module_name of string
    24. | All_clauses_guarded
    25. | Unused_var of string
    26. | Unused_var_strict of string
    27. | Wildcard_arg_to_constant_constr
    28. | Eol_in_string
    29. | Duplicate_definitions of string * string * string * string
    30. | Module_linked_twice of string * string * string
    31. | Unused_value_declaration of string
    32. | Unused_open of string
    33. | Unused_type_declaration of string
    34. | Unused_for_index of string
    35. | Unused_ancestor of string
    36. | Unused_constructor of string * constructor_usage_warning
    37. | Unused_extension of string * bool * constructor_usage_warning
    38. | Unused_rec_flag
    39. | Name_out_of_scope of string * string list * bool
    40. | Ambiguous_name of string list * string list * bool * string
    41. | Disambiguated_name of string
    42. | Nonoptional_label of string
    43. | Open_shadow_identifier of string * string
    44. | Open_shadow_label_constructor of string * string
    45. | Bad_env_variable of string * string
    46. | Attribute_payload of string * string
    47. | Eliminated_optional_arguments of string list
    48. | No_cmi_file of string * string option
    49. | Unexpected_docstring of bool
    50. | Wrong_tailcall_expectation of bool
    51. | Fragile_literal_pattern
    52. | Misplaced_attribute of string
    53. | Duplicated_attribute of string
    54. | Inlining_impossible of string
    55. | Unreachable_case
    56. | Ambiguous_var_in_pattern_guard of string list
    57. | No_cmx_file of string
    58. | Flambda_assignment_to_non_mutable_value
    59. | Unused_module of string
    60. | Unboxable_type_in_prim_decl of string
    61. | Constraint_on_gadt
    62. | Erroneous_printed_signature of string
    63. | Unsafe_array_syntax_without_parsing
    64. | Redefining_unit of string
    65. | Unused_open_bang of string
    66. | Unused_functor_parameter of string
    67. | Match_on_mutable_state_prevent_uncurry
    68. | Unused_field of string * field_usage_warning
    69. | Missing_mli
    70. | Unused_tmc_attribute
    71. | Tmc_breaks_tailcall
    type alert = {
    1. kind : string;
    2. message : string;
    3. def : loc;
    4. use : loc;
    }
    val parse_options : bool -> string -> alert option
    val parse_alert_option : string -> unit

    Disable/enable alerts based on the parameter to the -alert command-line option. Raises Arg.Bad if the string is not a valid specification.

    val without_warnings : (unit -> 'a) -> 'a

    Run the thunk with all warnings and alerts disabled.

    val is_active : t -> bool
    val is_error : t -> bool
    val defaults_w : string
    val defaults_warn_error : string
    type reporting_information = {
    1. id : string;
    2. message : string;
    3. is_error : bool;
    4. sub_locs : (loc * string) list;
    }
    val report : t -> [ `Active of reporting_information | `Inactive ]
    val report_alert : alert -> [ `Active of reporting_information | `Inactive ]
    exception Errors
    val check_fatal : unit -> unit
    val reset_fatal : unit -> unit
    val help_warnings : unit -> unit
    type state
    val backup : unit -> state
    val restore : state -> unit
    val with_state : state -> (unit -> 'a) -> 'a
    val mk_lazy : (unit -> 'a) -> 'a Stdlib.Lazy.t

    Like Lazy.of_fun, but the function is applied with the warning/alert settings at the time mk_lazy is called.

    type description = {
    1. number : int;
    2. names : string list;
    3. description : string;
    }
    val descriptions : description list
    \ No newline at end of file +Warnings (ocaml.Warnings)

    Module Warnings

    Warning definitions

    Warning: this module is unstable and part of compiler-libs.

    type loc = {
    1. loc_start : Stdlib.Lexing.position;
    2. loc_end : Stdlib.Lexing.position;
    3. loc_ghost : bool;
    }
    val ghost_loc_in_file : string -> loc

    Return an empty ghost range located in a given file

    type field_usage_warning =
    1. | Unused
    2. | Not_read
    3. | Not_mutated
    type constructor_usage_warning =
    1. | Unused
    2. | Not_constructed
    3. | Only_exported_private
    type t =
    1. | Comment_start
    2. | Comment_not_end
    3. | Fragile_match of string
    4. | Ignored_partial_application
    5. | Labels_omitted of string list
    6. | Method_override of string list
    7. | Partial_match of string
    8. | Missing_record_field_pattern of string
    9. | Non_unit_statement
    10. | Redundant_case
    11. | Redundant_subpat
    12. | Instance_variable_override of string list
    13. | Illegal_backslash
    14. | Implicit_public_methods of string list
    15. | Unerasable_optional_argument
    16. | Undeclared_virtual_method of string
    17. | Not_principal of string
    18. | Non_principal_labels of string
    19. | Ignored_extra_argument
    20. | Nonreturning_statement
    21. | Preprocessor of string
    22. | Useless_record_with
    23. | Bad_module_name of string
    24. | All_clauses_guarded
    25. | Unused_var of string
    26. | Unused_var_strict of string
    27. | Wildcard_arg_to_constant_constr
    28. | Eol_in_string
    29. | Duplicate_definitions of string * string * string * string
    30. | Module_linked_twice of string * string * string
    31. | Unused_value_declaration of string
    32. | Unused_open of string
    33. | Unused_type_declaration of string
    34. | Unused_for_index of string
    35. | Unused_ancestor of string
    36. | Unused_constructor of string * constructor_usage_warning
    37. | Unused_extension of string * bool * constructor_usage_warning
    38. | Unused_rec_flag
    39. | Name_out_of_scope of string * string list * bool
    40. | Ambiguous_name of string list * string list * bool * string
    41. | Disambiguated_name of string
    42. | Nonoptional_label of string
    43. | Open_shadow_identifier of string * string
    44. | Open_shadow_label_constructor of string * string
    45. | Bad_env_variable of string * string
    46. | Attribute_payload of string * string
    47. | Eliminated_optional_arguments of string list
    48. | No_cmi_file of string * string option
    49. | Unexpected_docstring of bool
    50. | Wrong_tailcall_expectation of bool
    51. | Fragile_literal_pattern
    52. | Misplaced_attribute of string
    53. | Duplicated_attribute of string
    54. | Inlining_impossible of string
    55. | Unreachable_case
    56. | Ambiguous_var_in_pattern_guard of string list
    57. | No_cmx_file of string
    58. | Flambda_assignment_to_non_mutable_value
    59. | Unused_module of string
    60. | Unboxable_type_in_prim_decl of string
    61. | Constraint_on_gadt
    62. | Erroneous_printed_signature of string
    63. | Unsafe_array_syntax_without_parsing
    64. | Redefining_unit of string
    65. | Unused_open_bang of string
    66. | Unused_functor_parameter of string
    67. | Match_on_mutable_state_prevent_uncurry
    68. | Unused_field of string * field_usage_warning
    69. | Missing_mli
    70. | Unused_tmc_attribute
    71. | Tmc_breaks_tailcall
    type alert = {
    1. kind : string;
    2. message : string;
    3. def : loc;
    4. use : loc;
    }
    val parse_options : bool -> string -> alert option
    val parse_alert_option : string -> unit

    Disable/enable alerts based on the parameter to the -alert command-line option. Raises Arg.Bad if the string is not a valid specification.

    val without_warnings : (unit -> 'a) -> 'a

    Run the thunk with all warnings and alerts disabled.

    val is_active : t -> bool
    val is_error : t -> bool
    val defaults_w : string
    val defaults_warn_error : string
    type reporting_information = {
    1. id : string;
    2. message : string;
    3. is_error : bool;
    4. sub_locs : (loc * string) list;
    }
    val report : t -> [ `Active of reporting_information | `Inactive ]
    val report_alert : alert -> [ `Active of reporting_information | `Inactive ]
    exception Errors
    val check_fatal : unit -> unit
    val reset_fatal : unit -> unit
    val help_warnings : unit -> unit
    type state
    val backup : unit -> state
    val restore : state -> unit
    val with_state : state -> (unit -> 'a) -> 'a
    val mk_lazy : (unit -> 'a) -> 'a Stdlib.Lazy.t

    Like Lazy.of_fun, but the function is applied with the warning/alert settings at the time mk_lazy is called.

    type description = {
    1. number : int;
    2. names : string list;
    3. description : string;
    4. since : Stdlib.Sys.ocaml_release_info option;
    }
    val descriptions : description list
    \ No newline at end of file diff --git a/dev/ocaml/X86_ast/index.html b/dev/ocaml/X86_ast/index.html index 149fcc5b..ff4c73cb 100644 --- a/dev/ocaml/X86_ast/index.html +++ b/dev/ocaml/X86_ast/index.html @@ -1,2 +1,2 @@ -X86_ast (ocaml.X86_ast)

    Module X86_ast

    Structured representation of Intel assembly language (32 and 64 bit).

    type condition =
    1. | L
    2. | GE
    3. | LE
    4. | G
    5. | B
    6. | AE
    7. | BE
    8. | A
    9. | E
    10. | NE
    11. | O
    12. | NO
    13. | S
    14. | NS
    15. | P
    16. | NP
    type rounding =
    1. | RoundUp
    2. | RoundDown
    3. | RoundNearest
    4. | RoundTruncate
    type constant =
    1. | Const of int64
    2. | ConstThis
    3. | ConstLabel of string
    4. | ConstAdd of constant * constant
    5. | ConstSub of constant * constant
    type data_type =
    1. | NONE
    2. | REAL4
    3. | REAL8
    4. | BYTE
    5. | WORD
    6. | DWORD
    7. | QWORD
    8. | OWORD
    9. | NEAR
    10. | PROC
    type reg64 =
    1. | RAX
    2. | RBX
    3. | RCX
    4. | RDX
    5. | RSP
    6. | RBP
    7. | RSI
    8. | RDI
    9. | R8
    10. | R9
    11. | R10
    12. | R11
    13. | R12
    14. | R13
    15. | R14
    16. | R15
    type reg8h =
    1. | AH
    2. | BH
    3. | CH
    4. | DH
    type registerf =
    1. | XMM of int
    2. | TOS
    3. | ST of int
    type arch =
    1. | X64
    2. | X86
    type addr = {
    1. arch : arch;
    2. typ : data_type;
    3. idx : reg64;
    4. scale : int;
    5. base : reg64 option;
    6. sym : string option;
    7. displ : int;
    }

    Addressing modes: displ + sym + base + idx * scale (if scale = 0, idx is ignored and base must be None)

    type arg =
    1. | Imm of int64
      (*

      Operand is an immediate constant integer

      *)
    2. | Sym of string
      (*

      Address of a symbol (absolute address except for call/jmp target where it is interpreted as a relative displacement

      *)
    3. | Reg8L of reg64
    4. | Reg8H of reg8h
    5. | Reg16 of reg64
    6. | Reg32 of reg64
    7. | Reg64 of reg64
    8. | Regf of registerf
    9. | Mem of addr
    10. | Mem64_RIP of data_type * string * int
    type instruction =
    1. | ADD of arg * arg
    2. | ADDSD of arg * arg
    3. | AND of arg * arg
    4. | ANDPD of arg * arg
    5. | BSWAP of arg
    6. | CALL of arg
    7. | CDQ
    8. | CMOV of condition * arg * arg
    9. | CMP of arg * arg
    10. | COMISD of arg * arg
    11. | CQO
    12. | CVTSD2SI of arg * arg
    13. | CVTSD2SS of arg * arg
    14. | CVTSI2SD of arg * arg
    15. | CVTSS2SD of arg * arg
    16. | CVTTSD2SI of arg * arg
    17. | DEC of arg
    18. | DIVSD of arg * arg
    19. | FABS
    20. | FADD of arg
    21. | FADDP of arg * arg
    22. | FCHS
    23. | FCOMP of arg
    24. | FCOMPP
    25. | FCOS
    26. | FDIV of arg
    27. | FDIVP of arg * arg
    28. | FDIVR of arg
    29. | FDIVRP of arg * arg
    30. | FILD of arg
    31. | FISTP of arg
    32. | FLD of arg
    33. | FLD1
    34. | FLDCW of arg
    35. | FLDLG2
    36. | FLDLN2
    37. | FLDZ
    38. | FMUL of arg
    39. | FMULP of arg * arg
    40. | FNSTCW of arg
    41. | FNSTSW of arg
    42. | FPATAN
    43. | FPTAN
    44. | FSIN
    45. | FSQRT
    46. | FSTP of arg
    47. | FSUB of arg
    48. | FSUBP of arg * arg
    49. | FSUBR of arg
    50. | FSUBRP of arg * arg
    51. | FXCH of arg
    52. | FYL2X
    53. | HLT
    54. | IDIV of arg
    55. | IMUL of arg * arg option
    56. | INC of arg
    57. | J of condition * arg
    58. | JMP of arg
    59. | LEA of arg * arg
    60. | LEAVE
    61. | MOV of arg * arg
    62. | MOVAPD of arg * arg
    63. | MOVLPD of arg * arg
    64. | MOVSD of arg * arg
    65. | MOVSS of arg * arg
    66. | MOVSX of arg * arg
    67. | MOVSXD of arg * arg
    68. | MOVZX of arg * arg
    69. | MULSD of arg * arg
    70. | NEG of arg
    71. | NOP
    72. | OR of arg * arg
    73. | POP of arg
    74. | PUSH of arg
    75. | RET
    76. | ROUNDSD of rounding * arg * arg
    77. | SAL of arg * arg
    78. | SAR of arg * arg
    79. | SET of condition * arg
    80. | SHR of arg * arg
    81. | SQRTSD of arg * arg
    82. | SUB of arg * arg
    83. | SUBSD of arg * arg
    84. | TEST of arg * arg
    85. | UCOMISD of arg * arg
    86. | XCHG of arg * arg
    87. | XOR of arg * arg
    88. | XORPD of arg * arg
    type asm_line =
    1. | Ins of instruction
    2. | Align of bool * int
    3. | Byte of constant
    4. | Bytes of string
    5. | Comment of string
    6. | Global of string
    7. | Long of constant
    8. | NewLabel of string * data_type
    9. | Quad of constant
    10. | Section of string list * string option * string list
    11. | Space of int
    12. | Word of constant
    13. | External of string * data_type
    14. | Mode386
    15. | Model of string
    16. | Cfi_adjust_cfa_offset of int
    17. | Cfi_endproc
    18. | Cfi_startproc
    19. | File of int * string
    20. | Indirect_symbol of string
    21. | Loc of int * int * int
    22. | Private_extern of string
    23. | Set of string * constant
    24. | Size of string * constant
    25. | Type of string * string
    type asm_program = asm_line list
    \ No newline at end of file +X86_ast (ocaml.X86_ast)

    Module X86_ast

    Structured representation of Intel assembly language (32 and 64 bit).

    type condition =
    1. | L
    2. | GE
    3. | LE
    4. | G
    5. | B
    6. | AE
    7. | BE
    8. | A
    9. | E
    10. | NE
    11. | O
    12. | NO
    13. | S
    14. | NS
    15. | P
    16. | NP
    type rounding =
    1. | RoundUp
    2. | RoundDown
    3. | RoundNearest
    4. | RoundTruncate
    type constant =
    1. | Const of int64
    2. | ConstThis
    3. | ConstLabel of string
    4. | ConstAdd of constant * constant
    5. | ConstSub of constant * constant
    type data_type =
    1. | NONE
    2. | REAL4
    3. | REAL8
    4. | BYTE
    5. | WORD
    6. | DWORD
    7. | QWORD
    8. | OWORD
    9. | NEAR
    10. | PROC
    type reg64 =
    1. | RAX
    2. | RBX
    3. | RCX
    4. | RDX
    5. | RSP
    6. | RBP
    7. | RSI
    8. | RDI
    9. | R8
    10. | R9
    11. | R10
    12. | R11
    13. | R12
    14. | R13
    15. | R14
    16. | R15
    type reg8h =
    1. | AH
    2. | BH
    3. | CH
    4. | DH
    type registerf =
    1. | XMM of int
    2. | TOS
    3. | ST of int
    type arch =
    1. | X64
    2. | X86
    type addr = {
    1. arch : arch;
    2. typ : data_type;
    3. idx : reg64;
    4. scale : int;
    5. base : reg64 option;
    6. sym : string option;
    7. displ : int;
    }

    Addressing modes: displ + sym + base + idx * scale (if scale = 0, idx is ignored and base must be None)

    type arg =
    1. | Imm of int64
      (*

      Operand is an immediate constant integer

      *)
    2. | Sym of string
      (*

      Address of a symbol (absolute address except for call/jmp target where it is interpreted as a relative displacement

      *)
    3. | Reg8L of reg64
    4. | Reg8H of reg8h
    5. | Reg16 of reg64
    6. | Reg32 of reg64
    7. | Reg64 of reg64
    8. | Regf of registerf
    9. | Mem of addr
    10. | Mem64_RIP of data_type * string * int
    type instruction =
    1. | ADD of arg * arg
    2. | ADDSD of arg * arg
    3. | AND of arg * arg
    4. | ANDPD of arg * arg
    5. | BSWAP of arg
    6. | CALL of arg
    7. | CDQ
    8. | CMOV of condition * arg * arg
    9. | CMP of arg * arg
    10. | COMISD of arg * arg
    11. | CQO
    12. | CVTSD2SI of arg * arg
    13. | CVTSD2SS of arg * arg
    14. | CVTSI2SD of arg * arg
    15. | CVTSS2SD of arg * arg
    16. | CVTTSD2SI of arg * arg
    17. | DEC of arg
    18. | DIVSD of arg * arg
    19. | FABS
    20. | FADD of arg
    21. | FADDP of arg * arg
    22. | FCHS
    23. | FCOMP of arg
    24. | FCOMPP
    25. | FCOS
    26. | FDIV of arg
    27. | FDIVP of arg * arg
    28. | FDIVR of arg
    29. | FDIVRP of arg * arg
    30. | FILD of arg
    31. | FISTP of arg
    32. | FLD of arg
    33. | FLD1
    34. | FLDCW of arg
    35. | FLDLG2
    36. | FLDLN2
    37. | FLDZ
    38. | FMUL of arg
    39. | FMULP of arg * arg
    40. | FNSTCW of arg
    41. | FNSTSW of arg
    42. | FPATAN
    43. | FPTAN
    44. | FSIN
    45. | FSQRT
    46. | FSTP of arg
    47. | FSUB of arg
    48. | FSUBP of arg * arg
    49. | FSUBR of arg
    50. | FSUBRP of arg * arg
    51. | FXCH of arg
    52. | FYL2X
    53. | HLT
    54. | IDIV of arg
    55. | IMUL of arg * arg option
    56. | INC of arg
    57. | J of condition * arg
    58. | JMP of arg
    59. | LEA of arg * arg
    60. | LEAVE
    61. | MOV of arg * arg
    62. | MOVAPD of arg * arg
    63. | MOVLPD of arg * arg
    64. | MOVSD of arg * arg
    65. | MOVSS of arg * arg
    66. | MOVSX of arg * arg
    67. | MOVSXD of arg * arg
    68. | MOVZX of arg * arg
    69. | MULSD of arg * arg
    70. | NEG of arg
    71. | NOP
    72. | OR of arg * arg
    73. | POP of arg
    74. | PUSH of arg
    75. | RET
    76. | ROUNDSD of rounding * arg * arg
    77. | SAL of arg * arg
    78. | SAR of arg * arg
    79. | SET of condition * arg
    80. | SHR of arg * arg
    81. | SQRTSD of arg * arg
    82. | SUB of arg * arg
    83. | SUBSD of arg * arg
    84. | TEST of arg * arg
    85. | UCOMISD of arg * arg
    86. | XCHG of arg * arg
    87. | XOR of arg * arg
    88. | XORPD of arg * arg
    type asm_line =
    1. | Ins of instruction
    2. | Align of bool * int
    3. | Byte of constant
    4. | Bytes of string
    5. | Comment of string
    6. | Global of string
    7. | Long of constant
    8. | NewLabel of string * data_type
    9. | Quad of constant
    10. | Section of string list * string option * string list
    11. | Space of int
    12. | Word of constant
    13. | External of string * data_type
    14. | Mode386
    15. | Model of string
    16. | Cfi_adjust_cfa_offset of int
    17. | Cfi_endproc
    18. | Cfi_startproc
    19. | Cfi_remember_state
    20. | Cfi_restore_state
    21. | Cfi_def_cfa_register of string
    22. | Cfi_def_cfa_offset of int
    23. | File of int * string
    24. | Indirect_symbol of string
    25. | Loc of int * int * int
    26. | Private_extern of string
    27. | Set of string * constant
    28. | Size of string * constant
    29. | Type of string * string
    type asm_program = asm_line list
    \ No newline at end of file diff --git a/dev/ocaml/X86_dsl/D/index.html b/dev/ocaml/X86_dsl/D/index.html index 17f96744..5691dfc7 100644 --- a/dev/ocaml/X86_dsl/D/index.html +++ b/dev/ocaml/X86_dsl/D/index.html @@ -1,2 +1,2 @@ -D (ocaml.X86_dsl.D)

    Module X86_dsl.D

    Directives

    val align : int -> unit
    val byte : X86_ast.constant -> unit
    val bytes : string -> unit
    val cfi_adjust_cfa_offset : int -> unit
    val cfi_endproc : unit -> unit
    val cfi_startproc : unit -> unit
    val comment : string -> unit
    val data : unit -> unit
    val extrn : string -> X86_ast.data_type -> unit
    val file : file_num:int -> file_name:string -> unit
    val global : string -> unit
    val indirect_symbol : string -> unit
    val label : ?typ:X86_ast.data_type -> string -> unit
    val loc : file_num:int -> line:int -> col:int -> unit
    val long : X86_ast.constant -> unit
    val mode386 : unit -> unit
    val model : string -> unit
    val private_extern : string -> unit
    val qword : X86_ast.constant -> unit
    val section : string list -> string option -> string list -> unit
    val setvar : (string * X86_ast.constant) -> unit
    val size : string -> X86_ast.constant -> unit
    val space : int -> unit
    val text : unit -> unit
    val type_ : string -> string -> unit
    val word : X86_ast.constant -> unit
    \ No newline at end of file +D (ocaml.X86_dsl.D)

    Module X86_dsl.D

    Directives

    val align : int -> unit
    val byte : X86_ast.constant -> unit
    val bytes : string -> unit
    val cfi_adjust_cfa_offset : int -> unit
    val cfi_endproc : unit -> unit
    val cfi_startproc : unit -> unit
    val cfi_remember_state : unit -> unit
    val cfi_restore_state : unit -> unit
    val cfi_def_cfa_register : string -> unit
    val cfi_def_cfa_offset : int -> unit
    val comment : string -> unit
    val data : unit -> unit
    val extrn : string -> X86_ast.data_type -> unit
    val file : file_num:int -> file_name:string -> unit
    val global : string -> unit
    val indirect_symbol : string -> unit
    val label : ?typ:X86_ast.data_type -> string -> unit
    val loc : file_num:int -> line:int -> col:int -> unit
    val long : X86_ast.constant -> unit
    val mode386 : unit -> unit
    val model : string -> unit
    val private_extern : string -> unit
    val qword : X86_ast.constant -> unit
    val section : string list -> string option -> string list -> unit
    val setvar : (string * X86_ast.constant) -> unit
    val size : string -> X86_ast.constant -> unit
    val space : int -> unit
    val text : unit -> unit
    val type_ : string -> string -> unit
    val word : X86_ast.constant -> unit
    \ No newline at end of file diff --git a/dev/ocaml/X86_dsl/index.html b/dev/ocaml/X86_dsl/index.html index 8bd46e69..0eee99fe 100644 --- a/dev/ocaml/X86_dsl/index.html +++ b/dev/ocaml/X86_dsl/index.html @@ -1,5 +1,5 @@ -X86_dsl (ocaml.X86_dsl)

    Module X86_dsl

    Helpers for Intel code generators

    val sym : string -> X86_ast.arg
    val nat : nativeint -> X86_ast.arg
    val int : int -> X86_ast.arg
    val const_32 : int32 -> X86_ast.constant
    val const_nat : nativeint -> X86_ast.constant
    val const : int -> X86_ast.constant
    val al : X86_ast.arg
    val ah : X86_ast.arg
    val cl : X86_ast.arg
    val ax : X86_ast.arg
    val rax : X86_ast.arg
    val r10 : X86_ast.arg
    val r11 : X86_ast.arg
    val r13 : X86_ast.arg
    val r14 : X86_ast.arg
    val r15 : X86_ast.arg
    val rsp : X86_ast.arg
    val rbp : X86_ast.arg
    val xmm15 : X86_ast.arg
    val eax : X86_ast.arg
    val ebx : X86_ast.arg
    val ecx : X86_ast.arg
    val edx : X86_ast.arg
    val ebp : X86_ast.arg
    val esp : X86_ast.arg
    val st0 : X86_ast.arg
    val st1 : X86_ast.arg
    val mem32 : +X86_dsl (ocaml.X86_dsl)

    Module X86_dsl

    Helpers for Intel code generators

    val sym : string -> X86_ast.arg
    val nat : nativeint -> X86_ast.arg
    val int : int -> X86_ast.arg
    val const_32 : int32 -> X86_ast.constant
    val const_nat : nativeint -> X86_ast.constant
    val const : int -> X86_ast.constant
    val al : X86_ast.arg
    val ah : X86_ast.arg
    val cl : X86_ast.arg
    val ax : X86_ast.arg
    val rax : X86_ast.arg
    val rdx : X86_ast.arg
    val r10 : X86_ast.arg
    val r11 : X86_ast.arg
    val r12 : X86_ast.arg
    val r13 : X86_ast.arg
    val r14 : X86_ast.arg
    val r15 : X86_ast.arg
    val rsp : X86_ast.arg
    val rbp : X86_ast.arg
    val xmm15 : X86_ast.arg
    val eax : X86_ast.arg
    val ebx : X86_ast.arg
    val ecx : X86_ast.arg
    val edx : X86_ast.arg
    val ebp : X86_ast.arg
    val esp : X86_ast.arg
    val st0 : X86_ast.arg
    val st1 : X86_ast.arg
    val mem32 : X86_ast.data_type -> ?scale:int -> ?base:X86_ast.reg64 -> diff --git a/dev/ocaml/X86_proc/index.html b/dev/ocaml/X86_proc/index.html index 35eff32a..75c7809a 100644 --- a/dev/ocaml/X86_proc/index.html +++ b/dev/ocaml/X86_proc/index.html @@ -1,5 +1,5 @@ -X86_proc (ocaml.X86_proc)

    Module X86_proc

    Definitions shared between the 32 and 64 bit Intel backends.

    Helpers for textual emitters

    val string_of_reg8l : X86_ast.reg64 -> string
    val string_of_reg8h : X86_ast.reg8h -> string
    val string_of_reg16 : X86_ast.reg64 -> string
    val string_of_reg32 : X86_ast.reg64 -> string
    val string_of_reg64 : X86_ast.reg64 -> string
    val string_of_registerf : X86_ast.registerf -> string
    val string_of_string_literal : string -> string
    val string_of_condition : X86_ast.condition -> string
    val string_of_symbol : string -> string -> string
    val string_of_rounding : X86_ast.rounding -> string
    val buf_bytes_directive : Stdlib.Buffer.t -> string -> string -> unit

    Buffer of assembly code

    val emit : X86_ast.instruction -> unit
    val directive : X86_ast.asm_line -> unit
    val reset_asm_code : unit -> unit

    Code emission

    val generate_code : (X86_ast.asm_line list -> unit) option -> unit

    Post-process the stream of instructions. Dump it (using the provided syntax emitter) in a file (if provided) and compile it with an internal assembler (if registered through register_internal_assembler).

    val assemble_file : string -> string -> int

    Generate an object file corresponding to the last call to generate_code. An internal assembler is used if available (and the input file is ignored). Otherwise, the source asm file with an external assembler.

    System detection

    type system =
    1. | S_macosx
    2. | S_gnu
    3. | S_cygwin
    4. | S_solaris
    5. | S_win32
    6. | S_linux_elf
    7. | S_bsd_elf
    8. | S_beos
    9. | S_mingw
    10. | S_win64
    11. | S_linux
    12. | S_mingw64
    13. | S_unknown
    val system : system
    val masm : bool
    val windows : bool
    val use_plt : bool

    Whether calls need to go via the PLT.

    Support for plumbing a binary code emitter

    val register_internal_assembler : +X86_proc (ocaml.X86_proc)

    Module X86_proc

    Definitions shared between the 32 and 64 bit Intel backends.

    Helpers for textual emitters

    val string_of_reg8l : X86_ast.reg64 -> string
    val string_of_reg8h : X86_ast.reg8h -> string
    val string_of_reg16 : X86_ast.reg64 -> string
    val string_of_reg32 : X86_ast.reg64 -> string
    val string_of_reg64 : X86_ast.reg64 -> string
    val string_of_registerf : X86_ast.registerf -> string
    val string_of_string_literal : string -> string
    val string_of_condition : X86_ast.condition -> string
    val string_of_symbol : string -> string -> string
    val string_of_rounding : X86_ast.rounding -> string
    val buf_bytes_directive : Stdlib.Buffer.t -> string -> string -> unit

    Buffer of assembly code

    val emit : X86_ast.instruction -> unit
    val directive : X86_ast.asm_line -> unit
    val reset_asm_code : unit -> unit

    Code emission

    val generate_code : (X86_ast.asm_line list -> unit) option -> unit

    Post-process the stream of instructions. Dump it (using the provided syntax emitter) in a file (if provided) and compile it with an internal assembler (if registered through register_internal_assembler).

    val assemble_file : string -> string -> int

    Generate an object file corresponding to the last call to generate_code. An internal assembler is used if available (and the input file is ignored). Otherwise, the source asm file with an external assembler.

    System detection

    type system =
    1. | S_macosx
    2. | S_gnu
    3. | S_cygwin
    4. | S_solaris
    5. | S_win32
    6. | S_linux_elf
    7. | S_bsd_elf
    8. | S_beos
    9. | S_mingw
    10. | S_win64
    11. | S_linux
    12. | S_mingw64
    13. | S_freebsd
    14. | S_netbsd
    15. | S_openbsd
    16. | S_unknown
    val system : system
    val masm : bool
    val windows : bool
    val use_plt : bool

    Whether calls need to go via the PLT.

    Support for plumbing a binary code emitter

    val register_internal_assembler : (X86_ast.asm_program -> string -> unit) -> unit
    val with_internal_assembler : (X86_ast.asm_program -> string -> unit) -> diff --git a/dev/ocaml/_doc-dir/Changes b/dev/ocaml/_doc-dir/Changes index a91fe1ec..776f6e7a 100644 --- a/dev/ocaml/_doc-dir/Changes +++ b/dev/ocaml/_doc-dir/Changes @@ -1,24 +1,423 @@ -OCaml 4.14.1 (20 December 2022) ------------------------------- +OCaml 5.0 (16 December 2022) +---------------------------- -### Bug fixes: +- #10831: Multicore OCaml + (Enguerrand Decorne, Stephen Dolan, Tom Kelly, Sadiq Jaffer, + Anil Madhavapeddy, Sudha Parimala, KC Sivaramakrishnan, + Leo White, the Tarides multicore team, + review by Florian Angeletti, Damien Doligez, Xavier Leroy, + Guillaume Munch-Maccagnoni, Olivier Nicole, Nicolás Ojeda Bär, + Gabriel Scherer, the OCaml core development team, and many + other valued reviewers.) -- #11803, #11808: on x86, the destination of an integer comparison must be - a register, it cannot be a stack slot. - (Vincent Laviron, review by Xavier Leroy, report by - Emilio Jesús Gallego Arias) +### Language features: +### Runtime system: -OCaml 4.14.1 ------------------------------ +- #11400: Runtime events counters fixes + Fixes mismatch between OCaml and C APIs, removes events from 4.x that + are not present in the 5.0 GC and adds some missing probes. + (Sadiq Jaffer, review by Gabriel Scherer, Florian Angeletti) + +- #11368: Runtime events buffer size OCAMLRUNPARAMS fix + The runtime events buffer size can now be set via the 'e' OCAMLRUNPARAM. + This is previously mistakenly enabled/disabled tracing instead. + (Sadiq Jaffer, review by KC Sivaramakrishnan, David Allsopp, Damien Doligez) + +- #11308: Add environment variable to preserve runtime_events after exit + If the environment variable OCAML_RUNTIME_EVENTS_PRESERVE exists then the + runtime will not remove the runtime events ring buffers at exit. This + makes tracing very short running programs more reliable. + (Sadiq Jaffer, review by KC Sivaramakrishnan) + +- #10964: Ring-buffer based runtime tracing (runtime_events) + Runtime_events is a very low overhead runtime tracing system designed for + continuous monitoring of OCaml applications. + (Sadiq Jaffer, review by Anil Madhavapeddy, Enguerrand Decorne, + Richard Warburton, Gabriel Scherer, Sabine Schmaltz, Florian Angeletti, + Patrick Ferris, Tom Kelly) + +* #10723: do not use `-flat-namespace` linking for macOS. + (Carlo Cabrera, review by Damien Doligez) + +* #10863, #10933: Remove support for old, unprefixed C runtime function names + such as `alloc`. The new names prefixed with `caml_` must be used instead, + such as `caml_alloc`. Consequently, it is no longer needed to define + `CAML_NAME_SPACE` to avoid bringing unprefixed names into scope: this is now + the default behavior. + (Nicolás Ojeda Bär, review by Xavier Leroy) + +- #10902: Do not register empty code fragments in natdynlink. + (David Allsopp, review by Xavier Leroy and Damien Doligez) + +- #10965: `caml_fatal_error_hook`, GC timing hooks, and + `caml_scan_roots_hook` are now atomic variables. Restore GC timing + hooks in multicore. + (Guillaume Munch-Maccagnoni, review by Enguerrand Decorne, Xavier + Leroy, Gabriel Scherer, and KC Sivaramakrishnan) + +- #11209: Add a public and thread-safe timing hook running at domain + termination, after this domain has stopped running any OCaml code: + `caml_domain_terminated_hook`. This can be useful for implementing + domain-local state in C. + (Guillaume Munch-Maccagnoni, review by Xavier Leroy and Gabriel + Scherer) + +- #10875, #11731: Add option to allocate fiber stacks and sigaltstacks with + mmap(MAP_STACK) instead of malloc. This is exposed via a configure + --enable-mmap-map-stack option, and is enabled by default on OpenBSD where + it is mandatory. + (Anil Madhavapeddy, review by Gabriel Scherer, Tom Kelly, + Michael Hendricks and KC Sivaramakrishnan). + +- #10950: Do not use mmap to allocate Caml_state. + In order to reduce virtual memory usage, we dynamically allocate + the domain_state structure. + (Enguerrand Decorne, KC Sivaramakrishnan and Tom Kelly, + review by Anil Madhavapeddy and Gabriel Scherer) + +- #11010: Use strerror_r for reentrant error string conversion. + (Anil Madhavapeddy and Xavier Leroy, review by same and Edwin Török) + +- #11002, #11066, #11086: Do not use Begin_roots/End_roots macros in + the runtime system. Also fix a missing root registration in the + implementation of Unix.write on Windows. + (Nicolás Ojeda Bär, Daniel Bünzli and Antonin Décimo, + review by Xavier Leroy and David Allsopp) + +- #11022: Track GC work for all managed bigarray allocations + (Stephen Dolan, report by Andrew Hunter, review by Damien Doligez) + +- #10802: Use 4.12 value macros and helpers in C code + (Antonin Décimo, review by Gabriel Scherer) + +- #11105: Fix handling of fiber stack cache with multiple domains + (Jon Ludlam, KC Sivaramakrishnan and Tom Kelly) + +- #11054: Respect user provided maximum stack space + Make sure the stack we initially request is sized accordingly to + the user provided settings. tmc/stack_space is also updated by + this PR in order to account for this change. + (Enguerrand Decorne, report by Jon Ludlam, + review by Tom Kelly, KC Sivaramakrishnan and Gabriel Scherer) + +- #11238: Increase the default limit for the stack size to 128 Mi words, + i.e. 1 Gib for 64-bit platforms and 512 Mib for 32-bit platforms. + (Xavier Leroy, review by Sébastien Hinderer) + +* #11295: An ISO C 2011 compliant compiler, including full support for atomic + types, is now required to build the OCaml runtime system. + (Xavier Leroy, review by David Allsopp and Sébastien Hinderer) + +- #10915, #11039, #11057, #11095, #11190: Implement quality treatment for + asynchronous actions in multicore. Reimplement the old behaviour of + `caml_process_pending*` for multicore. + (Guillaume Munch-Maccagnoni, review by Sadiq Jaffer and Gabriel Scherer) + +- #11303: Ensure that GC is not invoked from bounds check failures + (Stephen Dolan, review by Sadiq Jaffer and Xavier Leroy) + +- #11304: Fix data race on Windows file descriptors + (Olivier Nicole and Xavier Leroy, review by Xavier Leroy, David Allsopp, + and Sadiq Jaffer) + +* #11337: pass 'flags' metadata to root scanners, to optimize stack + scanning in the bytecode interpreter. + Changes the interface of user-provided root-scanning hooks. + (Gabriel Scherer, review by Xavier Leroy, + Guillaume Munch-Maccagnoni, Sadiq Jaffer and Tom Kelly) + +- #11144: Restore frame-pointers support for amd64 + (Fabrice Buoro, review by Frederic Bour and KC Sivaramakrishnan) + +* #11255: in the C interface, `&Field(v, i)` now has type `volatile value *` + instead of `value *` in OCaml 4. This makes the memory model + for mixed OCaml/C code better defined, but can cause warnings or type + errors in user C code. + (KC Sivaramakrishnan, review by Xavier Leroy, Gabriel Scherer and + Guillaume Munch-Maccagnoni, additional discussions with Stephen + Dolan and Luc Maranget) + +- #5299, #4787, #11138, #11272, #11506: To help debugging, `Caml_state` + now dynamically checks that the domain lock is held, and fails + otherwise (with a fatal error at most entry points of the C API, or + systematically in debug mode). A new variable `Caml_state_opt` is + introduced, and is `NULL` when the domain lock is not held. This + allows to test from C code if the current thread holds the lock of + its domain. + (Guillaume Munch-Maccagnoni, review by Florian Angeletti, Damien + Doligez, Sadiq Jaffer, Xavier Leroy, and Gabriel Scherer) + +- #11223: The serialization format of custom blocks changed in 4.08, + but the deserializer would still support the pre-4.08 format. OCaml + 5.x removed support for this old format; provide a clear error message + in this case. + (Hugo Heuzard, review by Gabriel Scherer) + +- #11504, #11522: Use static allocation in `caml_make_float_vect` in + no-flat-float-array mode, it's more efficient and avoids a a race condition + (Xavier Leroy, report by Guillaume Munch-Maccagnoni, review by David Allsopp) + +- #11652: Fix benign off-by-one error in Windows implementation of caml_mem_map. + (David Allsopp, review by Gabriel Scherer) + +- #11669, #11704: Fix construction of Effect.Unhandled exceptions in the + bytecode interpreter. + (David Allsopp and Xavier Leroy, report by Samuel Hym, review by Xavier Leroy + and Gabriel Scherer) + +### Code generation and optimizations: + +- #10972: ARM64 multicore support: OCaml & C stack separation; + dynamic stack size checks; fiber and effects support. + (Tom Kelly and Xavier Leroy, review by KC Sivaramakrishnan, Xavier Leroy + Guillaume Munch-Maccagnoni, Eduardo Rafael, Stephen Dolan and + Gabriel Scherer) + +* #10845 Emit frametable size on amd64 BSD (OpenBSD, FreeBSD, NetBSD) systems + (emitted for Linux in #8805) + (Hannes Mehnert, review by Nicolás Ojeda Bär) + +### Standard library: + +- #10742: Use LXM as the pseudo-random number generator for module Random. + Add `Random.State.split` and `Random.split` to "split" a PRNG off + another PRNG. + (Xavier Leroy, review by Gabriel Scherer and Hugo Heuzard) + +* #10867, #11345: Remove deprecated values: Array.create, Array.make_float, + Array.create_matrix, Bytes.uppercase, Bytes.lowercase, Bytes.capitalize, + Bytes.uncapitalize, Char.lowercase, Char.uppercase, Filename.temp_dir_name, + Int32.format, Int64.format, Nativeint.format, Format.bprintf, Format.kprintf, + Format.set_all_formatter_output_functions, + Format.get_all_formatter_output_functions, + Format.pp_set_all_formatter_output_functions, + Format.pp_get_all_formatter_output_functions, Format.pp_open_tag, + Format.pp_close_tag, Format.open_tag, Format.close_tag, + Format.formatter_tag_functions, Format.pp_set_formatter_tag_functions, + Format.pp_get_formatter_tag_functions, Format.set_formatter_tag_functions, + Format.get_formatter_tag_functions, Gc (mutability of the fields of type + Gc.control), Lazy.lazy_from_fun, Lazy.lazy_from_val, Lazy.lazy_is_val, + Obj.set_tag, Obj.truncate, Obj.final_tag, Obj.extension_constructor, + Obj.extension_name, Obj.extension_id, Scanf.stdib, Scanf.fscanf, + Scanf.kfscanf, Stdlib.( & ), Stdlib.( or ), String.set, String.copy, + String.fill, String.unsafe_set, String.unsafe_fill, String.uppercase, + String.lowercase, String.capitalize, String.uncapitalize, Thread.kill, + Thread.wait_write, Thread.wait_read, the whole ThreadUnix module, the + infix operator (.[]<-). + (Nicolás Ojeda Bär, review by Damien Doligez) + +* #10896: Remove Stream, Genlex and Pervasives. Also remove legacy standalone + bigarray library (the Bigarray module is now part of the standard library). + (Nicolás Ojeda Bär, review by Kate Deplaix and Anil Madhavapeddy) + +- #10921: Use getentropy, when available, to seed the generator during + `Random.self_init` + (Michael Hendricks, review by Gabriel Scherer, Xavier Leroy, and + Anil Madhavapeddy) + +* #10924: Add deprecated attribute to Printexc.catch, Printf.kprintf and + Unix.SO_ERROR. + (Nicolás Ojeda Bär, review by Damien Doligez) + +- #10986: Add Scanf.sscanf_opt, Scanf.bscanf_opt and Scanf.scanf_opt. + (Nicolás Ojeda Bär, review by Florian Angeletti and Gabriel Scherer) + +* #11157: Rename "hash" in the "Hashtbl.SeededHashedType" signature to + "seeded_hash". This allows defining both seeded and unseeded hash functions in + the same module. + (Nicolás Ojeda Bär, review by Gabriel Scherer and Xavier Leroy) + +- #8878: Add String.hash and String.seeded_hash. + (Tom Kelly, review by Alain Frisch and Nicolás Ojeda Bär) + +### Other libraries: + +* #9071, #9100, #10935: Reimplement `Thread.exit()` as raising the + exception `Thread.Exit`, and mark `Thread.exit` as deprecated. + The new implementation changes the behavior compared with + the OCaml 4 implementation. For example, the new implementation + causes `Fun.finally` finalizers to be run and catch-all exception + handlers to prevent termination. + (Jacques-Henri Jourdan and Xavier Leroy, review by Damien Doligez, + Guillaume Munch-Maccagnoni, Gabriel Scherer, and Enguerrand Decorne) + +- #11034: Dynlink library, add a global lock to make dynlinking + thread-safe. + (Florian Angeletti, review by Gabriel Scherer) + +- #11087: deprecate Thread.wait_timed_read, Thread.wait_timed_write, + Thread.select, Thread.wait_pid. The same functionality is available in the + Unix module. + (Nicolás Ojeda Bär, review by Anil Madhavapeddy) + +- #11309, #11424, #11427, #11545: Add Domain.recommended_domain_count. + (Christiano Haesbaert, Konstantin Belousov, review by David Allsopp, + KC Sivaramakrishnan, Gabriel Scherer, Nicolas Ojeda Bar) + +- #11461, #11466: Fix gethostbyaddr for IPv6 arguments and make it domain-safe + (Olivier Nicole, Nicolás Ojeda Bär, David Allsopp and Xavier Leroy, + review by the same) + +- #11479: Make Unix.symlink domain-safe on Windows + (Olivier Nicole, review by Xavier Leroy and David Allsopp) + +### Tools: + +* #11004: Litmus tests for checking the implementation of the + memory model. + (Luc Maranget, review by Gabriel Scherer and Xavier Leroy) + +- #11024: Handle alerts in ocamldoc. + The alert `[@@alert deprecated]` is handled specifically and it's no longer + needed to duplicate the deprecated annotation (the alert for the compiler and + the tag for the documentation). Every other alerts also appear in the + documentation. + (Jules Aguillon, review by Florian Angeletti) + +- #11065: Port the bytecode debugger to 5.0, adding support for effect handlers. + (Damien Doligez and @fabbing, review by @fabbing and Xavier Leroy) + +- #11079: Add the -nobanners option to dumpobj. + (Sébastien Hinderer, review by Gabriel Scherer and Vincent Laviron) + +- #11100: Fix ocamltest to make sure failed tests are not counted as + "unexpected error". + (Damien Doligez, review by Sébastien Hinderer) + +- #11245: Merge the common code of ocamlcp and ocamloptp into a single module. + (David Allsopp, review by Sébastien Hinderer) + +- #11382: OCamlmktop use a new initialization module "OCamlmktop_init" to + preserve backward-compatibility with user-module provided modules that install + toplevel printers. + (Florian Angeletti, review by Gabriel Scherer and David Allsopp) + +### Manual and documentation: + +- #11058: runtime/HACKING.adoc tips on debugging the runtime + (Gabriel Scherer, review by Enguerrand Decorne and Nicolás Ojeda Bär) + +- #11093: Add an effect handlers tutorial + (KC Sivaramakrishnan, review by François Pottier, Gabriel Scherer, François + Bobot and Wiktor Kuchta) + +- #11192: Better documentation for condition variables. + (François Pottier, review by Luc Maranget, Xavier Leroy, and Wiktor Kuchta) + +- #11093: Add tutorials on parallelism features and the relaxed memory model + (KC Sivaramakrishnan, review by Damien Doligez, Anil Madhavapeddy, Gabriel + Scherer, Thomas Leonard, Tom Ridge, Xavier Leroy, Luc Maranget, Fabrice + Buoro, Olivier Nicole, Guillaume Munch-Maccagnoni, Jacques-Henri Jourdan) + +- #11640: Add Flambda commonly-used options to the ocamlopt manpage + (Amandine Nangah, review by David Allsopp, Florian Angeletti, + Sébastien Hinderer, and Vincent Laviron) + +- #11676: Fix missing since annotation in the `Sys` and `Format` modules + (Github user Bukolab99, review by Florian Angeletti) + +- #11813: Make new multicore chapters easier to discover, and emphasize impact + on C bindings. + (Edwin Török, review by KC Sivaramakrishnan, and Florian Angeletti) ### Compiler user-interface and warnings: +- #9140, #11131: New command-line flag -nocwd to not include implicit + the current directory to the load path. + (Thomas Roglin, review by Gabriel Scherer and Nicolás Ojeda Bär) + +- #11089: Add 'since ' information to compiler warnings. + (André Maroneze, review by Florian Angeletti and Gabriel Scherer) + +- #10909: Disable warning 59 (assignment to immutable blocks) unless flambda + invariant checks are enabled. + (Vincent Laviron, review by Gabriel Scherer) + +- #10981, #11276: Implement a -cmi-file option for ocamlc and ocamlopt. + (Sébastien Hinderer, review by Damien Doligez, Daniel Bünzli and + Florian Angeletti) + +* #11049: Stop padding 1-digit compiler minor version numbers. + (So for instance OCaml 5.0 rather than 5.00) + (Sébastien Hinderer, review by David Allsopp, Florian Angeletti and + Xavier Leroy) + - #11184, #11670: Stop calling ranlib on created / installed libraries (Sébastien Hinderer and Xavier Leroy, review by the same) +- #11253: Deprecate `ocaml script` and `ocamlnat` script where `script` has no + extension and is an implicit basename. + (David Allsopp, review by Florian Angeletti and Sébastien Hinderer) + +### Internal/compiler-libs changes: + +- #10878, #10909: restore flambda after the Multicore merge. + (Vincent Laviron, review by Gabriel Scherer and Xavier Leroy) + +- #10864, #10888: restore afl-fuzz mode for sequential programs. + (Jan Midtgaard, review by Xavier Leroy and Gabriel Scherer) + +- #11008, #11047: rework GC statistics in the Multicore runtime + (Gabriel Scherer, review by Enguerrand Decorne) + +- #11058: basic debugging documentation in runtime/HACKING.adoc + (Gabriel Scherer, review by Enguerrand Decorne and Nicolás Ojeda Bär) + +- #11199: Stop installing topdirs.cmi twice. The toplevel now reads topdirs.cmi + from +compiler-libs, as the debugger does. + (David Allsopp, review by Sébastien Hinderer) + +- #11007, #11399: META files for the stdlib, compiler-libs and other libraries + (unix, dynlink, str, runtime_events, threads, ocamldoc) are now installed + along with the compiler. + (David Allsopp, Florian Angeletti, Nicolás Ojeda Bär and Sébastien Hinderer, + review by Daniel Bünzli, Kate Deplaix, Anil Madhavapeddy and Gabriel Scherer) + ### Build system: +* #10893: Remove configuration options --disable-force-safe-string and + DEFAULT_STRING=unsafe as well as --enable-force-safe-string and + DEFAULT_STRING=safe which are now the default unconditionally. + (Kate Deplaix, review by Gabriel Scherer and David Allsopp) + +- #11092: Build native-code compilers on OpenBSD/aarch64. + (Christopher Zimmermann, review by Anil Madhavapeddy) + +- #11126: Build system: make it possible to choose which ocamldep + (and flags) to use when computing dependencies for the compiler. + Add a -no-slash option to ocamldep to let users override -slash. + (Sébastien Hinderer, review by David Allsopp) + +- #11147: Factorize the stdlib-related compilation flags. Make it + possible to control them consistently through the STDLIBFLAGS + build variable. Make sure ocamldoc and ocamllex get compiled and + linked with debugging information (-g). + (Sébastien Hinderer, review by Gabriel Scherer) + +- #11149: Make the bootstrap process reproducible on systems with non-big-endian + floating point. If the boot/ artefacts are up-to-date, this means that running + make bootstrap on any platform should not change the images in boot/ and paves + the way for automated testing that the bootstrap is repeatable. + (David Allsopp, review by Damien Doligez and Sébastien Hinderer) + +- #11160: otherlibs: merge win32unix into unix. + (Sébastien Hinderer, review by David Allsopp, Nicolás Ojeda Bär, + Xavier Leroy, Vincent Laviron and Antonin Décimo) + +* #11198, #11298: Install the Dynlink, Str and Unix libraries to individual + subdirectories of LIBDIR. The compiler, debugger and toplevel automatically + add `-I +lib` if required, but display an alert. + (David Allsopp, review by Florian Angeletti, Nicolás Ojeda Bär, + Valentin Gatien-Baron and Sébastien Hinderer) + +- #11200: Install ocamlprof's Profiling runtime module to a +profiling, + removing it from the default namespace. + (David Allsopp, review by Sébastien Hinderer) + +- #11294: Switch minimum required autoconf to 2.71. + (David Allsopp, review by Xavier Leroy) + - #11370, #11373: Don't pass CFLAGS to flexlink during configure. (David Allsopp, report by William Hu, review by Xavier Leroy and Sébastien Hinderer) @@ -26,23 +425,75 @@ OCaml 4.14.1 - #11487: Thwart FMA test optimization during configure (William Hu, review by David Allsopp and Sébastien Hinderer) +- #11097: Build native-code compilers on NetBSD/aarch64 + (Kate Deplaix, review by Anil Madhavapeddy) + ### Bug fixes: - #10768, #11340: Fix typechecking regression when combining first class modules and GADTs. (Jacques Garrigue, report by François Thiré, review by Matthew Ryan) +- #10790: don't drop variance and injectivity annotations when pretty printing + `with` constraints (for example, `with type +!'a t = ...`). + (Florian Angeletti, report by Luke Maurer, review by Matthew Ryan and + Gabriel Scherer) + +- #11167: Fix memory leak from signal stack. + (Antoni Żewierżejew, review by Gabriel Scherer and Enguerrand Decorne) + +- #11112: harden -use-runtime against spaces or quotes in the provided path + (Gabriel Scherer, report by Brahima Dibassi, review by David Allsopp) + +- #11068, #11070: Fix typo in function name given in Unix_error exception for + Unix.readlink on Windows. + (David Allsopp, report by Xia Li-yao) + +- #10807: Don't duplicate standard handles in the child process + spawned by win32unix Unix.create_process if the handles were already + inheritable. Fix broken signalling of EOF on standard handles if + they were already inheritable. + (Antonin Décimo, review by Xavier Leroy and Nicolás Ojeda Bär) + +- #10868: Fix off-by-1 bug when initializing frame hashtables + (Jonah Beckford, review by Tom Kelly, Nicolás Ojeda Bär and + KC Sivaramakrishnan) + +- #11077: Make dumpobj compatible with absence of naked pointer support + (Olivier Nicole and Jan Midtgaard, review by Gabriel Scherer) + +- #11111: fix fork() usage in ocamltest C code. + When calling fork() from C code with the Multicore runtime active, + one needs to call caml_atfork_hook() on the forked child before it + can use the OCaml runtime. + (Gabriel Scherer, review by Xavier Leroy, report by Brahima Dibassi) + +- #10809: Use the WSA_FLAG_NO_HANDLE_INHERIT on Windows when creating + sockets with WSASocket if the cloexec (non-inheritable) parameter is + true. Fixes a race condition where a child process could inherit the + socket and deadlock the parent. + (Antonin Décimo, review by Xavier Leroy) + +- #11194, #11609: Fix inconsistent type variable names in "unbound type var" + messages + (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and + Gabriel Scherer) + - #11204: Fix regression introduced in 4.14.0 that would trigger Warning 17 when calling virtual methods introduced by constraining the self type from within the class definition. (Nicolás Ojeda Bär, review by Leo White) -- #11263, #11267: caml/{memory,misc}.h: check whether `_MSC_VER` is defined - before using it to ensure that the headers can always be used in code which - turns on -Wundef (or equivalent). +- #11263, #11267: caml/misc.h: check whether `_MSC_VER` is defined before using + it to ensure that the headers can always be used in code which turns on + -Wundef (or equivalent). (David Allsopp and Nicolás Ojeda Bär, review by Nicolás Ojeda Bär and Sébastien Hinderer) +- #11289, #11405: fix some leaks on systhread termination + (Fabrice Buoro, Enguerrand Decorne, Gabriel Scherer, + review by Xavier Leroy and Florian Angeletti, report by Romain Beauxis) + - #11314, #11416: fix non-informative error message for module inclusion (Florian Angeletti, report by Thierry Martinez, review by Gabriel Scherer) @@ -64,21 +515,34 @@ OCaml 4.14.1 mingw-w64 i686 port. (David Allsopp, review by Xavier Leroy and Sébastien Hinderer) -- #11489, #11496: More prudent deallocation of alternate signal stack - (Xavier Leroy, report by @rajdakin, review by Florian Angeletti) +- #11482, #11542: Fix random crash in large closure allocation + (Damien Doligez, report by Thierry Martinez and Vincent Laviron, review by + Xavier Leroy) + +- #11508, #11509: make Bytes.escaped domain-safe + (Christiano Haesbaert and Gabriel Scherer, + review by Xavier Leroy, + report by Jan Midtgaard and Tom Kelly) - #11516, #11524: Fix the `deprecated_mutable` attribute. (Chris Casinghino, review by Nicolás Ojeda Bär and Florian Angeletti) -- #11194, #11609: Fix inconsistent type variable names in "unbound type var" - messages - (Ulysse Gérard and Florian Angeletti, review Florian Angeletti and - Gabriel Scherer) +- #11576: Fix bug in Bigarray.Genarray.init in the the case of zero-dimensional + arrays. + (Nicolás Ojeda Bär, Jeremy Yallop, report by Masayuki Takeda, review by Jeremy + Yallop and Florian Angeletti) + +- #11587: Prevent integer comparison from being used on pointers + (Vincent Laviron, review by Gabriel Scherer) - #11622: Prevent stack overflow when printing a constructor or record mismatch error involving recursive types. (Florian Angeletti, review by Gabriel Scherer) +- #11662, #11673: fix a memory leak when using Dynlink, + the bug was only present in development version of OCaml 5. + (Stephen Dolan, report by Andre Maroneze, review by Gabriel Scherer) + - #11732: Ensure that types from packed modules are always generalised (Stephen Dolan and Leo White, review by Jacques Garrigue) @@ -93,107 +557,58 @@ OCaml 4.14.1 (this had stopped working in 4.14.0) (Gabriel Scherer, review by Jacques Garrigue, report by Yaron Minsky) -- #11768, #11788: Fix crash at start-up of bytecode programs in - no-naked-pointers mode caused by wrong initialization of caml_global_data - (Xavier Leroy, report by Etienne Millon, review by Gabriel Scherer) - - OCaml 4.14.0 (28 March 2022) ---------------------------- -### Language features (highlights): - -- #10437: Allow explicit binders for type variables. - (Stephen Dolan, review by Leo White) - -- #181, #9760, #10740: opt-in tail-modulo-cons (TMC) transformation - let[@tail_mod_cons] rec map f li = ... - (Frédéric Bour, Gabriel Scherer, Basile Clément, - review by Basile Clément and Pierre Chambart, - tested by Konstantin Romanov) - -### Runtime system (highlights): - -- #10195, #10680: Speed up GC by prefetching during marking - (Stephen Dolan, review by Xavier Leroy, Guillaume Munch-Maccagnoni, - Jacques-Henri Jourdan, Damien Doligez and Leo White) - -### Code generation and optimizations (highlights): - -- #10595: Tail calls with up to 64 arguments are guaranteed to be compiled - as tail calls. To this end, memory locations in the domain state - are used for passing arguments that do not fit in registers. - (Xavier Leroy, review by Vincent Laviron) - -### Standard library (highlights): - -* #10710: Add UTF tools, codecs and validations to the Uchar, Bytes and - String modules. - (Daniel Bünzli, review by Florian Angeletti, Nicolás Ojeda Bär, Alain - Frisch and Gabriel Scherer) - -* #10482: mark the Stream and Genlex modules as deprecated, in preparation - for a future removal. These modules (without deprecation alert) - are now provided by the camlp-streams library. - (Xavier Leroy, review by Nicolás Ojeda Bär) - -- #10545: Add In_channel and Out_channel modules. - (Nicolás Ojeda Bär, review by Daniel Bünzli, Simon Cruanes, Gabriel Scherer, - Guillaume Munch-Maccagnoni, Alain Frisch and Xavier Leroy) - -### Compiler user-interface and warnings (highlights) - -- #10328, #10780: Give more precise error when disambiguation could not - possibly work. - (Leo White, review by Gabriel Scherer and Florian Angeletti) - -- #10361: Improve error messages for mismatched record and variant - definitions. - (Florian Angeletti, review by Gabriel Radanne and Gabriel Scherer) - -- #10407: Produce more detailed error messages that contain full error traces - when module inclusion fails. - (Antal Spector-Zabusky, review by Florian Angeletti) - -### Internal/compiler-libs changes (highlights): - -- #10718, #11012: Add "Shape" information to the cmt files. Shapes are an - abstraction of modules that can be used by external tooling to perform - definition-aware operations. - (Ulysse Gérard, Thomas Refis and Leo White, review by Florian Angeletti) - ### Language features: - #10462: Add attribute to produce a compiler error for polls. (Sadiq Jaffer, review by Mark Shinwell, Stephen Dolan and Guillaume Munch-Maccagnoni) +- #10437: Allow explicit binders for type variables. + (Stephen Dolan, review by Leo White) + - #10441: Remove unnecessary parentheses surrounding immediate objects. Allow 'object ... end # f', 'f object ... end', etc. (Yan Dong, review by Nicolás Ojeda Bär, Florian Angeletti and Gabriel Scherer) +- #181, #9760, #10740: opt-in tail-modulo-cons (TMC) transformation + let[@tail_mod_cons] rec map f li = ... + (Frédéric Bour, Gabriel Scherer, Basile Clément, + review by Basile Clément and Pierre Chambart, + tested by Konstantin Romanov) + ### Runtime system: * #9391, #9424: Fix failed assertion in runtime due to ephemerons *set_* and *blit_* function during Mark phase (François Bobot, reported by Stephen Dolan, reviewed by Damien Doligez) +- #10195, #10680: Speed up GC by prefetching during marking + (Stephen Dolan, review by Xavier Leroy, Guillaume Munch-Maccagnoni, + Jacques-Henri Jourdan, Damien Doligez and Leo White) + - #10549: Stack overflow detection and naked pointers checking for ARM64 (Xavier Leroy, review by Stephen Dolan) -* #10675, #10937: Emit deprecation warnings when old C runtime function names +* #10675: Emit deprecation warnings when old C runtime function names are used. This will break C stub code that uses these old names and treats warnings as errors. The workaround is to use the new names. (Xavier Leroy and David Allsopp, review by Sébastien Hinderer and Damien Doligez) -- #10698, #10726, #10891: Free the alternate signal stack when the main OCaml +- #10698, #10726: Free the alternate signal stack when the main OCaml code or an OCaml thread stops (Xavier Leroy, review by David Allsopp and Damien Doligez) - #10730, 10731: Fix bug in `Obj.reachable_words` causing a slowdown when called multiple time (Alain Frisch, report by ygrek, review by Xavier Leroy) +- #10926: Rename the two internal Windows Unicode functions with `caml_` prefix + instead of `win_`. + (David Allsopp, review by Kate Deplaix, Damien Doligez and Xavier Leroy) + ### Code generation and optimizations: - #10578: Increase the number of integer registers used for @@ -205,6 +620,11 @@ OCaml 4.14.0 (28 March 2022) and long register allocation times. (Xavier Leroy, report by Edwin Török, review by Nicolás Ojeda Bär) +- #10595: Tail calls with up to 64 arguments are guaranteed to be compiled + as tail calls. To this end, memory locations in the domain state + are used for passing arguments that do not fit in registers. + (Xavier Leroy, review by Vincent Laviron) + - #10681: Enforce boolean conditions for the native backend (Vincent Laviron, review by Gabriel Scherer) @@ -219,6 +639,11 @@ OCaml 4.14.0 (28 March 2022) ### Standard library: +* #10710: Add UTF tools, codecs and validations to the Uchar, Bytes and + String modules. + (Daniel Bünzli, review by Florian Angeletti, Nicolás Ojeda Bär, Alain + Frisch and Gabriel Scherer) + * #10622: Annotate `Uchar.t` with immediate attribute (Hongbo Zhang, reivew by Gabriel Scherer and Nicolás Ojeda Bär) @@ -226,6 +651,11 @@ OCaml 4.14.0 (28 March 2022) is actually a suffix of `name` and raises Invalid_argument otherwise. (Xavier Leroy, report by whitequark, review by David Allsopp) +* #10482: mark the Stream and Genlex modules as deprecated, in preparation + for a future removal. These modules (without deprecation alert) + are now provided by the camlp-streams library. + (Xavier Leroy, review by Nicolás Ojeda Bär) + - #10526: add Random.bits32, Random.bits64, Random.nativebits (Xavier Leroy, review by Gabriel Scherer and François Bobot) @@ -234,6 +664,10 @@ OCaml 4.14.0 (28 March 2022) by the functions from module Marshal) (François Pottier, review by Gabriel Scherer and Kate Deplaix) +- #10545: Add In_channel and Out_channel modules. + (Nicolás Ojeda Bär, review by Daniel Bünzli, Simon Cruanes, Gabriel Scherer, + Guillaume Munch-Maccagnoni, Alain Frisch and Xavier Leroy) + - #10538: add Out_channel.set_buffered and Out_channel.is_buffered to control the buffering mode of output channels. (Nicolás Ojeda Bär, review by John Whitington, Daniel Bünzli, David Allsopp @@ -265,8 +699,8 @@ OCaml 4.14.0 (28 March 2022) OCaml. (Damien Doligez, review by Stephen Dolan) -* #10922: Add deprecation warnings on {Int32,Int64,Nativeint}.format. - (Nicolás Ojeda Bär, review by Xavier Leroy and Florian Angeletti) +- #10786: The implementation of Complex.norm now uses Float.hypot. + (Christophe Troestler, review by David Allsopp and Xavier Leroy) ### Other libraries: @@ -282,13 +716,22 @@ OCaml 4.14.0 (28 March 2022) WSADuplicateSocket on sockets instead of DuplicateHandle. (Antonin Décimo, review by Xavier Leroy and Nicolás Ojeda Bär) +* #10926, #11336: Ensure all C functions in the Unix library are prefixed with + `caml_`. + (David Allsopp, review by Kate Deplaix, Damien Doligez and Xavier Leroy) + - #10951: Introduce the Thread.Exit exception as an alternative way to terminate threads prematurely. This alternative way will become - the standard way in 5.00. + the standard way in 5.0. (Xavier Leroy, review by Florian Angeletti) ### Tools: +- #9701: Release bytecode only after collecting backtrace information + for exceptions, same for dynamic loaded code compiled from toplevel on + ocamlnat. + (Renato Alencar, reported by Krzysztof Leśniak, reviewed by Gabriel Scherer) + - #10839: Fix regression of #show when printing class type (Élie Brami, review by Florian Angeletti) @@ -372,6 +815,18 @@ OCaml 4.14.0 (28 March 2022) ### Compiler user-interface and warnings: +- #10328, #10780: Give more precise error when disambiguation could not + possibly work. + (Leo White, review by Gabriel Scherer and Florian Angeletti) + +- #10361: Improve error messages for mismatched record and variant + definitions. + (Florian Angeletti, review by Gabriel Radanne and Gabriel Scherer) + +- #10407: Produce more detailed error messages that contain full error traces + when module inclusion fails. + (Antal Spector-Zabusky, review by Florian Angeletti) + - #10531: add naked_pointers to ocamlc -config exporting NAKED_POINTERS from Makefile.config. (Damien Doligez, review by Mark Shinwell and Gabriel Scherer) @@ -495,15 +950,17 @@ OCaml 4.14.0 (28 March 2022) (David Allsopp and Nathan Rebours, review by Louis Gesbert, Nicolás Ojeda Bär and Gabriel Scherer) +- #10718, #11012: Add "Shape" information to the cmt files. Shapes are an + abstraction of modules that can be used by external tooling to perform + definition-aware operations. + (Ulysse Gérard, Thomas Refis and Leo White, review by Florian Angeletti) + - #10742: strong call-by-need reduction for shapes (Gabriel Scherer and Nathanaëlle Courant, review by Florian Angeletti, Ulysse Gérard and Thomas Refis) ### Build system: -- #10828 Build native-code compilers on OpenBSD/aarch64 - (Christopher Zimmermann) - - #10835 Disable DT_TEXTREL warnings on x86 32 bit architecture by passing -Wl,-z,notext in mksharedlib and mkmaindll. Fixes relocation issues, reported in #9800, making local patches in Debian, Alpine, and FreeBSD superfluous. @@ -528,6 +985,9 @@ OCaml 4.14.0 (28 March 2022) (Xavier Leroy, report by Rehan Malak, review by Gabriel Scherer and Vincent Laviron) +- #10364: Improve detection of ambiguity in case bodies. + (Jacques Garrigue, review by Thomas Refis) + - #10473: Add CFI directives to RISC-V runtime and asmcomp. This allows stacktraces to work in gdb through C and OCaml calls. (Edwin Török, review by Nicolás Ojeda Bär and Xavier Leroy) @@ -1164,8 +1624,8 @@ OCaml 4.13.0 (24 September 2021) when the systhreads library is loaded. (David Allsopp, report by Anton Bachin, review by Xavier Leroy) -- #8575, #10362: Surprising interaction between polymorphic variants and - constructor disambiguation. +- #8575, #10362: Surprising interaction between polymorphic variants + and constructor disambiguation. (Jacques Garrigue, report and review by Thomas Refis) - #8917, #8929, #9889, #10219: fix printing of nested recursive definitions diff --git a/dev/ocaml/_doc-dir/README.adoc b/dev/ocaml/_doc-dir/README.adoc index fb293bb2..3c361cd8 100644 --- a/dev/ocaml/_doc-dir/README.adoc +++ b/dev/ocaml/_doc-dir/README.adoc @@ -1,5 +1,25 @@ +=== ⚠️ CAUTION + +The developer team is currently preparing the release of OCaml 5.0. This release +sports a full rewrite of its runtime system for shared-memory parallel +programming using domains and native support for concurrent programming using +effect handlers. + +Owing to the large number of changes, the initial 5.0 release will be more +experimental than usual. It is recommended that all users wanting a stable +release use the 4.14 release which will continue to be supported and updated +while 5.0 reaches feature and stability parity. Similarly, if you need one of +the ports not yet supported in the 5.0 release you must use the 4.14 release. + +The initial release of OCaml 5.0 will only support the native compiler under +ARM64 and x86-64 architectures under Linux and macOS. On Windows, only the +Mingw-w64 port is supported. Support for other 64-bit architectures and systems +will be added back in later releases. On 32-bit systems, only the bytecode +compiler is supported. Native-code support for these systems is under +discussion. + |===== -| Branch `trunk` | Branch `4.12` | Branch `4.11` | Branch `4.10` +| Branch `trunk` | Branch `4.14` | Branch `4.13` | Branch `4.12` | image:https://github.com/ocaml/ocaml/workflows/Build/badge.svg?branch=trunk["Github CI Build Status (trunk branch)", link="https://github.com/ocaml/ocaml/actions?query=workflow%3ABuild"] @@ -7,18 +27,18 @@ link="https://github.com/ocaml/ocaml/actions?query=workflow%3AHygiene"] image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=trunk&svg=true["AppVeyor Build Status (trunk branch)", link="https://ci.appveyor.com/project/avsm/ocaml"] -| image:https://github.com/ocaml/ocaml/workflows/main/badge.svg?branch=4.12["Github CI Build Status (4.12 branch)", +| image:https://github.com/ocaml/ocaml/workflows/main/badge.svg?branch=4.14["Github CI Build Status (4.14 branch)", link="https://github.com/ocaml/ocaml/actions?query=workflow%3Amain"] + image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=4.14&svg=true["AppVeyor Build Status (4.14 branch)", + link="https://ci.appveyor.com/project/avsm/ocaml"] +| image:https://travis-ci.org/ocaml/ocaml.svg?branch=4.13["TravisCI Build Status (4.13 branch)", + link="https://travis-ci.org/ocaml/ocaml"] + image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=4.13&svg=true["AppVeyor Build Status (4.13 branch)", + link="https://ci.appveyor.com/project/avsm/ocaml"] +| image:https://travis-ci.org/ocaml/ocaml.svg?branch=4.12["TravisCI Build Status (4.12 branch)", + link="https://travis-ci.org/ocaml/ocaml"] image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=4.12&svg=true["AppVeyor Build Status (4.12 branch)", link="https://ci.appveyor.com/project/avsm/ocaml"] -| image:https://travis-ci.org/ocaml/ocaml.svg?branch=4.11["TravisCI Build Status (4.11 branch)", - link="https://travis-ci.org/ocaml/ocaml"] - image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=4.11&svg=true["AppVeyor Build Status (4.11 branch)", - link="https://ci.appveyor.com/project/avsm/ocaml"] -| image:https://travis-ci.org/ocaml/ocaml.svg?branch=4.10["TravisCI Build Status (4.10 branch)", - link="https://travis-ci.org/ocaml/ocaml"] - image:https://ci.appveyor.com/api/projects/status/github/ocaml/ocaml?branch=4.10&svg=true["AppVeyor Build Status (4.10 branch)", - link="https://ci.appveyor.com/project/avsm/ocaml"] |===== = README = diff --git a/dev/ocaml/_doc-dir/README.win32.adoc b/dev/ocaml/_doc-dir/README.win32.adoc index 410a8eef..63aec24e 100644 --- a/dev/ocaml/_doc-dir/README.win32.adoc +++ b/dev/ocaml/_doc-dir/README.win32.adoc @@ -1,3 +1,21 @@ +=== ⚠️ CAUTION + +The developer team is currently preparing the release of OCaml 5.0. This release +sports a full rewrite of its runtime system for shared-memory parallel +programming using domains and native support for concurrent programming using +effect handlers. + +Owing to the large number of changes, the initial 5.0 release will be more +experimental than usual. It is recommended that all users wanting a stable +release use the 4.14 release which will continue to be supported and updated +while 5.0 reaches feature and stability parity. Similarly, if you need one of +the ports not yet supported in the 5.0 release you must use the 4.14 release. + +Only the Mingw-w64 port is supported. On 32-bit systems, only the bytecode +compiler is supported. Native-code support for these 32-bit systems is under +discussion. Support for the MSVC and Cygwin ports will be added back in later +releases. + = Release notes for the Microsoft Windows ports of OCaml = :toc: macro @@ -45,7 +63,7 @@ Cygwin aims to provide a Unix-like environment on Windows, and the build procedure for it is the same as for other flavours of Unix. See link:INSTALL.adoc[] for full instructions. -The native ports require Windows XP or later and naturally the 64-bit versions +The native ports require Windows Vista or later and naturally the 64-bit versions need a 64-bit edition of Windows (note that this is both to run *and* build). The two native Windows ports have to be built differently, and the remainder of @@ -63,7 +81,9 @@ Only the `make` Cygwin package is required. `diffutils` is required if you wish to be able to run the test suite. Unless you are also compiling the Cygwin port of OCaml, you do not need the -`gcc-core` or `flexdll` packages. +`gcc-core` or `flexdll` packages. If you do install them, care may be required +to ensure that a particular build is using the correct installation of +`flexlink`. [[bmflex]] In addition to Cygwin, FlexDLL must also be installed, which is available from @@ -195,7 +215,7 @@ quickly as it will be unable to link `ocamlrun`. Now run: - ./configure --build=x86_64-pc-cygwin --host=i686-pc-windows + ./configure --build=i686-pc-cygwin --host=i686-pc-windows for 32-bit, or: @@ -223,7 +243,7 @@ your `~/.bashrc` file. the performance of bytecode programs is about 2/3 of that obtained under Unix/GCC, Cygwin or Mingw-w64 on similar hardware. -* Libraries available in this port: `bigarray`, `dynlink`, `num`, +* Libraries available in this port: `dynlink`, `num`, `str`, `threads`, and large parts of `unix`. * The replay debugger is partially supported (no reverse execution). @@ -260,7 +280,7 @@ the WinZip Options Window.) Now run: - ./configure --build=x86_64-pc-cygwin --host=i686-w64-mingw32 + ./configure --build=i686-pc-cygwin --host=i686-w64-mingw32 for 32-bit, or: @@ -277,7 +297,7 @@ After installing, you will need to ensure that `ocamlopt` (or `ocamlc -custom`) can access the C compiler. You can do this either by using OCaml from Cygwin's bash or by adding Cygwin's bin directory (e.g. `C:\cygwin\bin`) to your `PATH`. -* Libraries available in this port: `bigarray`, `dynlink`, `num`, +* Libraries available in this port: `dynlink`, `num`, `str`, `threads`, and large parts of `unix`. * The replay debugger is partially supported (no reverse execution). diff --git a/dev/ocaml/index.html b/dev/ocaml/index.html index d680efd6..c5d28eec 100644 --- a/dev/ocaml/index.html +++ b/dev/ocaml/index.html @@ -1,2 +1,2 @@ -index (ocaml.index)

    Package ocaml

    Stdlib

    Threads

    • Condition Condition variables to synchronize between threads.
    • Event First-class synchronous communication.
    • Mutex Locks for mutual exclusion.
    • Semaphore Semaphores
    • Thread Lightweight threads for Posix 1003.1c and Win32.
    • ThreadUnix Thread-compatible system calls.

    Compiler libs

    Package info

    changes-files
    license-files
    readme-files
    \ No newline at end of file +index (ocaml.index)

    Package ocaml

    Stdlib

    Threads

    • Event First-class synchronous communication.
    • Thread Lightweight threads for Posix 1003.1c and Win32.

    Compiler libs

    Package info

    changes-files
    license-files
    readme-files
    \ No newline at end of file