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 PAA20953; Wed, 24 Apr 2002 15:40:11 +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 PAA21106 for ; Wed, 24 Apr 2002 15:40:10 +0200 (MET DST) Received: from mail.cs.net.pl (cyber.cs.net.pl [62.233.142.98]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3ODe8P14762 for ; Wed, 24 Apr 2002 15:40:08 +0200 (MET DST) Received: by mail.cs.net.pl (Postfix, from userid 510) id 8E1F7E16; Wed, 24 Apr 2002 15:40:02 +0200 (CEST) Date: Wed, 24 Apr 2002 15:40:02 +0200 From: Tomasz Zielonka To: Jacques Garrigue Cc: chrzaszcz@mimuw.edu.pl, caml-list@inria.fr Subject: Re: [Caml-list] How to read three integers from a text-file... ? Message-ID: <20020424134002.GA22275@cs.net.pl> References: <15557.14957.358556.545541@absurd.mimuw.edu.pl> <20020424201616Z.garrigue@kurims.kyoto-u.ac.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020424201616Z.garrigue@kurims.kyoto-u.ac.jp> User-Agent: Mutt/1.3.28i Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Apr 24, 2002 at 08:16:16PM +0900, Jacques Garrigue wrote: > From: Jacek Chrzaszcz > > > Is there a clean way (a one-liner) to read a constant number of > > integers separated by whitespace from a text-file (or stdin) ? > > > > I mean something like > > scanf("%d%d%d",&a,&b,&c) in C, or > > readln(a,b,c) in Pascal > > A clean way to do this is to use then Genlex module. You can also use ocamllex and that's what I did recently to read strings of digits (up to 170 digits). The contest won't probably accept the .mll file, but you can send the ocamllex output itself. Such lexer is much faster than Genlex generated one. Bad thing is that the code will be cluttered with lexer arrays, etc. tom -- no sig ------------------- 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