English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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':
>>  http://www.brics.dk/RS/98/12/
>> 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

E-mail: Jocelyn.Serot@l_a_s_m_e_a.u_n_i_v-bpclermont.fr
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 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