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 UAA13083; Mon, 29 Sep 2003 20:45:00 +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 UAA03630 for ; Mon, 29 Sep 2003 20:44:58 +0200 (MET DST) Received: from bourg.inria.fr (bourg.inria.fr [128.93.11.100]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h8TIiw514933 for ; Mon, 29 Sep 2003 20:44:58 +0200 (MET DST) Received: from starynke by bourg.inria.fr with local (Exim 4.22) id 1A430z-00084E-MB; Mon, 29 Sep 2003 20:44:57 +0200 Date: Mon, 29 Sep 2003 20:44:57 +0200 To: Miles Egan Cc: caml-list@inria.fr Subject: Re: [Caml-list] unread_char function Message-ID: <20030929184457.GA31008@bourg.inria.fr> References: <1064850132.1704.3.camel@car> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1064850132.1704.3.camel@car> User-Agent: Mutt/1.5.4i From: Basile Starynkevitch X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 char:01 basile:01 basile:01 egan:01 char:01 3.07:01 cristal:01 cristal:01 ocaml:01 ocaml:01 0700,:01 sep:01 wrote:03 functions:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Sep 29, 2003 at 08:42:13AM -0700, Miles Egan wrote: > I need an "unread_char" function to go along with the input_char > function for a tool I'm writing in OCaml, but I can't seem to find one > in OCaml 3.07beta. Perhaps you might want to use streams? They provide some form of lookahead (by factorising common prefixes). Ungetting functions might be not always possible in general (i.e. considering reading from a raw serial line, or a raw network...). -- Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr Project cristal.inria.fr - phone +33 1 3963 5197 - mobile 6 8501 2359 http://cristal.inria.fr/~starynke --- all opinions are only mine ------------------- 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