@@ -49,16 +49,16 @@ static string DailyComment(DateTime day)
49
49
return string . Join ( " " , comments . ToArray ( ) ) ;
50
50
}
51
51
52
- // note that here I use Tuple instead of KeyValuePair, but that's a minor detail
53
- static IEnumerable < ValueTuple < Predicate < T > , Func < T , R > > > Switch < T , R > ( )
54
- => Enumerable . Empty < ValueTuple < Predicate < T > , Func < T , R > > > ( ) ;
52
+ // note that here I use a tuple instead of KeyValuePair, but that's a minor detail
53
+ static IEnumerable < ( Predicate < T > , Func < T , R > ) > Switch < T , R > ( )
54
+ => Enumerable . Empty < ( Predicate < T > , Func < T , R > ) > ( ) ;
55
55
56
- static IEnumerable < ValueTuple < Predicate < T > , Func < T , R > > > Case < T , R > (
57
- this IEnumerable < ValueTuple < Predicate < T > , Func < T , R > > > rules
56
+ static IEnumerable < ( Predicate < T > , Func < T , R > ) > Case < T , R > (
57
+ this IEnumerable < ( Predicate < T > , Func < T , R > ) > rules
58
58
, Predicate < T > pred , Func < T , R > func )
59
59
=> rules . Append ( ( pred , func ) ) ;
60
60
61
- static IEnumerable < R > MatchAll < T , R > ( this IEnumerable < ValueTuple < Predicate < T > , Func < T , R > > > rules , T t )
61
+ static IEnumerable < R > MatchAll < T , R > ( this IEnumerable < ( Predicate < T > , Func < T , R > ) > rules , T t )
62
62
=> rules . Where ( rule => rule . Item1 ( t ) )
63
63
. Map ( rule => rule . Item2 ( t ) ) ;
64
64
@@ -75,12 +75,12 @@ public static string TestDateComment(string date)
75
75
// method that returns the result of invoking the function of the _first_
76
76
// matching case.
77
77
78
- static IEnumerable < ValueTuple < Predicate < T > , Func < T , R > > > Case < T , R > (
79
- this IEnumerable < ValueTuple < Predicate < T > , Func < T , R > > > rules
78
+ static IEnumerable < ( Predicate < T > , Func < T , R > ) > Case < T , R > (
79
+ this IEnumerable < ( Predicate < T > , Func < T , R > ) > rules
80
80
, T value , Func < T , R > func )
81
81
=> rules . Append ( ( new Predicate < T > ( v => v . Equals ( value ) ) , func ) ) ;
82
82
83
- static R Match < T , R > ( this IEnumerable < ValueTuple < Predicate < T > , Func < T , R > > > rules , T t )
83
+ static R Match < T , R > ( this IEnumerable < ( Predicate < T > , Func < T , R > ) > rules , T t )
84
84
=> rules . Where ( rule => rule . Item1 ( t ) )
85
85
. First ( ) . Item2 ( t ) ;
86
86
0 commit comments