-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCurry1.cs
More file actions
28 lines (23 loc) · 726 Bytes
/
Copy pathCurry1.cs
File metadata and controls
28 lines (23 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
using System;
using System.Dynamic;
using static Ramda.NET.Currying;
using System.Collections.Generic;
using static Ramda.NET.ReflectionExtensions;
namespace Ramda.NET
{
internal class Curry1 : AbstractLambda
{
internal Curry1(DynamicDelegate fn) : base(fn, 1) {
}
internal Curry1(Delegate fn) : base(new DelegateDecorator(fn)) {
}
protected override object TryInvoke(InvokeBinder binder, object[] arguments) {
object arg1 = null;
var length = Currying.Arity(arguments);
if (length == 0 || R.__.Equals(arg1 = arguments[0])) {
return Curry1(fn);
}
return fn(arg1);
}
}
}