Alex Rivera | Logout

F# Seq module implemented in C# for IEnumerable?

Asked 2009-01-04T09:15:56.387
12

F# has a bunch of standard sequence operators I have come to know and love from my experience with Mathematica. F# is getting lots of my attention now, and when it is in general release, I intend to use it frequently.

Right now, since F# isn't yet in general release, I can't really use it in production code. LINQ implements some of these operators using SQL-like names (e.g. 'select' is 'map', and 'where' is 'filter'), but I can find no implementation of 'fold', 'iter' or 'partition'.

Has anyone seen any C# implementation of standard sequence operators? Is this something someone should write?

c# f#
Edit
Report

1 Answer

1

ToLookup would probably be a better match for List.partition:

IEnumerable<T> sequence = SomeSequence();
ILookup<bool, T> lookup = sequence.ToLookup(x => SomeCondition(x));
IEnumerable<T> trueValues = lookup[true];
IEnumerable<T> falseValues = lookup[false];
answered 2009-06-17T14:28:16.610

Your Answer