Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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: 2002-05-01 (15:40)
From: Jocelyn_Sérot <jserot@l...>
Subject: Re: [Caml-list] How to read three integers from a text-file... ?

Le mardi 30 avril 2002, à 01:07 PM, Dave Berry a écrit :

> At 08:44 29/04/2002, Francois Pottier wrote:
>> Check out Olivier Danvy's paper `Functional Unparsing':
>> It describes a very nice way of programming `printf' within ML's type
>> system. `scanf' could be handled in a similar way.
> Scanf would be a little harder.  For printf (actually Danvy describes
> sprintf), each combinator extends a string with either the next string
> literal or the string representation of the next argument, using string
> catenation.  For scanf, the result type has to be a tuple.  Therefore 
> you
> need a function that takes an arbitrary n-tuple (the values read so far)
> and returns an (n+1)-tuple of those values plus the value read by the
> current combinator.  Most implementations of ML do not provide such a 
> function.
> There are extensions of ML type systems that do include this 
> operation.  I
> don't know whether it is included in the record calculus that underlies
> Objective ML (the object part of OCaml).  Or how easy it would be to 
> add.

Sorry to jump in the middle of this discussion, but your last remark on 
n-tuples" drew my attention (i use to need this kind of thing in a 
completely different
context). Can you provide references on these extensions of ML type 
systems ?
Also, if s/o knows the answer to your last question (whether this has 
been implemented in
OCaml or how hard it would be to add), i'd very happy to know !


J. Sérot

S-mail: LASMEA - UMR 6602 CNRS, Universite Blaise Pascal, 63177 Aubiere 
Tel: +33.(0) - Fax: +33.(0)
Valid e-mail: remove underscores (sorry, this is prevention against junk 
To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: