FSharpAux


Array

Namespace: FSharpAux
Attributes:
[<AutoOpen>]

Functions and values

Function or valueDescription
binarySearchIndexBy compare arr
Signature: compare:('a -> int) -> arr:'a [] -> int
Type parameters: 'a

Uses a binary search to retrieve an element out of the sorted array arr that fullfills a condition defined by the function compare. The compare function has to be implemented in the following way: let find findThis elementOfArray = if abs (findThis - elementOfArray) < 0.001 then 0 elif findThis < elementOfArray then -1 else 1 If an element in the array is found that satisfies the condition returning 0, the index is returned. If the search ends within the array, the negative bitwise complement of the closest larger element is returned. If the element is bigger than the largest element of the array, the negative bitwise complement of the arr.lenght+1 is returned.

centeredWindow n source
Signature: n:int -> source:'?9061 [] -> '?9061 [] []
Type parameters: '?9061

Returns an array of sliding windows of data drawn from the source array. Each window contains the n elements surrounding the current element.

checkNonNull argName arg
Signature: argName:string -> arg:'?9037 -> unit
Type parameters: '?9037
contains x arr
Signature: x:'T -> arr:'T [] -> bool
Type parameters: 'T
countDistinctBy keyf arr
Signature: keyf:('T -> 'Key) -> arr:'T array -> ('Key * int) []
Type parameters: 'T, 'Key

Applies a keyfunction to each element and counts the amount of each distinct resulting key

fold2Sub f acc arr1 arr2 iFrom iTo
Signature: f:('State -> 'T1 -> 'T2 -> 'State) -> acc:'State -> arr1:'T1 [] -> arr2:'T2 [] -> iFrom:int -> iTo:int -> 'State
Type parameters: 'T1, 'T2, 'State
foldi f acc arr
Signature: f:(int -> 'State -> 'T -> 'State) -> acc:'State -> arr:'T [] -> 'State
Type parameters: 'State, 'T

Applies a function to each element and its index of the array, threading an accumulator argument through the computation

foldSub f acc arr iFrom iTo
Signature: f:('State -> 'T -> 'State) -> acc:'State -> arr:'T [] -> iFrom:int -> iTo:int -> 'State
Type parameters: 'T, 'State
removeIndex index arr
Signature: index:int -> arr:'T [] -> 'T []
Type parameters: 'T
scanReduce f arr
Signature: f:('?9049 -> '?9049 -> '?9049) -> arr:'?9049 [] -> '?9049 []
Type parameters: '?9049
scanReduceBack f arr
Signature: f:('?9051 -> '?9051 -> '?9051) -> arr:'?9051 [] -> '?9051 []
Type parameters: '?9051
scanSubLeft f initState arr start fin
Signature: f:('?9046 -> '?9047 -> '?9046) -> initState:'?9046 -> arr:'?9047 [] -> start:int -> fin:int -> '?9046 []
Type parameters: '?9046, '?9047
scanSubRight f arr start fin initState
Signature: f:('?9043 -> '?9044 -> '?9044) -> arr:'?9043 [] -> start:int -> fin:int -> initState:'?9044 -> '?9044 []
Type parameters: '?9043, '?9044
shuffleFisherYates(arr)
Signature: arr:'?9057 [] -> '?9057 []
Type parameters: '?9057

Shuffels the input array (method: Fisher-Yates)

stackHorizontal(arrs)
Signature: arrs:'t array array -> 't [,]
Type parameters: 't

Stacks an array of arrays horizontaly

stackVertical(arrs)
Signature: arrs:'t array array -> 't [,]
Type parameters: 't

Stacks an array of arrays vertivaly

tryFindDefault arr zero index
Signature: arr:'value [] -> zero:'value -> index:int -> 'value
Type parameters: 'value

Look up an element in an array by index, returning a value if the index is in the domain of the array and default value if not

Type extensions

Type extensionDescription
x.TryFindDefault arr zero index
Signature: (arr:'value []) -> zero:'value -> index:int -> 'value
Type parameters: 'value

Look up an element in an array by index, returning a value if the index is in the domain of the array and default value if not

CompiledName: []`1.TryFindDefault

Fork me on GitHub