From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id MAA24814; Tue, 26 Nov 2002 12:56:11 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id MAA25663 for ; Tue, 26 Nov 2002 12:56:10 +0100 (MET) Received: from verdot.inria.fr (verdot.inria.fr [128.93.11.7]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gAQBuAX00799 for ; Tue, 26 Nov 2002 12:56:10 +0100 (MET) Received: (from ddr@localhost) by verdot.inria.fr (8.9.3/8.9.3) id MAA08598 for caml-list@inria.fr; Tue, 26 Nov 2002 12:56:10 +0100 Date: Tue, 26 Nov 2002 12:56:10 +0100 From: Daniel de Rauglaudre To: caml-list@inria.fr Subject: Re: [Caml-list] camlp4 and let binding... Message-ID: <20021126125610.D8318@verdot.inria.fr> References: <20021126042909.GD29607@zed> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20021126042909.GD29607@zed>; from Pietro.Abate@anu.edu.au on Tue, Nov 26, 2002 at 03:29:09PM +1100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, On Tue, Nov 26, 2002 at 03:29:09PM +1100, Pietro Abate wrote: > > I wrote something that, of course, doesn't work. My major problems are about > the inner let definitions. How can I chain all let defintions in the list ? I am not sure I understand what you want to do but this: > value $lid:pref$ = $list:definition$ in > new rule(pattern,action) > >> is syntactically incorrect: you must not put "in" after a "value". If you want to make a let..in inside (like in your example), you have to make the variable "definition" a list of (patt * expr) and you can write: > If "definition" is, for example, the list: [(p1, e1); (p2; e2)] it is equivalent to: > If you prefer a "let..in let.. in" instead of "let .. and .. in", you have to write it explicitely: > If you want that, but you have a list of let..in with an unknown number of elements, you have to do it with an iterator, e.g.: List.fold_right (fun (p1, e1) e -> <:expr< let $p1$ = $e1$ in $e$ >>) list <:expr< new rule(pattern, action) >> -- Daniel de RAUGLAUDRE http://cristal.inria.fr/~ddr/ ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners