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 MAA10226; Wed, 19 Nov 2003 12:38:54 +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 MAA09399 for ; Wed, 19 Nov 2003 12:38:53 +0100 (MET) Received: from decis.be ([194.78.219.157]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hAJBcq103988 for ; Wed, 19 Nov 2003 12:38:52 +0100 (MET) Received: from decis.be ([192.168.0.20]) (authenticated user fplancke@decis.be) by decis.be (decis.be [194.78.219.157]) (MDaemon.PRO.v6.8.5.R) with ESMTP id 18-md50000000028.tmp for ; Wed, 19 Nov 2003 12:40:06 +0100 Message-ID: <3FBB5696.7D357AFE@decis.be> Date: Wed, 19 Nov 2003 12:40:06 +0100 From: Frederic van der Plancke Reply-To: fvdp@decis.be Organization: Decis X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 CC: Caml Mailing List Subject: Re: [Caml-list] tail call optimization References: Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Authenticated-Sender: fplancke@decis.be X-Spam-Processed: decis.be, Wed, 19 Nov 2003 12:40:06 +0100 (not processed: message from valid local sender) X-MDRemoteIP: 192.168.0.20 X-Return-Path: fvdp@decis.be X-MDaemon-Deliver-To: caml-list@inria.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; plancke:01 fvdp:01 caml-list:01 violates:01 violates:01 tail-call:01 handler:01 nov:01 match:02 exception:02 wrote:03 wrote:03 recursive:03 recursive:03 tail:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Dustin Sallings wrote: > > On Nov 18, 2003, at 22:50, Brian Hurt wrote: > > > This function is not tail recursive. Basically, if the recursive call > > either a) is wrapped in a try block, or b) has it's return value > > modified > > in any way, the function isn't tail recursive. Your function violates > > clause a, the following function violates clause b: > > > > let append a b = > > match a with > > | [] -> b > > | h :: t -> h :: (append t b) > > ;; > > I guess I don't understand the point of clause a. The try block > doesn't seem like it should prevent the optimization. Any work your function has to do before the called function returns prevents tail-call optimisation. Unsetting a "try" exception handler is work that has to be done at the level of the corresponding "with". Frédéric ------------------- 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