Exemplo n.º 1
0
 public Option <RT> Match <RT>(Func <T1, RT> type1Func, Action <T2> type2Action)
 {
     return(Match <Option <RT> >(
                x => type1Func(x),
                x => {
         type2Action(x);
         return Option.New <RT>();
     }
                ));
 }
Exemplo n.º 2
0
 public Option <RT> Match <RT>(Action <T1> type1Action, Func <T2, RT> type2Func)
 {
     return(Match <Option <RT> >(
                x => {
         type1Action(x);
         return Option.New <RT>();
     },
                x => type2Func(x)
                ));
 }
Exemplo n.º 3
0
        private static int GetFirstSequenceGap(IEnumerable <int> seq)
        {
            var currentMax = seq.Max();
            var fullSeq    = Methods.CreateSequence <int>(
                x => x.Match <Option <int> >(
                    y => y > currentMax ? new Option <int>() : Option.New(y + 1),
                    y => 0
                    )
                );

            return(fullSeq.Except(seq).First());
        }