From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA21229 for caml-redistribution; Mon, 1 Jun 1998 11:42:25 +0200 (MET DST) 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 FAA03315 for ; Mon, 1 Jun 1998 05:22:36 +0200 (MET DST) Received: from tower.ti.com (tower.ti.com [192.94.94.5]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id FAA15781 for ; Mon, 1 Jun 1998 05:22:34 +0200 (MET DST) Received: from dlep4.itg.ti.com ([157.170.188.63]) by tower.ti.com (8.8.8) with ESMTP id WAA08169 for ; Sun, 31 May 1998 22:22:34 -0500 (CDT) Received: from ti (ppp-dsbs33-031.itg.ti.com [192.168.37.159]) by dlep4.itg.ti.com (8.8.8/8.8.8) with SMTP id WAA18219 for ; Sun, 31 May 1998 22:22:30 -0500 (CDT) X-Mailer: BeyondMail for Windows/Professional 2.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit To: caml-list@inria.fr From: Norman Davis Subject: Stream parsing - caml light vs. ocaml Date: Sun, 31 May 1998 22:22:26 -0700 X-BeyondMail-Priority: 1 Message-Id: Conversation-Id: Reply-To: Norman Davis X-Receipt-From-Agent: true Sender: weis Hello, I am reading "Functional programming using Caml Light" by Michel Mauny, chapter 10 on Streams and Parsers. The "spaces" function (used to remove the next continuous segment of whitespace) shown there is : # let rec spaces = function # [< '' '|'\t'|'\n'; spaces _ >] -> () #| [< >] -> ();; I tried converting it to Objective Caml : # let rec spaces = parser [< '' '|'\t'|'\n'; spaces >] -> () | [< >] -> ();; val spaces : char Stream.t -> unit = # let s = Stream.of_string " ;";; val s : char Stream.t = # spaces s;; - : unit = () # Stream.next s;; - : char = ' ' # Stream.next s;; - : char = ';' The stream s had two space characters followed by a semicolon. After "spaces s", I expected "Stream.next s" to return a semicolon. What is the correct way to write "spaces" so that it removes all whitespace from the front of the stream, not just a single whitespace character. Thanks. Norman Davis ndavis@ti.com