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 UAA30018; Sat, 14 Jul 2001 20:09:26 +0200 (MET DST) 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 UAA29899 for ; Sat, 14 Jul 2001 20:09:25 +0200 (MET DST) Received: from str12.sobor.org (adsl-63-198-183-99.dsl.snfc21.pacbell.net [63.198.183.99]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6EI9Nf17250; Sat, 14 Jul 2001 20:09:23 +0200 (MET DST) Received: from quasar.ipa.nw.ru (anza.sobor.org [192.168.123.51]) by str12.sobor.org (Postfix) with ESMTP id 6ED1DAC8AA; Sat, 14 Jul 2001 10:55:57 -0700 (PDT) Message-ID: <3B508A89.82717B26@quasar.ipa.nw.ru> Date: Sat, 14 Jul 2001 11:08:09 -0700 From: "Alexander V. Voinov" Organization: Fear of the Lord is the beginning of wisdom X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 To: Daniel de Rauglaudre Cc: "caml-list@inria.fr" Subject: Re: [Caml-list] Generation of streams is slow References: <3B4F70D7.82E58A91@quasar.ipa.nw.ru> <20010714042701.A24266@verdot.inria.fr> <3B4FB39D.10D1F6D5@quasar.ipa.nw.ru> <20010714060417.A25766@verdot.inria.fr> <3B4FC748.F9E14008@quasar.ipa.nw.ru> <3B4FCD2B.FC68C181@quasar.ipa.nw.ru> <20010714103426.B26003@verdot.inria.fr> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi Daniel, Daniel de Rauglaudre wrote: > > On Fri, Jul 13, 2001 at 09:40:11PM -0700, Alexander V. Voinov wrote: > > > And in general, the inability to pass free variables to be bound later > > limits the tail recursion optimization. And forces to use iterations > > when they exist (as they do in OCaml). > > ??????? I don't understand. Can you give an example? Sorry :-), an example in Prolog is: f([],[]) :- !. f([H1|T1], [H2|T2]) :- g(H1,H2), f(T1,T2). Last call in this case deals with the final locations of the tails of the lists. Though chains of indirection may be long, they are handled by the garbage collection, whose launch strategy may be based more on heuristics than on a theory. In OCaml, if it were possible to handle the special case of the _two_ last calls of the form: h::(make_tail arg1 argN), that is CALL make_tail CONS and change them to PREPARE_CONS CALL make_tail the scope of tail recursion optimization would increase. But it's unlikely that this idea didn't come to developers. Which may mean that this [being not that simple] is impossible. Alexander ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr