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 IAA03550; Mon, 29 Apr 2002 08:44:12 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id IAA03449 for ; Mon, 29 Apr 2002 08:44:12 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g3T6iBf02442; Mon, 29 Apr 2002 08:44:11 +0200 (MET DST) Received: (from fpottier@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA03565; Mon, 29 Apr 2002 08:44:11 +0200 (MET DST) Date: Mon, 29 Apr 2002 08:44:10 +0200 From: Francois Pottier To: caml-list@inria.fr Cc: =?iso-8859-1?Q?Fran=E7ois_Pottier?= Subject: Re: [Caml-list] How to read three integers from a text-file... ? Message-ID: <20020429084410.A3490@pauillac.inria.fr> Reply-To: Francois.Pottier@inria.fr References: <15557.14957.358556.545541@absurd.mimuw.edu.pl> <20020424212316.GA26318@cs.net.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Mailer: Mutt 1.0i In-Reply-To: <20020424212316.GA26318@cs.net.pl>; from zielony@cs.net.pl on Wed, Apr 24, 2002 at 11:23:16PM +0200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, Apr 24, 2002 at 11:23:16PM +0200, Tomasz Zielonka wrote: > > 4) Create mechanism dual to printf, but as far as I understand > OCaml's printf, this would require extending typechecker. > No, it does not. 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. Furthermore, this approach yields code that is claimed to be more efficient than O'Caml's current `printf' implementation (because the overhead of interpreting format strings is lower). Lastly, it scales up to more expressive format directives, such as a directive for printing a list. It might be worth adding a module that implements Danvy-style `printf' and `scanf' to the standard library. Has anyone written such a module already? Otherwise, I might consider doing it. -- François Pottier Francois.Pottier@inria.fr http://pauillac.inria.fr/~fpottier/ ------------------- 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