Provides extension methods on Action<T>, Func<T, TResult>, and related delegates.
Cadenza.FuncCoda provides methods methods for:
- Delegate currying and partial application (DelegateCoda.Curry)
- Delegate composition (DelegateCoda.Compose)
- Timing generation (DelegateCoda.Timings)
Currying via partial application is a way to easily transform functions which accept N arguments into functions which accept N-1 arguments, by "fixing" arguments with a value.
C# Example // partial application: Func<int,int,int,int> function = (int a, int b, int c) => a + b + c; Func<int,int,int> f_3 = function.Curry (3); Func<int> f_321 = function.Curry (3, 2, 1); Console.WriteLine (f_3 (2, 1)); // prints (3 + 2 + 1) == "6" Console.WriteLine (f_321 ()); // prints (3 + 2 + 1) == "6""Traditional" currying converts a delegate that accepts N arguments into a delegate which accepts only one argument, but when invoked may return a further delegate (etc.) until the final value is returned.
C# Example // traditional currying: Func<int, Func<int, Func<int, int>>> curry = function.Curry (); Func<int, Func<int, int>> fc_1 = curry (1); Func<int, int> fc_12 = fc_1 (2); Console.WriteLine (fc_12 (3)); // prints (3 + 2 + 1) == "6" Console.WriteLine (curry (3)(2)(1)); // prints (3 + 2 + 1) == "6"Composition is a way to easy chain (or pipe) together multiple delegates so that the return value of a "composer" delegate is used as the input parameter for the chained delegate:
C# Example Func<int,string> tostring = Lambda.F ((int n) => n.ToString ()); Func<int, int> doubler = Lambda.F ((int n) => n * 2); Func<int, string> double_then_tostring = tostring.Compose (doubler); Console.WriteLine (double_then_tostring (5)); // Prints "10";All possible argument and return delegate permutations are provided for the Func<T, TResult> and related types.
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
See Also: Inherited members from object.
⊟ Public Methods
⊟ Compose<T,TResult> Generic Method
Creates a Func<TResult> delegate.
⊟ Type Parameters
- T
- The Func<T> return type, and Func<T, TResult> argument type.
- TResult
- The Func<T, TResult> return type.
⊟ Parameters
- self
- The Func<T, TResult> to compose.
- composer
- The Func<T> to compose with self.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke composer and pass the return value of composer to self.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
composer is null.
⊟ Remarks
Composition is useful for chaining delegates together, so that the return value of composer is automatically used as the input parameter for self.
C# Example Func<int,string> tostring = Lambda.F ((int n) => n.ToString ()); Func<int, int> doubler = Lambda.F ((int n) => n * 2); Func<int, string> double_then_tostring = tostring.Compose (doubler); Console.WriteLine (double_then_tostring (5)); // Prints "10";⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Compose<T1,T2,TResult> Generic Method
Creates a Func<T1, TResult> delegate.
public static Func<T1, TResult> Compose<T1, T2, TResult> (this Func<T2, TResult> self, Func<T1, T2> composer)⊟ Type Parameters
- T1
- Documentation for this section has not yet been entered.
- T2
- The Func<T1, T2> return type, and Func<T2, TResult> argument type.
- TResult
- The Func<T2, TResult> return type.
⊟ Parameters
- self
- The Func<T2, TResult> to compose.
- composer
- The Func<T1, T2> to compose with self.
⊟ Returns
Returns a Func<T1, TResult> which, when invoked, will invoke composer and pass the return value of composer to self.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
composer is null.
⊟ Remarks
Composition is useful for chaining delegates together, so that the return value of composer is automatically used as the input parameter for self.
C# Example Func<int,string> tostring = Lambda.F ((int n) => n.ToString ()); Func<int, int> doubler = Lambda.F ((int n) => n * 2); Func<int, string> double_then_tostring = tostring.Compose (doubler); Console.WriteLine (double_then_tostring (5)); // Prints "10";⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Compose<T1,T2,T3,TResult> Generic Method
Creates a Func<T1, T2, TResult> delegate.
public static Func<T1, T2, TResult> Compose<T1, T2, T3, TResult> (this Func<T3, TResult> self, Func<T1, T2, T3> composer)⊟ Type Parameters
- T1
- A Func<T1, T2, T3> parameter type.
- T2
- Documentation for this section has not yet been entered.
- T3
- The Func<T1, T2, T3> return type, and Func<T3, TResult> argument type.
- TResult
- The Func<T3, TResult> return type.
⊟ Parameters
- self
- The Func<T3, TResult> to compose.
- composer
- The Func<T1, T2, T3> to compose with self.
⊟ Returns
Returns a Func<T1, T2, TResult> which, when invoked, will invoke composer and pass the return value of composer to self.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
composer is null.
⊟ Remarks
Composition is useful for chaining delegates together, so that the return value of composer is automatically used as the input parameter for self.
C# Example Func<int,string> tostring = Lambda.F ((int n) => n.ToString ()); Func<int, int> doubler = Lambda.F ((int n) => n * 2); Func<int, string> double_then_tostring = tostring.Compose (doubler); Console.WriteLine (double_then_tostring (5)); // Prints "10";⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Compose<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T1, T2, T3, TResult> delegate.
public static Func<T1, T2, T3, TResult> Compose<T1, T2, T3, T4, TResult> (this Func<T4, TResult> self, Func<T1, T2, T3, T4> composer)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4> parameter type.
- T2
- A Func<T1, T2, T3, T4> parameter type.
- T3
- Documentation for this section has not yet been entered.
- T4
- The Func<T1, T2, T3, T4> return type, and Func<T4, TResult> argument type.
- TResult
- The Func<T4, TResult> return type.
⊟ Parameters
- self
- The Func<T4, TResult> to compose.
- composer
- The Func<T1, T2, T3, T4> to compose with self.
⊟ Returns
Returns a Func<T1, T2, T3, TResult> which, when invoked, will invoke composer and pass the return value of composer to self.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
composer is null.
⊟ Remarks
Composition is useful for chaining delegates together, so that the return value of composer is automatically used as the input parameter for self.
C# Example Func<int,string> tostring = Lambda.F ((int n) => n.ToString ()); Func<int, int> doubler = Lambda.F ((int n) => n * 2); Func<int, string> double_then_tostring = tostring.Compose (doubler); Console.WriteLine (double_then_tostring (5)); // Prints "10";⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Compose<T1,T2,T3,T4,T5,TResult> Generic Method
Creates a Func<T1, T2, T3, T4, TResult> delegate.
public static Func<T1, T2, T3, T4, TResult> Compose<T1, T2, T3, T4, T5, TResult> (this Func<T5, TResult> self, Func<T1, T2, T3, T4, T5> composer)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, T5> parameter type.
- T2
- A Func<T1, T2, T3, T4, T5> parameter type.
- T3
- A Func<T1, T2, T3, T4, T5> parameter type.
- T4
- Documentation for this section has not yet been entered.
- T5
- The Func<T1, T2, T3, T4, T5> return type, and Func<T5, TResult> argument type.
- TResult
- The Func<T5, TResult> return type.
⊟ Parameters
- self
- The Func<T5, TResult> to compose.
- composer
- The Func<T1, T2, T3, T4, T5> to compose with self.
⊟ Returns
Returns a Func<T1, T2, T3, T4, TResult> which, when invoked, will invoke composer and pass the return value of composer to self.⊟ Exceptions
Type Reason ArgumentNullException self is null.
-or-
composer is null.
⊟ Remarks
Composition is useful for chaining delegates together, so that the return value of composer is automatically used as the input parameter for self.
C# Example Func<int,string> tostring = Lambda.F ((int n) => n.ToString ()); Func<int, int> doubler = Lambda.F ((int n) => n * 2); Func<int, string> double_then_tostring = tostring.Compose (doubler); Console.WriteLine (double_then_tostring (5)); // Prints "10";⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T,TResult> Generic Method
Creates a Func<T, TResult> for currying.
public static Func<T, TResult> Curry<T, TResult> (this Func<T, TResult> self)⊟ Type Parameters
- T
- The first value type.
- TResult
- The return value type.
⊟ Parameters
- self
- The Func<T, TResult> to curry.
⊟ Returns
A Func<T, TResult> which, when invoked, will invoke self.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
This is the more "traditional" view of currying, turning a method which takes (X * Y)->Z (i.e. separate arguments) into a X -> (Y -> Z) (that is a "chain" of nested Funcs such that you provide only one argument to each Func until you provide enough arguments to invoke the original method).
C# Example Func<int,int,int,int> function = (int a, int b, int c) => a + b + c; Func<int,Func<int,Func<int, int>>> curry = function.Curry (); Assert.AreEqual(6, curry (3)(2)(1));⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T,TResult> Generic Method
Creates a Func<TResult> delegate.
⊟ Type Parameters
- T
- A Func<T, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T> which contains the values to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T,TResult> Generic Method
Creates a Func<TResult> delegate.
public static Func<TResult> Curry<T, TResult> (this Func<T, TResult> self, T value)⊟ Type Parameters
- T
- A Func<T, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T, TResult> to curry.
- value
- A value of type T to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,TResult> Generic Method
Creates a Func<T1, Func<T2, TResult>> for currying.
public static Func<T1, Func<T2, TResult>> Curry<T1, T2, TResult> (this Func<T1, T2, TResult> self)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- TResult
- The return value type.
⊟ Parameters
- self
- The Func<T1, T2, TResult> to curry.
⊟ Returns
A Func<T1, Func<T2, TResult>> which, when invoked, will return a Func<T2, TResult> which, when invoked, will invoke self.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
This is the more "traditional" view of currying, turning a method which takes (X * Y)->Z (i.e. separate arguments) into a X -> (Y -> Z) (that is a "chain" of nested Funcs such that you provide only one argument to each Func until you provide enough arguments to invoke the original method).
C# Example Func<int,int,int,int> function = (int a, int b, int c) => a + b + c; Func<int,Func<int,Func<int, int>>> curry = function.Curry (); Assert.AreEqual(6, curry (3)(2)(1));⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,TResult> Generic Method
Creates a Func<TResult> delegate.
public static Func<TResult> Curry<T1, T2, TResult> (this Func<T1, T2, TResult> self, Tuple<T1, T2> values)⊟ Type Parameters
- T1
- A Func<T1, T2, TResult> parameter type.
- T2
- A Func<T1, T2, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1, T2> which contains the values to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,TResult> Generic Method
Creates a Func<T2, TResult> delegate.
public static Func<T2, TResult> Curry<T1, T2, TResult> (this Func<T1, T2, TResult> self, Tuple<T1> values)⊟ Type Parameters
- T1
- A Func<T1, T2, TResult> parameter type.
- T2
- A Func<T1, T2, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1> which contains the values to fix.
⊟ Returns
Returns a Func<T2, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,TResult> Generic Method
Creates a Func<T2, TResult> delegate.
public static Func<T2, TResult> Curry<T1, T2, TResult> (this Func<T1, T2, TResult> self, T1 value1)⊟ Type Parameters
- T1
- A Func<T1, T2, TResult> parameter type.
- T2
- A Func<T1, T2, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, TResult> to curry.
- value1
- A value of type T1 to fix.
⊟ Returns
Returns a Func<T2, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,TResult> Generic Method
Creates a Func<TResult> delegate.
public static Func<TResult> Curry<T1, T2, TResult> (this Func<T1, T2, TResult> self, T1 value1, T2 value2)⊟ Type Parameters
- T1
- A Func<T1, T2, TResult> parameter type.
- T2
- A Func<T1, T2, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, TResult> to curry.
- value1
- A value of type T1 to fix.
- value2
- A value of type T2 to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,TResult> Generic Method
Creates a Func<T1, Func<T2, Func<T3, TResult>>> for currying.
public static Func<T1, Func<T2, Func<T3, TResult>>> Curry<T1, T2, T3, TResult> (this Func<T1, T2, T3, TResult> self)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- The third value type.
- TResult
- The return value type.
⊟ Parameters
- self
- The Func<T1, T2, T3, TResult> to curry.
⊟ Returns
A Func<T1, Func<T2, Func<T3, TResult>>> which, when invoked, will return a Func<T2, Func<T3, TResult>> which, when invoked, will return a Func<T3, TResult> which, when invoked, will invoke self.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
This is the more "traditional" view of currying, turning a method which takes (X * Y)->Z (i.e. separate arguments) into a X -> (Y -> Z) (that is a "chain" of nested Funcs such that you provide only one argument to each Func until you provide enough arguments to invoke the original method).
C# Example Func<int,int,int,int> function = (int a, int b, int c) => a + b + c; Func<int,Func<int,Func<int, int>>> curry = function.Curry (); Assert.AreEqual(6, curry (3)(2)(1));⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,TResult> Generic Method
Creates a Func<TResult> delegate.
public static Func<TResult> Curry<T1, T2, T3, TResult> (this Func<T1, T2, T3, TResult> self, Tuple<T1, T2, T3> values)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, TResult> parameter type.
- T2
- A Func<T1, T2, T3, TResult> parameter type.
- T3
- A Func<T1, T2, T3, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1, T2, T3> which contains the values to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,TResult> Generic Method
Creates a Func<T3, TResult> delegate.
public static Func<T3, TResult> Curry<T1, T2, T3, TResult> (this Func<T1, T2, T3, TResult> self, Tuple<T1, T2> values)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, TResult> parameter type.
- T2
- A Func<T1, T2, T3, TResult> parameter type.
- T3
- A Func<T1, T2, T3, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1, T2> which contains the values to fix.
⊟ Returns
Returns a Func<T3, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,TResult> Generic Method
Creates a Func<T2, T3, TResult> delegate.
public static Func<T2, T3, TResult> Curry<T1, T2, T3, TResult> (this Func<T1, T2, T3, TResult> self, Tuple<T1> values)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, TResult> parameter type.
- T2
- A Func<T1, T2, T3, TResult> parameter type.
- T3
- A Func<T1, T2, T3, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1> which contains the values to fix.
⊟ Returns
Returns a Func<T2, T3, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,TResult> Generic Method
Creates a Func<T2, T3, TResult> delegate.
public static Func<T2, T3, TResult> Curry<T1, T2, T3, TResult> (this Func<T1, T2, T3, TResult> self, T1 value1)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, TResult> parameter type.
- T2
- A Func<T1, T2, T3, TResult> parameter type.
- T3
- A Func<T1, T2, T3, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, TResult> to curry.
- value1
- A value of type T1 to fix.
⊟ Returns
Returns a Func<T2, T3, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,TResult> Generic Method
Creates a Func<T3, TResult> delegate.
public static Func<T3, TResult> Curry<T1, T2, T3, TResult> (this Func<T1, T2, T3, TResult> self, T1 value1, T2 value2)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, TResult> parameter type.
- T2
- A Func<T1, T2, T3, TResult> parameter type.
- T3
- A Func<T1, T2, T3, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, TResult> to curry.
- value1
- A value of type T1 to fix.
- value2
- A value of type T2 to fix.
⊟ Returns
Returns a Func<T3, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,TResult> Generic Method
Creates a Func<TResult> delegate.
public static Func<TResult> Curry<T1, T2, T3, TResult> (this Func<T1, T2, T3, TResult> self, T1 value1, T2 value2, T3 value3)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, TResult> parameter type.
- T2
- A Func<T1, T2, T3, TResult> parameter type.
- T3
- A Func<T1, T2, T3, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, TResult> to curry.
- value1
- A value of type T1 to fix.
- value2
- A value of type T2 to fix.
- value3
- A value of type T3 to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T1, Func<T2, Func<T3, Func<T4, TResult>>>> for currying.
public static Func<T1, Func<T2, Func<T3, Func<T4, TResult>>>> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self)⊟ Type Parameters
- T1
- The first value type.
- T2
- The second value type.
- T3
- The third value type.
- T4
- The fourth value type.
- TResult
- The return value type.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
⊟ Returns
A Func<T1, Func<T2, Func<T3, Func<T4, TResult>>>> which, when invoked, will return a Func<T2, Func<T3, Func<T4, TResult>>> which, when invoked, will return a Func<T3, Func<T4, TResult>> which, when invoked, will return a Func<T4, TResult> which, when invoked, will invoke self.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
This is the more "traditional" view of currying, turning a method which takes (X * Y)->Z (i.e. separate arguments) into a X -> (Y -> Z) (that is a "chain" of nested Funcs such that you provide only one argument to each Func until you provide enough arguments to invoke the original method).
C# Example Func<int,int,int,int> function = (int a, int b, int c) => a + b + c; Func<int,Func<int,Func<int, int>>> curry = function.Curry (); Assert.AreEqual(6, curry (3)(2)(1));⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<TResult> delegate.
public static Func<TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, Tuple<T1, T2, T3, T4> values)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1, T2, T3, T4> which contains the values to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T4, TResult> delegate.
public static Func<T4, TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, Tuple<T1, T2, T3> values)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1, T2, T3> which contains the values to fix.
⊟ Returns
Returns a Func<T4, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T3, T4, TResult> delegate.
public static Func<T3, T4, TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, Tuple<T1, T2> values)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1, T2> which contains the values to fix.
⊟ Returns
Returns a Func<T3, T4, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T2, T3, T4, TResult> delegate.
public static Func<T2, T3, T4, TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, Tuple<T1> values)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- values
- A value of type Cadenza.Tuple<T1> which contains the values to fix.
⊟ Returns
Returns a Func<T2, T3, T4, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T2, T3, T4, TResult> delegate.
public static Func<T2, T3, T4, TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, T1 value1)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- value1
- A value of type T1 to fix.
⊟ Returns
Returns a Func<T2, T3, T4, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T3, T4, TResult> delegate.
public static Func<T3, T4, TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, T1 value1, T2 value2)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- value1
- A value of type T1 to fix.
- value2
- A value of type T2 to fix.
⊟ Returns
Returns a Func<T3, T4, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<T4, TResult> delegate.
public static Func<T4, TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, T1 value1, T2 value2, T3 value3)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- value1
- A value of type T1 to fix.
- value2
- A value of type T2 to fix.
- value3
- A value of type T3 to fix.
⊟ Returns
Returns a Func<T4, TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0
⊟ Curry<T1,T2,T3,T4,TResult> Generic Method
Creates a Func<TResult> delegate.
public static Func<TResult> Curry<T1, T2, T3, T4, TResult> (this Func<T1, T2, T3, T4, TResult> self, T1 value1, T2 value2, T3 value3, T4 value4)⊟ Type Parameters
- T1
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T2
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T3
- A Func<T1, T2, T3, T4, TResult> parameter type.
- T4
- A Func<T1, T2, T3, T4, TResult> parameter type.
- TResult
- Documentation for this section has not yet been entered.
⊟ Parameters
- self
- The Func<T1, T2, T3, T4, TResult> to curry.
- value1
- A value of type T1 to fix.
- value2
- A value of type T2 to fix.
- value3
- A value of type T3 to fix.
- value4
- A value of type T4 to fix.
⊟ Returns
Returns a Func<TResult> which, when invoked, will invoke self along with the provided fixed parameters.⊟ Exceptions
Type Reason ArgumentNullException if self is null. ⊟ Remarks
Documentation for this section has not yet been entered.⊟ Requirements
Namespace: Cadenza
Assembly: Cadenza (in Cadenza.dll)
Assembly Versions: 0.1.0.0