FSharpPlus


ResizeArray Module

Additional operations on ResizeArray

Functions and values

Function or value Description

ResizeArray.apply f x

Full Usage: ResizeArray.apply f x

Parameters:
    f : ResizeArray<('T -> 'U)> - The functions.
    x : ResizeArray<'T> - The values.

Returns: ResizeArray<'U> A concatenated list of the resulting ResizeArray after applying each function to each value.

Applies a ResizeArray of functions to a ResizeArray of values and concatenates them.

f : ResizeArray<('T -> 'U)>

The functions.

x : ResizeArray<'T>

The values.

Returns: ResizeArray<'U>

A concatenated list of the resulting ResizeArray after applying each function to each value.

Example

 > List.apply [double; triple] [1; 2; 3];;  
 val it : int list = [2; 4; 6; 3; 6; 9]
Multiple items
module List from Microsoft.FSharp.Collections

--------------------
type List<'T> = | op_Nil | op_ColonColon of Head: 'T * Tail: 'T list interface IReadOnlyList<'T> interface IReadOnlyCollection<'T> interface IEnumerable interface IEnumerable<'T> member GetReverseIndex: rank: int * offset: int -> int member GetSlice: startIndex: int option * endIndex: int option -> 'T list static member Cons: head: 'T * tail: 'T list -> 'T list member Head: 'T member IsEmpty: bool member Item: index: int -> 'T with get ...
Multiple items
val double: value: 'T -> double (requires member op_Explicit)

--------------------
type double = System.Double

--------------------
type double<'Measure> = float<'Measure>
Multiple items
val int: value: 'T -> int (requires member op_Explicit)

--------------------
type int = int32

--------------------
type int<'Measure> = int
type 'T list = List<'T>

ResizeArray.findSliceIndex slice source

Full Usage: ResizeArray.findSliceIndex slice source

Parameters:
    slice : 'a[]
    source : 'a[]

Returns: int The index of the slice.

Returns the index of the first occurrence of the specified slice in the source.

slice : 'a[]
source : 'a[]
Returns: int

The index of the slice.

ArgumentException Thrown when the slice was not found in the sequence.

ResizeArray.intercalate separator source

Full Usage: ResizeArray.intercalate separator source

Parameters:
    separator : 'a[]
    source : seq<'a[]>

Returns: 'a[]

Concatenates all elements, using the specified separator between each element.

separator : 'a[]
source : seq<'a[]>
Returns: 'a[]

ResizeArray.intersperse element source

Full Usage: ResizeArray.intersperse element source

Parameters:
    element : 'T
    source : 'T[]

Returns: 'T[]

Inserts a separator element between each element in the source ResizeArray.

element : 'T
source : 'T[]
Returns: 'T[]

ResizeArray.lift2 mapping x1 x2

Full Usage: ResizeArray.lift2 mapping x1 x2

Parameters:
    mapping : 'T -> 'U -> 'c
    x1 : ResizeArray<'T>
    x2 : ResizeArray<'U>

Returns: ResizeArray<'c>

Combines all values from the first ResizeArray with the second, using the supplied mapping function.

mapping : 'T -> 'U -> 'c
x1 : ResizeArray<'T>
x2 : ResizeArray<'U>
Returns: ResizeArray<'c>

ResizeArray.lift3 mapping x1 x2 x3

Full Usage: ResizeArray.lift3 mapping x1 x2 x3

Parameters:
    mapping : 'U -> 'V -> 'T -> 'd - Mapping function taking three element combination as input.
    x1 : ResizeArray<'T> - First ResizeArray.
    x2 : ResizeArray<'U> - Second ResizeArray.
    x3 : ResizeArray<'V> - Third ResizeArray.

Returns: ResizeArray<'d> ResizeArray with values returned from mapping function.

Combines values from three ResizeArrays and calls a mapping function on this combination.

mapping : 'U -> 'V -> 'T -> 'd

Mapping function taking three element combination as input.

x1 : ResizeArray<'T>

First ResizeArray.

x2 : ResizeArray<'U>

Second ResizeArray.

x3 : ResizeArray<'V>

Third ResizeArray.

Returns: ResizeArray<'d>

ResizeArray with values returned from mapping function.

ResizeArray.map mapping source

Full Usage: ResizeArray.map mapping source

Parameters:
    mapping : 'T -> 'U - A function to transform items from the input ResizeArray.
    source : ResizeArray<'T> - The input ResizeArray.

Returns: ResizeArray<'U> The result ResizeArray.

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

mapping : 'T -> 'U

A function to transform items from the input ResizeArray.

source : ResizeArray<'T>

The input ResizeArray.

Returns: ResizeArray<'U>

The result ResizeArray.

ArgumentNullException Thrown when the input ResizeArray is null.

ResizeArray.map2Shortest f a1 a2

Full Usage: ResizeArray.map2Shortest f a1 a2

Parameters:
    f : 'a -> 'b -> 'c
    a1 : ResizeArray<'a>
    a2 : ResizeArray<'b>

Returns: ResizeArray<'c>

Safely build a new ResizeArray whose elements are the results of applying the given function to each of the elements of the two ResizeArrays pairwise.

f : 'a -> 'b -> 'c
a1 : ResizeArray<'a>
a2 : ResizeArray<'b>
Returns: ResizeArray<'c>

ResizeArray.partitionMap mapper source

Full Usage: ResizeArray.partitionMap mapper source

Parameters:
    mapper : 'T -> Choice<'T1, 'T2>
    source : 'T array

Returns: 'T1[] * 'T2[] A tuple with both resulting arrays.

Creates two arrays by applying the mapper function to each element in the array and classifying the transformed values depending on whether they were wrapped with Choice1Of2 or Choice2Of2.

mapper : 'T -> Choice<'T1, 'T2>
source : 'T array
Returns: 'T1[] * 'T2[]

A tuple with both resulting arrays.

ResizeArray.replace oldValue newValue source

Full Usage: ResizeArray.replace oldValue newValue source

Parameters:
    oldValue : 'T[]
    newValue : 'T[]
    source : 'T[]

Returns: 'T[]

Replaces a subsequence of the source array with the given replacement array.

oldValue : 'T[]
newValue : 'T[]
source : 'T[]
Returns: 'T[]

ResizeArray.split separators source

Full Usage: ResizeArray.split separators source

Parameters:
    separators : seq<'a[]>
    source : 'a[]

Returns: seq<'a[]>

Creates a sequence of arrays by splitting the source array on any of the given separators.

separators : seq<'a[]>
source : 'a[]
Returns: seq<'a[]>

ResizeArray.tryFindSliceIndex slice source

Full Usage: ResizeArray.tryFindSliceIndex slice source

Parameters:
    slice : 'a[]
    source : 'a[]

Returns: int option The index of the slice or None.

Returns the index of the first occurrence of the specified slice in the source. Returns None if not found.

slice : 'a[]
source : 'a[]
Returns: int option

The index of the slice or None.

ResizeArray.zipShortest a1 a2

Full Usage: ResizeArray.zipShortest a1 a2

Parameters:
    a1 : ResizeArray<'T1> - First input ResizeArray.
    a2 : ResizeArray<'T2> - Second input ResizeArray.

Returns: ResizeArray<'T1 * 'T2> ResizeArray with corresponding pairs of input ResizeArrays.

Zip safely two ResizeArrays. If one ResizeArray is shorter, excess elements are discarded from the right end of the longer ResizeArray.

a1 : ResizeArray<'T1>

First input ResizeArray.

a2 : ResizeArray<'T2>

Second input ResizeArray.

Returns: ResizeArray<'T1 * 'T2>

ResizeArray with corresponding pairs of input ResizeArrays.