Haskell:
test :: [ Integer ] test = do x <- [ 1 .. 5 ] guard $ odd x y <- [ 1 .. x ] return $ x * y |
C# (LINQ):
IEnumerable<int> test =
from x in Enumerable.Range(1,5)
where 0 != x % 2
from y in Enumerable.Range(1,x)
select x * y;
|
Linq: http://msdn.microsoft.com/en-us/library/bb397676.aspx
Beispiele: http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx(Vorsicht: inzwischen einige Methoden umbenannt)