package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=ea26b5c72e6731e59d856626049cca4d
sha512=55975b62c26f6db77433a3ac31f97af609fc6789bb62ac38b267249c78fd44ff37fe81901f1cf560857b9493a6046dd37b0d1c0234c66bd59e52843aac3ce6cb
doc/batteries.unthreaded/BatArray/Cap/index.html
Module BatArray.Cap
Source
Capabilities for arrays.
This modules provides the same set of features as Array
, but with the added twist that arrays can be made read-only or write-only. Read-only arrays may then be safely shared and distributed.
There is no loss of performance involved.
Only the capability-specific functions are documented here. See the complete Array
module for the documentation of other functions.
The type of arrays with capabilities. An ('a, [`Read | `Write])
array behaves as a regular 'a array
, while a ('a, [`Read]) array
only has read-only capabilities and a ('a, [`Write]) array
only has write-only capabilities.
Base operations
Constructors
Array.make_float n
returns a fresh float array of length n
, with uninitialized data.
Adopt a regular array as a capability array, allowing to decrease capabilities if necessary.
This operation involves no copying. In other words, in let cap = of_array a in ...
, any modification in a
will also have effect on cap
and reciprocally.
Return a capability array as an array.
This operation requires both read and write permissions on the capability array and involves no copying. In other words, in let a = of_array cap in ...
, any modification in a
will also have effect on cap
and reciprocally.
Drop to read-only permissions.
This operation involves no copying.
Drop to write-only permissions.
This operation involves no copying.
Iterators
Operations on two arrays
Predicates
Array transformations
Conversions
Utilities
Boilerplate code
val print :
?first:string ->
?last:string ->
?sep:string ->
('a BatIO.output -> 'b -> unit) ->
'a BatIO.output ->
('b, [> `Read ]) t ->
unit
Override modules
Operations on BatArray.Cap
without exceptions.
Operations on BatArray.Cap
with labels.