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 RAA15790; Wed, 22 May 2002 17:48:35 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id RAA15724 for ; Wed, 22 May 2002 17:48:34 +0200 (MET DST) Received: from sunny.pacific.net.au (sunny.pacific.net.au [203.25.148.40]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g4MFmWH19317 for ; Wed, 22 May 2002 17:48:33 +0200 (MET DST) Received: from wisma.pacific.net.au (wisma.pacific.net.au [210.23.129.72]) by sunny.pacific.net.au with ESMTP id g4MFmSXt026334; Thu, 23 May 2002 01:48:29 +1000 (EST) Received: from ozemail.com.au (ppp45.dyn17.pacific.net.au [61.8.17.45]) by wisma.pacific.net.au with ESMTP id BAA28794; Thu, 23 May 2002 01:48:26 +1000 (EST) Message-ID: <3CEBBDC9.8040207@ozemail.com.au> Date: Thu, 23 May 2002 01:48:25 +1000 From: John Max Skaller User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.2.1) Gecko/20010901 X-Accept-Language: en-us MIME-Version: 1.0 To: YAMAGATA yoriyuki CC: caml-list@inria.fr Subject: Re: [Caml-list] Evaluation order of Stream.from References: <20020521220938P.yoriyuki@mbg.sphere.ne.jp> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk YAMAGATA yoriyuki wrote: >Hi, folks. > >I have a question about Stream.from. If I create a stream by >Stream.from f by some function f, in what order f is called? I mean, >is it guaranteed that f is always called as f 1, f 2, f 3, ....? or is >the order like f 1, f 3, f 5, f 7, f 2, f 4, .... possible? > >The manual states nothing, so maybe I have to assume there is no >guarantee. But then using a function with side effects >is nearly impossible, which is unfortunate. > >I tried to understand the source, but it is full of magic and anyways, >the source does not make any guarantee for the future. > The same issue arises for List.rev_map. By experiment, I find it applies its function argument from the head of the list argument, in order, which is suggested by the statement that it is tail recursive. But it isn't *guarranteed* by the manual, and it probably should be. To be pedantic .. the 'tail recursive' bit is non-information. Only source code has that property. List.rev_map is a standard library routine. It should be characterized by saying it has linear performance, with constant storage overhead. -- John Max Skaller, mailto:skaller@ozemail.com.au snail:10/1 Toxteth Rd, Glebe, NSW 2037, Australia. voice:61-2-9660-0850 ------------------- 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