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 EAA32606; Tue, 17 Jul 2001 04:36:55 +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 EAA32644 for ; Tue, 17 Jul 2001 04:36:54 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f6H2aqT17546 for ; Tue, 17 Jul 2001 04:36:52 +0200 (MET DST) Received: from localhost (suiren.kurims.kyoto-u.ac.jp [130.54.16.25]) by kurims.kurims.kyoto-u.ac.jp (8.9.3/3.7W) with ESMTP id LAA20700; Tue, 17 Jul 2001 11:36:38 +0900 (JST) To: avv@quasar.ipa.nw.ru Cc: caml-list@inria.fr Subject: Re: [Caml-list] Generation of streams is slow In-Reply-To: <3B508A89.82717B26@quasar.ipa.nw.ru> References: <3B4FCD2B.FC68C181@quasar.ipa.nw.ru> <20010714103426.B26003@verdot.inria.fr> <3B508A89.82717B26@quasar.ipa.nw.ru> X-Mailer: Mew version 1.94.2 on Emacs 20.7 / Mule 4.0 (HANANOEN) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20010717113638Z.garrigue@kurims.kyoto-u.ac.jp> Date: Tue, 17 Jul 2001 11:36:38 +0900 From: Jacques Garrigue X-Dispatcher: imput version 20000228(IM140) Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From: "Alexander V. Voinov" > 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. You can see: Yasuhiko Minamide, "A functional representation of data-structures with a hole", POPL'98. It does exactly that, using linear types to make sur the hole is initialized later. I don't know of any published compiler implementing it, but this may exist. Jacques ------------------- 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