Fetches the base-index for the first dimension of the array.
'T[,]
The input array.
int
The base-index of the first dimension of the array.
Create a 10x10 1-based array:
open System
let array = Array.CreateInstance(typeof<int>, [| 10; 10 |], [| 1; 1 |]) :?> int[,]
array |> Array2D.base1
namespace System
Multiple items
val array: int array2d
--------------------
type 'T array = 'T array
type Array = interface ICollection interface IEnumerable interface IList interface IStructuralComparable interface IStructuralEquatable interface ICloneable member Clone: unit -> obj member CopyTo: array: Array * index: int -> unit + 1 overload member GetEnumerator: unit -> IEnumerator member GetLength: dimension: int -> int ...
<summary>Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.</summary>
Array.CreateInstance(elementType: Type, [<ParamArray>] lengths: int64 array) : Array
Array.CreateInstance(elementType: Type, [<ParamArray>] lengths: int array) : Array
Array.CreateInstance(elementType: Type, length: int) : Array
Array.CreateInstance(elementType: Type, lengths: int array, lowerBounds: int array) : Array
Array.CreateInstance(elementType: Type, length1: int, length2: int) : Array
Array.CreateInstance(elementType: Type, length1: int, length2: int, length3: int) : Array
val typeof<'T> : Type
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
module Array2D from Microsoft.FSharp.Collections
val base1: array: 'T array2d -> int
Evaluates to1
.
Fetches the base-index for the second dimension of the array.
'T[,]
The input array.
int
The base-index of the second dimension of the array.
Create a 10x10 1-based array:
open System
let array = Array.CreateInstance(typeof<int>, [| 10; 10 |], [| 1; 1 |]) :?> int[,]
array |> Array2D.base2
namespace System
Multiple items
val array: int array2d
--------------------
type 'T array = 'T array
type Array = interface ICollection interface IEnumerable interface IList interface IStructuralComparable interface IStructuralEquatable interface ICloneable member Clone: unit -> obj member CopyTo: array: Array * index: int -> unit + 1 overload member GetEnumerator: unit -> IEnumerator member GetLength: dimension: int -> int ...
<summary>Provides methods for creating, manipulating, searching, and sorting arrays, thereby serving as the base class for all arrays in the common language runtime.</summary>
Array.CreateInstance(elementType: Type, [<ParamArray>] lengths: int64 array) : Array
Array.CreateInstance(elementType: Type, [<ParamArray>] lengths: int array) : Array
Array.CreateInstance(elementType: Type, length: int) : Array
Array.CreateInstance(elementType: Type, lengths: int array, lowerBounds: int array) : Array
Array.CreateInstance(elementType: Type, length1: int, length2: int) : Array
Array.CreateInstance(elementType: Type, length1: int, length2: int, length3: int) : Array
val typeof<'T> : Type
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
module Array2D from Microsoft.FSharp.Collections
val base2: array: 'T array2d -> int
Evaluates to1
.
Reads a range of elements from the first array and write them into the second.
let source = array2D [ [ 3; 4 ]; [ 13; 14 ] ]
let target = array2D [ [ 2; 2; 2 ]; [ 12; 12; 12 ] ]
target[0..1,1..2] <- source
val source: int array2d
val array2D: rows: #('T seq) seq -> 'T array2d
val target: int array2d
'T[,]
The source array.
int
The first-dimension index to begin copying from in the source array.
int
The second-dimension index to begin copying from in the source array.
'T[,]
The target array.
int
The first-dimension index to begin copying into in the target array.
int
The second-dimension index to begin copying into in the target array.
int
The number of elements to copy across the first dimension of the arrays.
int
The number of elements to copy across the second dimension of the arrays.
let source = array2D [ [ 3; 4 ]; [ 13; 14 ] ]
let target = array2D [ [ 2; 2; 2 ]; [ 12; 12; 12 ] ]
Array2D.blit source 0 0 target 0 1 2 2
val source: int array2d
val array2D: rows: #('T seq) seq -> 'T array2d
val target: int array2d
module Array2D from Microsoft.FSharp.Collections
val blit: source: 'T array2d -> sourceIndex1: int -> sourceIndex2: int -> target: 'T array2d -> targetIndex1: int -> targetIndex2: int -> length1: int -> length2: int -> unit
After evaluationtarget
contains [ [ 2; 3; 4 ]; [ 12; 13; 14 ] ]
.
Builds a new array whose elements are the same as the input array.
'T[,]
The input array.
'T[,]
A copy of the input array.
open System
let array = Array2D.zeroCreate<int> 10 10
array |> Array2D.copy
namespace System
Multiple items
val array: int array2d
--------------------
type 'T array = 'T array
module Array2D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> 'T array2d
Multiple items
val int: value: 'T -> int (requires member op_Explicit)
--------------------
type int = int32
--------------------
type int<'Measure> = int
val copy: array: 'T array2d -> 'T array2d
Evaluates to a new copy of the 10x10 array.Creates an array whose elements are all initially the given value.
int
The length of the first dimension of the array.
int
The length of the second dimension of the array.
'T
The value to populate the new array.
'T[,]
The created array.
Array2D.create 2 3 1
module Array2D from Microsoft.FSharp.Collections
val create: length1: int -> length2: int -> value: 'T -> 'T array2d
Evaluates to a 2x3 array with contents[[1; 1; 1]; [1; 1; 1]]
Creates a based array whose elements are all initially the given value.
int
The base for the first dimension of the array.
int
The base for the second dimension of the array.
int
The length of the first dimension of the array.
int
The length of the second dimension of the array.
'T
The value to populate the new array.
'T[,]
The created array.
Array2D.createBased 1 1 2 3 1
module Array2D from Microsoft.FSharp.Collections
val createBased: base1: int -> base2: int -> length1: int -> length2: int -> initial: 'T -> 'T array2d
Evaluates to a 2x3 1-based array with contents[[1; 1; 1]; [1; 1; 1]]
Fetches an element from a 2D array. You can also use the syntax array.[index1,index2]
.
let array = array2D [ [ 1.0; 2.0 ]; [ 3.0; 4.0 ] ]
array[0,1]
Multiple items
val array: float array2d
--------------------
type 'T array = 'T array
val array2D: rows: #('T seq) seq -> 'T array2d
Evaluates to2.0
.
'T[,]
The input array.
int
The index along the first dimension.
int
The index along the second dimension.
'T
The value of the array at the given index.
let array = array2D [ [ 1.0; 2.0 ]; [ 3.0; 4.0 ] ]
Array2D.get array 0 1
Multiple items
val array: float array2d
--------------------
type 'T array = 'T array
val array2D: rows: #('T seq) seq -> 'T array2d
module Array2D from Microsoft.FSharp.Collections
val get: array: 'T array2d -> index1: int -> index2: int -> 'T
Evaluates to2.0
.
Creates an array given the dimensions and a generator function to compute the elements.
int
The length of the first dimension of the array.
int
The length of the second dimension of the array.
int -> int -> 'T
A function to produce elements of the array given the two indices.
'T[,]
The generated array.
Array2D.init 2 3 (fun i j -> i + j)
module Array2D from Microsoft.FSharp.Collections
val init: length1: int -> length2: int -> initializer: (int -> int -> 'T) -> 'T array2d
val i: int
val j: int
Evaluates to a 2x3 array with contents[[0; 1; 2]; [1; 2; 3]]
Creates a based array given the dimensions and a generator function to compute the elements.
int
The base for the first dimension of the array.
int
The base for the second dimension of the array.
int
The length of the first dimension of the array.
int
The length of the second dimension of the array.
int -> int -> 'T
A function to produce elements of the array given the two indices.
'T[,]
The created array.
Array2D.initBased 1 1 2 3 (fun i j -> i + j)
module Array2D from Microsoft.FSharp.Collections
val initBased: base1: int -> base2: int -> length1: int -> length2: int -> initializer: (int -> int -> 'T) -> 'T array2d
val i: int
val j: int
Evaluates to a 2x3 1-based array with contents[[2; 3; 4]; [3; 4; 5]]
Applies the given function to each element of the array.
'T -> unit
A function to apply to each element of the array.
'T[,]
The input array.
let inputs = array2D [ [ 3; 4 ]; [ 13; 14 ] ]
inputs |> Array2D.iter (fun v -> printfn $"value = {v}")
val inputs: int array2d
val array2D: rows: #('T seq) seq -> 'T array2d
module Array2D from Microsoft.FSharp.Collections
val iter: action: ('T -> unit) -> array: 'T array2d -> unit
val v: int
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
Evaluates tounit
and prints
value = 3
value = 4
value = 13
value = 14
in the console.
Applies the given function to each element of the array. The integer indices passed to the function indicates the index of element.
int -> int -> 'T -> unit
A function to apply to each element of the array with the indices available as an argument.
'T[,]
The input array.
let inputs = array2D [ [ 3; 4 ]; [ 13; 14 ] ]
inputs |> Array2D.iteri (fun i j v -> printfn $"value at ({i},{j}) = {v}")
val inputs: int array2d
val array2D: rows: #('T seq) seq -> 'T array2d
module Array2D from Microsoft.FSharp.Collections
val iteri: action: (int -> int -> 'T -> unit) -> array: 'T array2d -> unit
val i: int
val j: int
val v: int
val printfn: format: Printf.TextWriterFormat<'T> -> 'T
Evaluates tounit
and prints
value at (0,0) = 3
value at (0,1) = 4
value at (1,0) = 13
value at (1,1) = 14
in the console.
Returns the length of an array in the first dimension.
'T[,]
The input array.
int
The length of the array in the first dimension.
let array = array2D [ [ 3; 4; 5 ]; [ 13; 14; 15 ] ]
array |> Array2D.length1
Multiple items
val array: int array2d
--------------------
type 'T array = 'T array
val array2D: rows: #('T seq) seq -> 'T array2d
module Array2D from Microsoft.FSharp.Collections
val length1: array: 'T array2d -> int
Evaluates to2
.
Returns the length of an array in the second dimension.
'T[,]
The input array.
int
The length of the array in the second dimension.
let array = array2D [ [ 3; 4; 5 ]; [ 13; 14; 15 ] ]
array |> Array2D.length2
Multiple items
val array: int array2d
--------------------
type 'T array = 'T array
val array2D: rows: #('T seq) seq -> 'T array2d
module Array2D from Microsoft.FSharp.Collections
val length2: array: 'T array2d -> int
Evaluates to3
.
Builds a new array whose elements are the results of applying the given function to each of the elements of the array.
'T -> 'U
A function that is applied to transform each item of the input array.
'T[,]
The input array.
'U[,]
An array whose elements have been transformed by the given mapping.
let inputs = array2D [ [ 3; 4 ]; [ 13; 14 ] ]
inputs |> Array2D.map (fun v -> 2 * v)
val inputs: int array2d
val array2D: rows: #('T seq) seq -> 'T array2d
module Array2D from Microsoft.FSharp.Collections
val map: mapping: ('T -> 'U) -> array: 'T array2d -> 'U array2d
val v: int
Evaluates to a 2x2 array with contents[[6; 8;]; [26; 28]]
Builds a new array whose elements are the results of applying the given function to each of the elements of the array. The integer indices passed to the function indicates the element being transformed.
int -> int -> 'T -> 'U
A function that is applied to transform each element of the array. The two integers provide the index of the element.
'T[,]
The input array.
'U[,]
An array whose elements have been transformed by the given mapping.
let inputs = array2D [ [ 3; 4 ]; [ 13; 14 ] ]
inputs |> Array2D.mapi (fun i j v -> i + j + v)
val inputs: int array2d
val array2D: rows: #('T seq) seq -> 'T array2d
module Array2D from Microsoft.FSharp.Collections
val mapi: mapping: (int -> int -> 'T -> 'U) -> array: 'T array2d -> 'U array2d
val i: int
val j: int
val v: int
Evaluates to a 2x2 array with contents[[3; 5;]; [14; 16]]
Builds a new array whose elements are the same as the input array but where a non-zero-based input array generates a corresponding zero-based output array.
'T[,]
The input array.
'T[,]
The zero-based output array.
let inputs = Array2D.createBased 1 1 2 3 1
inputs |> Array2D.rebase
val inputs: int array2d
module Array2D from Microsoft.FSharp.Collections
val createBased: base1: int -> base2: int -> length1: int -> length2: int -> initial: 'T -> 'T array2d
val rebase: array: 'T array2d -> 'T array2d
Evaluates to a 2x2 zero-based array with contents[[1; 1]; [1; 1]]
Sets the value of an element in an array. You can also use the syntax array.[index1,index2] <- value
.
let array = Array2D.zeroCreate 2 2
array[0,1] <- 4.0
Multiple items
val array: float array2d
--------------------
type 'T array = 'T array
module Array2D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> 'T array2d
'T[,]
The input array.
int
The index along the first dimension.
int
The index along the second dimension.
'T
The value to set in the array.
let array = Array2D.zeroCreate 2 2
Array2D.set array 0 1 4.0
Multiple items
val array: float array2d
--------------------
type 'T array = 'T array
module Array2D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> 'T array2d
val set: array: 'T array2d -> index1: int -> index2: int -> value: 'T -> unit
After evaluationarray
is a 2x2 array with contents [[0.0; 4.0]; [0.0; 0.0]]
Creates an array where the entries are initially Unchecked.defaultof<'T>.
int
The length of the first dimension of the array.
int
The length of the second dimension of the array.
'T[,]
The created array.
Array2D.zeroCreate 2 3
module Array2D from Microsoft.FSharp.Collections
val zeroCreate: length1: int -> length2: int -> 'T array2d
Evaluates to a 2x3 array with contents[[0; 0; 0]; [0; 0; 0]]
Creates a based array where the entries are initially Unchecked.defaultof<'T>.
int
The base for the first dimension of the array.
int
The base for the second dimension of the array.
int
The length of the first dimension of the array.
int
The length of the second dimension of the array.
'T[,]
The created array.
Array2D.zeroCreateBased 1 1 2 3
module Array2D from Microsoft.FSharp.Collections
val zeroCreateBased: base1: int -> base2: int -> length1: int -> length2: int -> 'T array2d
Evaluates to a 2x3 1-based array with contents[[0; 0; 0]; [0; 0; 0]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4