From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.0 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 3091EBC69 for ; Sun, 19 Aug 2007 12:27:13 +0200 (CEST) Received: from ausone.inria.fr (peray.inria.fr [128.93.8.98]) by discorde.inria.fr (8.13.6/8.13.6) with SMTP id l7JAR9jI017198; Sun, 19 Aug 2007 12:27:10 +0200 Received: by ausone.inria.fr (sSMTP sendmail emulation); Sun, _d Aug 2007 12:26:46 +0200 From: "Nicolas Pouillard" Cc: Jon Harrop , "O'Caml Mailing List" Subject: Re: [Caml-list] List comprehensions To: Joel Reymont References: <200708181528.18107.jon@ffconsultancy.com> <34D0D539-54E0-4867-AA9F-5327683004E2@gmail.com> In-Reply-To: <34D0D539-54E0-4867-AA9F-5327683004E2@gmail.com> Date: Sun, 19 Aug 2007 12:26:46 +0200 Message-Id: <1187519133-sup-1765@ert.local> User-Agent: Sup/0.1 Content-Disposition: inline Content-Type: text/plain; charset=utf-8 X-j-chkmail-Score: MSGID : 46C81AFD.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 46C81AFD.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 2007,:98 wrote:01 caml-list:01 int:01 variables:02 aka:04 variable:06 0200:07 nicolas:08 nicolas:08 generators:10 aug:10 aug:10 something:14 use:16 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