It's this overload: http://msdn.microsoft.com/en-us/library/bb534631.aspx
Just replace "IEnumerable<T>" with "Future<T>". LINQ interfaces are a syntactic pattern, so your Foo<T> must simply implement Select, Where and SelectMany extension methods (effectively map, filter and bind from functional languages, respectively) for the most common "queries".
For Future<T>, the pseudo-ML signature of SelectMany:val SelectMany : Future 'a * ('a -> Future 'b) * ('a * 'b -> 'c) -> Future 'c
This specific overload allows you to chain as many futures as you like:
from x in fut1
from y in fut2
from z in fut3
from a in fut4
...
select DoFoo(x, y, z, a, ...);
Desugars to:
fut1.SelectMany(x => fut2, (x, y) => new { x = x, y = y })
.SelectMany(pair => fut3, (pair, z) => new { x = pair.x, y =
pair.y, z = z })
.SelectMany(triple => fut4, (triple, a) => new { x = triple.x, y
= triple.y, z = triple.z, a = a })
...
.Select(tuple => DoFoo(tuple.x, tuple.y, tuple.z, tuple.a, ...));
Sandro
On 29/08/2013 10:18 PM, William ML Leslie wrote:
On 30 August 2013 01:13, Sandro Magi <[email protected]> wrote:Oops, that should be: var result = farDog.SelectMany(resDog => farCar, (resDog, resCar) => resCar.DriveTo(vet, resDog));Shiny. What are the types here? I couldn't really discern from the signatures on http://msdn.microsoft.com/en-us/library/system.linq.enumerable.selectmany.aspx But it looks great to me.
smime.p7s
Description: S/MIME Cryptographic Signature
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
