]>
Excerpts from Joel Reymont's message of Sat Aug 18 16:44:04 +0200 2007:
>
> On Aug 18, 2007, at 3:28 PM, Jon Harrop wrote:
>
> > # [x + 2*x + x/2 | x <- [1; 2; 3; 4]];;
> > - : int list = [3; 7; 10; 14]
>
> How do you do something like this?
>
> [x + 2*x + y/2 | x <- [1; 2; 3; 4], [y <- [3; 4; 5]];;
>
> That is a list comprehension with more than one variable where all
> variables come from lists.
>
Use `;' to separate generators. And you have an extra `['.
[x + 2*x + y/2 | x <- [1; 2; 3; 4]; y <- [3; 4; 5]];;
--
Nicolas Pouillard aka Ertai