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 SAA02674; Mon, 17 Jun 2002 18:20:34 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA02758 for ; Mon, 17 Jun 2002 18:20:33 +0200 (MET DST) Received: from bastion.artisan.com (bastion.artisan.com [209.144.161.130]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g5HGKW128881 for ; Mon, 17 Jun 2002 18:20:32 +0200 (MET DST) Received: from ypmaster.artisan.com (ypmaster [172.16.2.1]) by bastion.artisan.com (8.9.2/8.9.2) with ESMTP id JAA28657; Mon, 17 Jun 2002 09:20:18 -0700 (PDT) Received: from spike.artisan.com (spike [172.16.10.92]) by ypmaster.artisan.com (8.9.2/8.9.2-arti) with ESMTP id JAA14185; Mon, 17 Jun 2002 09:20:18 -0700 (PDT) Received: (from johnm@localhost) by spike.artisan.com (8.11.3/8.11.3/SuSE Linux 8.11.1-0.5) id g5HGKI402783; Mon, 17 Jun 2002 09:20:18 -0700 X-Authentication-Warning: spike.artisan.com: johnm set sender to johnm@artisan.com using -f From: John Malecki MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15630.3137.985379.48421@spike.artisan.com> Date: Mon, 17 Jun 2002 09:20:17 -0700 To: Alain Frisch Cc: Basile STARYNKEVITCH , caml-list@inria.fr Subject: Re: [Caml-list] Camlp4: varargs ie a la Printf In-Reply-To: References: <15629.62581.329369.773250@is002254.saclay.cea.fr> X-Mailer: VM 7.03 under Emacs 20.7.1 Reply-To: "John G Malecki" X-Organization: Artisan Components, Inc. Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Alain Frisch wrote (2002-06-17T16:59:05+0200): > On Mon, 17 Jun 2002, Basile STARYNKEVITCH wrote: > > > My problem is to produce a quotation of a list of expressions (and not > > a quotation of a list expression). What should I put in place of the > > comment WHAT SHOULD BE ADDED HERE? trace FOO "i=%d x=%g" i x end > > I'm not sure to understand how this is more difficult than the solution > with Printf.kprintf; in both case, you want to generate a 'varargs' > application, right ? Or what is a "list of expressions" ? > > Try something like: > > List.fold_left (fun e_1 e_2 -> <:expr< $e_1$ $e_2$ >>) Here is what i normally use in my parsers let expr_of_list loc l = let f e l = <:expr< [$e$ :: $l$] >> in List.fold_right f l <:expr< [] >> as in cnds: [ [ cs = LIST1 cnd SEP "and" -> expr_of_list loc cs ] ]; ------------------- 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