FunVec1T   Conversion (FuncInt32, T to FunVec1T)

1-dimensional vector with optional length, values of which are determined by the getValueByIndex function.
C#
static int Factorial(int number) { .. }

FunVec1<int> factorials = new(Factorial);
Assert(factorials.Length1 == int.MaxValue); // since length1 is omitted
Assert(factorials[3] == 6);
Assert(factorials[5] == 120);

FunVec1<int> factorialsUpTo4 = new(Factorial, Some(4));
Assert(factorialsUpTo4.Length1 == 4);
Assert(factorialsUpTo4[3] == 6);
// Assert(factorialsUpTo4[5] == 120); // out-of-bounds, throws!
Assert(factorialsUpTo4.Get(5).IsNone);

Definition

Namespace: Orx.Fun.FunVec
Assembly: Orx.Fun.FunVec (in Orx.Fun.FunVec.dll) Version: 1.0.0
C#
public static implicit operator FunVec1<T> (
	Func<int, T> getValueByIndex
)

Parameters

getValueByIndex  FuncInt32, T

Return Value

FunVec1T

See Also