Func<IList<T>,IList<T>> incrementer ) {
while( !finalState(theList) ) {
yield return theList.Head;
theList = incrementer( theList );
}
}
public static IList<T> Where<T>( this IList<T> theList,
Func<T, bool> predicate ) {
Func<IList<T>> whereTailFunc = null;
whereTailFunc = () => {
IList<T> result = null;
if( theList.Tail == null ) {
result = new MyList<T>( default(T), null );
}
if( predicate(theList.Head) ) {
result = new MyList<T>( theList.Head,
whereTailFunc );
}
theList = theList.Tail;
if( result == null ) {
result = whereTailFunc();
}
return result;
};
return whereTailFunc();
}
public static IList<R> Select<T,R>( this IList<T> theList,
Func<T,R> selector ) {
Func<IList<R>> selectorTailFunc = null;
selectorTailFunc = () => {
IList<R> result = null;
if( theList.Tail ...