public static Boolean Any <T>( this IDelayed <ISeq <T> > delayedSeq) { return(delayedSeq.Force().Case( empty: () => false, headAndTail: _ => true)); }
public static bool Any <T>( this IDelayed <ISeq <T> > delayedSeq) { return(delayedSeq.Force().Case( () => false, _ => true)); }
public static T1 Foldl <T0, T1>(this IDelayed <ISeq <T0> > delayedSeq, T1 init, Func <T1, T0, T1> func) { return(delayedSeq.Force() .Case( () => init, pair => pair.Item1.Foldl(func(init, pair.Item0), func))); }
public static T1 Foldr <T0, T1>(this IDelayed <ISeq <T0> > delayedSeq, T1 init, Func <T0, T1, T1> func) { return(delayedSeq.Force() .Case( empty: () => init, headAndTail: pair => func(pair.Item0, Seq.Foldr(pair.Item1, init, func)))); }
public static Boolean Any <T>( this IDelayed <ISeq <T> > delayedSeq, Func <T, Boolean> predicate) { return(delayedSeq.Force().Case( empty: () => false, headAndTail: pair => predicate(pair.Item0) || Seq.Any(pair.Item1, predicate))); }
public static void ForEach <T>( this IDelayed <ISeq <T> > delayedSeq, Action <T> action) { foreach (var item in delayedSeq.Force().AsEnumerable()) { action(item); } }
public static bool Any <T>( this IDelayed <ISeq <T> > delayedSeq, Func <T, bool> predicate) { return(delayedSeq.Force().Case( () => false, pair => predicate(pair.Item0) || pair.Item1.Any(predicate))); }
public static Parser <TToken, T> Choice <TToken, T>( IDelayed <ISeq <Parser <TToken, T> > > parsers) { return(parsers.Force().Case( () => Parser.Fail <TToken, T>("Failure: Combinator.Choice"), pair => pair.Item0.Or(Choice(pair.Item1)))); }
public static Parser <TToken, IDelayed <ISeq <T> > > Sequence <TToken, T>( IDelayed <ISeq <Parser <TToken, T> > > parsers) { return(parsers.Force().Case( () => Parser.Return <TToken, IDelayed <ISeq <T> > >(Seq.Empty <T>()), pair => pair.Item0.SelectMany(value0 => Sequence(pair.Item1).Select(value1 => Seq.Cons(value0, value1))))); }
public static Parser <TToken, T> Choice <TToken, T>( IDelayed <ISeq <Parser <TToken, T> > > parsers) { return(parsers.Force().Case( empty: () => Parser.Fail <TToken, T>("Failure: Combinator.Choice"), headAndTail: pair => pair.Item0.Or(InternalCombinator.Choice(pair.Item1)))); }
public static Parser <TToken, IDelayed <ISeq <T> > > Sequence <TToken, T>( IDelayed <ISeq <Parser <TToken, T> > > parsers) { return(parsers.Force().Case( empty: () => Parser.Return <TToken, IDelayed <ISeq <T> > >(Seq.Empty <T>()), headAndTail: pair => pair.Item0.SelectMany(value0 => InternalCombinator.Sequence(pair.Item1).Select(value1 => Seq.Cons(value0, value1))))); }
public static IDelayed <T1> SelectMany <T0, T1>( this IDelayed <T0> value, Func <T0, IDelayed <T1> > selector) { return(selector(value.Force())); }
public static IDelayed <T1> Select <T0, T1>( this IDelayed <T0> value, Func <T0, T1> selector) { return(Delayed.Return(() => selector(value.Force()))); }
public ITokenStream <T> MoveNext() { return(restStream.Force()); }
public static Parser <TToken, T> Lazy <TToken, T>( IDelayed <Parser <TToken, T> > delayedParser) { return(stream => delayedParser.Force()(stream)); }
public static Int32 Count <T>(this IDelayed <ISeq <T> > delayedSeq) { return(delayedSeq.Force() .AsEnumerable().Count()); }