W3cubDocs

/OCaml
Previous Up Next

8.11 Syntax for Bigarray access

(Introduced in Objective Caml 3.00)

expr ::= ...
expr .{ expr { , expr } }
expr .{ expr { , expr } } <- expr

This extension provides syntactic sugar for getting and setting elements in the arrays provided by the Bigarray module.

The short expressions are translated into calls to functions of the Bigarray module as described in the following table.

expression translation
expr0.{ expr1} Bigarray.Array1.get expr0 expr1
expr0.{ expr1} <- expr Bigarray.Array1.set expr0 expr1 expr
expr0.{ expr1, expr2} Bigarray.Array2.get expr0 expr1 expr2
expr0.{ expr1, expr2} <- expr Bigarray.Array2.set expr0 expr1 expr2 expr
expr0.{ expr1, expr2, expr3} Bigarray.Array3.get expr0 expr1 expr2 expr3
expr0.{ expr1, expr2, expr3} <- expr Bigarray.Array3.set expr0 expr1 expr2 expr3 expr
expr0.{ expr1,, exprn} Bigarray.Genarray.get expr0 [| expr1,, exprn |]
expr0.{ expr1,, exprn} <- expr Bigarray.Genarray.set expr0 [| expr1,, exprn |] expr

The last two entries are valid for any n > 3.


Previous Up Next