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.1 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 F1FE4BC69 for ; Mon, 19 Mar 2007 17:08:12 +0100 (CET) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.243]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2JG8BAk032181 for ; Mon, 19 Mar 2007 17:08:12 +0100 Received: by an-out-0708.google.com with SMTP id c24so1236701ana for ; Mon, 19 Mar 2007 09:08:10 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=hMhquPGFVTh+1DbxDjWwTbXKytGJN5yh7nCXytGCWI9wSf0JZGkUwC87mNnYIs4j2jTi1eHKER7WdMKXAB3xhR04tP1o4AQPKQXxcOguBSjonFpkP/lrnys+8bgyZqivkNOhheiX6lrMns1IMSYLeHo8nMk5+bjV6h2GcZasGxk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=grQeNdBMr9ONljZhPkcaqB0WFtyZ4pr6ntXVuo8waKEfU4HAwj+Jxbr8dCuNAfb7Cqme+qbaf/5HIWcmvf2FhLwgLwqqabWVWYumNa/GVt7LhsDr8cO7aUTSw9FozBvcz26bxW59vYoZzgfwqBlgtD+APbfjB1R0Oevk5Eymn+I= Received: by 10.100.191.5 with SMTP id o5mr3889446anf.1174320489927; Mon, 19 Mar 2007 09:08:09 -0700 (PDT) Received: by 10.100.154.6 with HTTP; Mon, 19 Mar 2007 09:08:09 -0700 (PDT) Message-ID: <6f9f8f4a0703190908j5e57d1b4l7d1d67ac98a93243@mail.gmail.com> Date: Mon, 19 Mar 2007 17:08:09 +0100 From: "Loup Vaillant" To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Where are the AST specs? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <6f9f8f4a0703181022q2b9d7f8bt33919e07f3799c65@mail.gmail.com> <95513600703190145h5a0c6202t518ff61fcde83655@mail.gmail.com> <6f9f8f4a0703190217o5a975a78s16fe2be77825af01@mail.gmail.com> <6f9f8f4a0703190353p4d38ea32k30e1ad2a00f70f4@mail.gmail.com> <6f9f8f4a0703190742w3cd42978ib23a78163542729f@mail.gmail.com> X-j-chkmail-Score: MSGID : 45FEB56B.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 45FEB56B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; camlp:01 camlp:01 cmo:01 def:01 def:01 caml-list:01 lisp:01 macros:01 macros:01 define:01 ast:02 ugly:03 cons:03 cons:03 macro:03 2007/3/19, Nicolas Pouillard : > [...camlp4code...] > $ cat test_macros.ml > let cons x xs = x :: xs;; > > foldl(( + ), 1, 2, 3, 4);; > foldr(cons, 1, 2, 3, []);; > > $ camlp4o ./macros.cmo test_macros.ml > let cons x xs = x :: xs > let _ = ((1 + 2) + 3) + 4 > let _ = cons 1 (cons 2 (cons 3 [])) Impressive. If it is possible, It would be best would be to be able to write something like: (def_foldl + plus) and then just (+ x y z) (+ x y z w) ... The same for cons: (def_foldr :: cons) (:: x y z L) (:: x y z t []) Such macros are possible, and I think not very hard in Common Lisp. I will try tonight. As for Camlp4, I don't know. (I don't know camlp4 enough --yet). The point is to define macros that write macro definitions. > What's wrong with the current anti quotation system? Err, actually, nothing... I just found the '$' ugly. But it is one character, and I may as well use it "as is". Loup Vaillant