A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://fsharp.github.io/fsharp-core-docs/reference/fsharp-collections-array2dmodule.html below:

Array2D (FSharp.Core) | FSharp.Core

Fetches the base-index for the first dimension of the array.

array : 'T[,]

The input array.

Returns: 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 to 1.

Fetches the base-index for the second dimension of the array.

array : 'T[,]

The input array.

Returns: 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 to 1.

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

source : 'T[,]

The source array.

sourceIndex1 : int

The first-dimension index to begin copying from in the source array.

sourceIndex2 : int

The second-dimension index to begin copying from in the source array.

target : 'T[,]

The target array.

targetIndex1 : int

The first-dimension index to begin copying into in the target array.

targetIndex2 : int

The second-dimension index to begin copying into in the target array.

length1 : int

The number of elements to copy across the first dimension of the arrays.

length2 : int

The number of elements to copy across the second dimension of the arrays.

ArgumentException Thrown when any of the indices are negative or if either of the counts are larger than the dimensions of the array allow.
 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 evaluation target contains [ [ 2; 3; 4 ]; [ 12; 13; 14 ] ].

Builds a new array whose elements are the same as the input array.

array : 'T[,]

The input array.

Returns: '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.

length1 : int

The length of the first dimension of the array.

length2 : int

The length of the second dimension of the array.

value : 'T

The value to populate the new array.

Returns: '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.

base1 : int

The base for the first dimension of the array.

base2 : int

The base for the second dimension of the array.

length1 : int

The length of the first dimension of the array.

length2 : int

The length of the second dimension of the array.

initial : 'T

The value to populate the new array.

Returns: '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 to 2.0.
array : 'T[,]

The input array.

index1 : int

The index along the first dimension.

index2 : int

The index along the second dimension.

Returns: 'T

The value of the array at the given index.

ArgumentException Thrown when the indices are negative or exceed the bounds of the array.
 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 to 2.0.

Creates an array given the dimensions and a generator function to compute the elements.

length1 : int

The length of the first dimension of the array.

length2 : int

The length of the second dimension of the array.

initializer : int -> int -> 'T

A function to produce elements of the array given the two indices.

Returns: '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.

base1 : int

The base for the first dimension of the array.

base2 : int

The base for the second dimension of the array.

length1 : int

The length of the first dimension of the array.

length2 : int

The length of the second dimension of the array.

initializer : int -> int -> 'T

A function to produce elements of the array given the two indices.

Returns: '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.

action : 'T -> unit

A function to apply to each element of the array.

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 to unit 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.

action : int -> int -> 'T -> unit

A function to apply to each element of the array with the indices available as an argument.

array : '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 to unit 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.

array : 'T[,]

The input array.

Returns: 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 to 2.

Returns the length of an array in the second dimension.

array : 'T[,]

The input array.

Returns: 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 to 3.

Builds a new array whose elements are the results of applying the given function to each of the elements of the array.

mapping : 'T -> 'U

A function that is applied to transform each item of the input array.

array : 'T[,]

The input array.

Returns: '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.

mapping : 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.

array : 'T[,]

The input array.

Returns: '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.

array : 'T[,]

The input array.

Returns: '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

array : 'T[,]

The input array.

index1 : int

The index along the first dimension.

index2 : int

The index along the second dimension.

value : 'T

The value to set in the array.

ArgumentException Thrown when the indices are negative or exceed the bounds of 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 evaluation array 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>.

length1 : int

The length of the first dimension of the array.

length2 : int

The length of the second dimension of the array.

Returns: '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>.

base1 : int

The base for the first dimension of the array.

base2 : int

The base for the second dimension of the array.

length1 : int

The length of the first dimension of the array.

length2 : int

The length of the second dimension of the array.

Returns: '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