package batteries
Install
Dune Dependency
Authors
Maintainers
Sources
md5=1fd7bddce07cf5d244fc9427f7b5e4d4
sha512=c0f2a0fdc8253e0ea999d8d4c58bfbf32b18d251a2e1d9656bf279de5f01a33e9aabac3af4d95f465f8b671e7711ebd37218043face233340a0c11b08fa62f78
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.