ACCEPTABLE?: List Comprehensions?
Neal Gafter
neal at gafter.com
Mon Mar 16 11:03:28 PDT 2009
This is sort of a half-way to C#'s LINQ (language integrated native
query), which has proven remarkably successful. It's been integrated
into Scala as well. I think that bucket of changes is worth
considering, but certainly not in the scope of project Coin.
On Mon, Mar 16, 2009 at 10:16 AM, Paulo Levi <i30817 at gmail.com> wrote:
> I would love list comprehensions, but only if they were amenable to using
> all kinds of statements there (methods) and many comprehension statements
> in one list.
>
> List<Integer> input ....
> List<Integer> out = [x + valueToAdd for x : input if x % 2 == 0; x +
> valueToAdd + 2 for x : input];
> Possibly this could be compressed for the same list (as here) to:
> List<Integer> out = [x + valueToAdd if x % 2 == 0, x + valueToAdd + 2 for x
> : in];
> With only one iteration needed.
>
> Would LOVE this.
>
>
More information about the coin-dev
mailing list