From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p95DHZPX014881 for ; Wed, 5 Oct 2011 15:17:35 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AugDAIJYjE7ZSMDjfWdsb2JhbABCmHaPGyIBAQsLCQcUBSKBUwEBBAE6PxABAwchJQ8BBA0bIROHfQK2eYcpBJkUhHmHJg X-IronPort-AV: E=Sophos;i="4.68,491,1312149600"; d="scan'208";a="111820161" Received: from fmmailgate02.web.de ([217.72.192.227]) by mail4-smtp-sop.national.inria.fr with ESMTP; 05 Oct 2011 15:17:34 +0200 Received: from smtp06.web.de ( [172.20.5.172]) by fmmailgate02.web.de (Postfix) with ESMTP id 8E9801AF4731C; Wed, 5 Oct 2011 15:17:28 +0200 (CEST) Received: from [78.43.204.177] (helo=frosties.localnet) by smtp06.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #2) id 1RBRLk-0000xj-00; Wed, 05 Oct 2011 15:17:28 +0200 Received: from mrvn by frosties.localnet with local (Exim 4.76) (envelope-from ) id 1RBRLi-0002kF-9i; Wed, 05 Oct 2011 15:17:26 +0200 From: Goswin von Brederlow To: Gabriel Scherer Cc: caml-list@inria.fr References: <4E88922C.6080303@inria.fr> Date: Wed, 05 Oct 2011 15:17:26 +0200 In-Reply-To: (Gabriel Scherer's message of "Sun, 2 Oct 2011 19:07:11 +0200") Message-ID: <87zkhfpogp.fsf@frosties.localnet> User-Agent: Gnus/5.110009 (No Gnus v0.9) XEmacs/21.4.22 (linux, no MULE) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: goswin-v-b@web.de X-Sender: goswin-v-b@web.de X-Provags-ID: V01U2FsdGVkX1+F+41h/uBVmtxdYODEFEgGHJqxgRJBVj2SoG0m XmgCnO929DRl/HEF/ssSFMtOVggsI4OYf+rJiqIUwqBNV/E7/V zHWRv94Uw= Subject: Re: [Caml-list] How to simplify an arithmetic expression ? Gabriel Scherer writes: >> Below is a quick tentative implementation of NbE, on a slightly >> restricted expression type (I removed the not-so-interesting Minus >> nodes). > > Sorry, I forgot to give a small example of what the implementation > does. Really the obvious thing, but it may not be so obvious just > looking at the code. > Here is an example of (X*2+Y)*(3+(Y*2+Z)) being 'rewritten' to > (1*Y)*Z+((2*Y)*Y+(3*Y+((2*X)*Z+((4*X)*Y+6*X)))). (1*Y)? That certainly isn't optimal. MfG Goswin