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 TAA23611; Sun, 4 Nov 2001 19:04:29 +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 TAA02026 for ; Sun, 4 Nov 2001 19:04:28 +0100 (MET) Received: from mailrelay1.inwind.it (mailrelay1.inwind.it [212.141.54.101]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fA4I4Rj03257 for ; Sun, 4 Nov 2001 19:04:27 +0100 (MET) Received: from dalamar.takhisis.org (62.98.127.38) by mailrelay1.inwind.it (5.5.029) id 3BDECAC2000C5BCE for caml-list@inria.fr; Sun, 4 Nov 2001 19:04:22 +0100 Received: from lordsoth.takhisis.org (lordsoth.takhisis.org [192.168.1.119]) by dalamar.takhisis.org (8.12.0/8.12.0/Debian -3) with ESMTP id fA4I4Ngi004453 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Sun, 4 Nov 2001 19:04:25 +0100 Received: from lordsoth.takhisis.org (localhost [127.0.0.1]) by lordsoth.takhisis.org (8.12.0/8.12.0/Debian -3) with ESMTP id fA4Hxr5S005655 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL) for ; Sun, 4 Nov 2001 18:59:53 +0100 Received: (from zack@localhost) by lordsoth.takhisis.org (8.12.0/8.12.0/Debian -3) id fA4HxqdJ005653 for caml-list@inria.fr; Sun, 4 Nov 2001 18:59:52 +0100 Date: Sun, 4 Nov 2001 18:59:52 +0100 From: Stefano Zacchiroli To: Inria Ocaml Mailing List Subject: [Caml-list] mixing fast and [<>] stream: illegal? Message-ID: <20011104185952.A5548@cs.unibo.it> Mail-Followup-To: Inria Ocaml Mailing List Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline User-Agent: Mutt/1.3.23i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk From the ocaml 3.02 documentation: Stream builders Warning: these functions create streams with fast access; it is illegal to mix them with streams built with [< >]; would raise Failure when accessing such mixed streams. val from : (int -> 'a option) -> 'a t;; Stream.from f returns a stream built from the function f. To create a new stream element, the function f is called with the current stream count. The user function f must return either Some for a value or None to specify the end of the stream. I have tried to mix fast and normal streams as follows: Objective Caml version 3.02 # let i = ref 0;; val i : int ref = {contents=0} # let gen (foo:int) = let nextint = !i in i:=!i+1; Some nextint;; val gen : int -> int option = # let s = Stream.from gen;; val s : int Stream.t = # Stream.next s;; - : int = 0 # match s with parser [<'1>] -> true | [<>] -> false;; - : bool = true # match s with parser [<'1>] -> true | [<>] -> false;; - : bool = false Seems to me that no illegal action was performed ... Am I wrong? Is really dangerous mixing the two streams? TIA. Cheers! -- Stefano "Zack" Zacchiroli ICQ# 33538863 Home Page: http://www.cs.unibo.it/~zacchiro Undergraduate student of Computer Science @ University of Bologna, Italy - Information wants to be Open - ------------------- 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