Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] How to read three integers from a text-file... ?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Tomasz Zielonka <zielony@c...>
Subject: Re: [Caml-list] How to read three integers from a text-file... ?
On Wed, Apr 24, 2002 at 08:16:16PM +0900, Jacques Garrigue wrote:
> From: Jacek Chrzaszcz <chrzaszcz@mimuw.edu.pl>
> 
> > 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