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 RAA17449; Wed, 1 May 2002 17:40:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA17444 for caml-list@pauillac.inria.fr; Wed, 1 May 2002 17:40:46 +0200 (MET DST) 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 QAA28274 for ; Tue, 30 Apr 2002 16:49:23 +0200 (MET DST) Received: from lasmea.univ-bpclermont.fr (lasmea.univ-bpclermont.fr [193.54.50.15]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g3UEnMH22240 for ; Tue, 30 Apr 2002 16:49:22 +0200 (MET DST) Received: (from root@localhost) by lasmea.univ-bpclermont.fr (8.9.3 (PHNE_25183)/8.9.3) id QAA02700; Tue, 30 Apr 2002 16:47:48 +0200 (METDST) Received: from localhost ([193.54.50.250]) by lasmea.univ-bpclermont.fr (8.9.3 (PHNE_25183)/8.9.3) with ESMTP id QAA02692; Tue, 30 Apr 2002 16:47:44 +0200 (METDST) Date: Tue, 30 Apr 2002 16:42:01 +0200 Subject: Re: [Caml-list] How to read three integers from a text-file... ? Content-Type: text/plain; charset=ISO-8859-1; format=flowed Mime-Version: 1.0 (Apple Message framework v481) Cc: caml-list@inria.fr To: Dave Berry From: =?ISO-8859-1?Q?Jocelyn_S=E9rot?= In-Reply-To: <4.1.20020430114454.009caaf0@127.0.0.1> Message-Id: <6ECF4649-5C48-11D6-AC27-0003934491C2@lasmea.univ-bpclermont.fr> Content-Transfer-Encoding: quoted-printable X-Mailer: Apple Mail (2.481) X-Virus-Scanned: by AMaViS+Sophos Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Le mardi 30 avril 2002, =E0 01:07 PM, Dave Berry a =E9crit : > 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=20= > 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=20= > function. > > There are extensions of ML type systems that do include this=20 > 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=20= > add. > Sorry to jump in the middle of this discussion, but your last remark on=20= "extensible n-tuples" drew my attention (i use to need this kind of thing in a=20 completely different context). Can you provide references on these extensions of ML type=20 systems ? Also, if s/o knows the answer to your last question (whether this has=20 been implemented in OCaml or how hard it would be to add), i'd very happy to know ! Thanks, J. S=E9rot -- 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=20= cedex Tel: +33.(0)4.73.40.73.30 - Fax: +33.(0)4.73.40.72.62 http://wwwlasmea.univ-bpclermont.fr/Personnel/Jocelyn.Serot/Welcome.html Valid e-mail: remove underscores (sorry, this is prevention against junk=20= mail) ------------------- 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