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 WAA14123; Mon, 9 Dec 2002 22:22:03 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA13941 for caml-list@pauillac.inria.fr; Mon, 9 Dec 2002 22:22:03 +0100 (MET) 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 UAA11422 for ; Mon, 9 Dec 2002 20:04:49 +0100 (MET) Received: from draco.dyndns.org (81-86-232-122.dsl.pipex.com [81.86.232.122]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gB9J4mX10482 for ; Mon, 9 Dec 2002 20:04:48 +0100 (MET) Received: from jim by draco.dyndns.org with local (Exim 3.36 #1 (Debian)) id 18LTCy-00076r-00 for ; Mon, 09 Dec 2002 19:04:48 +0000 Date: Mon, 9 Dec 2002 19:04:48 +0000 From: Nick Grey To: caml-list@inria.fr Subject: [Caml-list] Streams.from Message-ID: <20021209190448.GB24560@farrand.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.4i X-Uptime: 16:00:18 up 3 days, 22:16, 2 users, load average: 1.16, 1.05, 1.01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, When a stream is created using Stream.from, is the function f garunteed to be called with the stream count parameter 0, 1, 2, ... I would say that it is, but the current documentation doesn't seem to discount the possibility that the function would say, be called twice with the same parameter, or with parameters out of sequence. (I can think of no reason why this would actually happen, I'm just saying the docs don't discount it.) The reason that I ask is because it is sometimes useful to pass to from a function which simply returns the next value in the stream, without referring to the stream count. (E.g. because the value can't actually be computed from the stream count, but comes from some internal state.) In this case, if the function were to be called repeatedly with the same parameter, or with the parameters out of sequence, bad things would happen. I know this is a bit (very? :-) ) pedantic, I'm just slightly uneasy writing code that makes an assumption about the way a module works. (After all, the point of modular programming is that one should not make assumptions other than those given in the interface/docs.) Possibly remedies would be to tighten up the documentation of Stream.from, or to add another version of from which doesn't take the stream count as a parameter. Suggestion for change in documentation: Add at end: f is called exactly once for each stream element created, and a stream element is never created until all preceding elements have been created. Regards, N ------------------- 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