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: Chris Hecker <checker@d...>
Subject: Re: pervasives (was: Re: [Caml-list] How to read three integers from a text-file... ?)

>This function assumes that every integer is on a separate line. This is
>rarely true in programming contests.

Ah, I missed the "read one line" part.  Interesting that print_int doesn't 
insert a newline but read_int eats one...another assymetry.  int_of_string 
also seems to require that the string be only the integer, so int_of_string 
"123 some more" excepts.

It seems like it might be useful to have the core simple types (string, 
int, float) have orthogonal reading and writing functions in 
Pervasives.  Maybe it's not worth the effort, though...

Chris


-------------------
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