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 MAA04818; Mon, 2 Feb 2004 12:08:38 +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 MAA03847 for ; Mon, 2 Feb 2004 12:08:37 +0100 (MET) Received: from grisu.bik-gmbh.de (grisu.bik-gmbh.de [217.110.154.194]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i12B8bP04321 for ; Mon, 2 Feb 2004 12:08:37 +0100 (MET) Received: from bik-gmbh.de ([192.168.125.193]) by grisu.bik-gmbh.de (8.12.8p2/8.12.8) with ESMTP id i12B8TuQ061065; Mon, 2 Feb 2004 12:08:29 +0100 (CET) (envelope-from hars@bik-gmbh.de) Message-ID: <401E2FA8.3090207@bik-gmbh.de> Date: Mon, 02 Feb 2004 12:08:24 +0100 From: Florian Hars User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113 X-Accept-Language: en-us, de-de, en MIME-Version: 1.0 To: Vasile Rotaru CC: William Lovas , caml-list@inria.fr Subject: Re: fancy types (was Re: [Caml-list] ocaml killer) References: <40184A2F.6040007@dcs.qmul.ac.uk> <200401290000.i0T00ntl006988@bismarck-chet.watson.ibm.com> <40184FB9.4000808@dcs.qmul.ac.uk> <200401290034.i0T0Yutl009000@bismarck-chet.watson.ibm.com> <20040129162048.GA29094@force.stwing.upenn.edu> <401945DB.4030106@ps.uni-sb.de> <20040129191849.GA9427@force.stwing.upenn.edu> <20040131033915.GA2151@force.stwing.upenn.edu> <20040201031108.4c47b181.vrotaru@seznam.cz> In-Reply-To: <20040201031108.4c47b181.vrotaru@seznam.cz> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=-2.6 required=5.0 tests=EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG version=2.55 X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; florian:01 hars:01 hars:01 bik-gmbh:01 caml-list:01 nop:01 makeblock:01 makeblock:01 florian:01 ocaml:01 rec:01 optimized:02 identical:03 wrote:03 recursive:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Vasile Rotaru wrote: > The difference between the two versions are in those two calls > > (id specialist/..) ; obviously a nop > and > (makeblock 0 specialist/..) ; ??? > > Comments about whether (makeblock 0 ..) is a special case which can be > optimized away are welcome. Try let do_rec (S specialist as spec) n = if n = 0 then 1 else n * specialist spec n instead, and the code becomes a simple spec/.. Isn't it a standard idiom to pass the same cons cell on recursive calls instead of rebuilding an otherwise identical copy? Yours, Florian Hars. ------------------- 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