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>(); } )); }
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) )); }
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()); }