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 SAA18069; Tue, 9 Dec 2003 18:40:23 +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 SAA17554 for ; Tue, 9 Dec 2003 18:40:21 +0100 (MET) Received: from mailhost.ens-lyon.fr (pluvier.ens-lyon.fr [140.77.167.5]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id hB9HeLr22344 for ; Tue, 9 Dec 2003 18:40:21 +0100 (MET) Received: by mailhost.ens-lyon.fr with scanned-ok (Exim 3.35 #1 (Debian)) id 1ATlqL-0000J8-00 for ; Tue, 09 Dec 2003 18:40:17 +0100 Received: from mailhost.ens-lyon.fr ([127.0.0.1]) by localhost (pluvier [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 00658-06 for ; Tue, 9 Dec 2003 18:40:17 +0100 (CET) Received: from [140.77.128.119] (helo=ens-lyon.org) by mailhost.ens-lyon.fr with esmtp (Exim 3.35 #1 (Debian)) id 1ATlqL-0000Iy-00 for ; Tue, 09 Dec 2003 18:40:17 +0100 Message-ID: <3FD60900.2010901@ens-lyon.org> Date: Tue, 09 Dec 2003 18:40:16 +0100 From: Jean-Baptiste Rouquier User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20031024 Debian/1.5-2 X-Accept-Language: en MIME-Version: 1.0 To: "caml-list@inria.fr" Subject: Re: [Caml-list] stream conversion References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ens-lyon.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; ens-lyon:01 caml-list:01 brogoff:01 camlp:01 speakeasy:01 rec:01 rec:01 readable:01 parser:02 string:03 string:03 cma:03 wrote:03 library:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk brogoff@speakeasy.net wrote: >The documentation in the Stream library for the stream builders (you use >Stream.of_string) states : > > Ah yes, I remember reading that one year ago, sorry. Here is a more readable solution : #load "camlp4o.cma";; let stream_of_string s = let len = String.length s in let rec stream pos = if pos < len then [< 's.[pos]; stream (pos+1) >] else [<>] in stream 0 let rec convert = parser | [< 'string; stream >] -> [] | [<>] -> [<>] ------------------- 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