public static IDelayed <ISeq <T> > Concat <T>( this IDelayed <ISeq <T> > delayedSeq0, IDelayed <ISeq <T> > delayedSeq1) { return(delayedSeq0.FlatMap(seq0 => seq0.Case( () => delayedSeq1, pair => Cons(pair.Item0, Delayed.Return(() => pair.Item1.Concat(delayedSeq1).Force()))))); }
public static IDelayed <ISeq <T1> > Select <T0, T1>( this IDelayed <ISeq <T0> > delayedSeq, Func <T0, T1> selector) { return(delayedSeq.FlatMap(seq => seq.Case( () => Seq.Empty <T1>(), pair => Seq.Cons(selector(pair.Item0), Delayed.Return(() => pair.Item1.Select(selector)).Force())))); }
public static IDelayed <ISeq <T> > Where <T>( this IDelayed <ISeq <T> > delayedSeq, Func <T, bool> predicate) { return(delayedSeq.FlatMap(seq => seq.Case( () => Seq.Empty <T>(), pair => predicate(pair.Item0) ? Seq.Cons(pair.Item0, Delayed.Return(() => pair.Item1.Where(predicate).Force())) : Delayed.Return(() => pair.Item1.Where(predicate).Force())))); }