From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA31777 for caml-redistribution; Fri, 26 Mar 1999 14:13:51 +0100 (MET) 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 VAA03645 for ; Thu, 25 Mar 1999 21:52:08 +0100 (MET) Received: from zarya.maya.com (zarya.maya.com [192.70.254.128]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id VAA22570 for ; Thu, 25 Mar 1999 21:52:01 +0100 (MET) Received: (from prevost@localhost) by zarya.maya.com (8.8.7/8.8.7) id PAA28493; Thu, 25 Mar 1999 15:52:05 -0500 Sender: weis To: caml-list@inria.fr Subject: Re: another approach to sprintf (Re: ocaml 2.02 bug: curried printf) References: <19990312160017.60444@pauillac.inria.fr> <19990319174720-10695P.sumii@harp.is.s.u-tokyo.ac.jp> <19990323171753.17334@pauillac.inria.fr> <19990325142901.B3236@ips.cs.tu-bs.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit From: John Prevost Date: 25 Mar 1999 15:52:05 -0500 In-Reply-To: Christian Lindig's message of "Thu, 25 Mar 1999 14:29:01 +0100" Message-ID: User-Agent: Gnus/5.07008 (Pterodactyl Gnus v0.80) Emacs/20.3.92 Christian Lindig writes: > The suggested functional approach to printf has another possible > drawback: when you want to express all the options like "%5.5f" > possible in C style printf formatting you need a whole bunch of > functions. Since OCaml has no overloading a single `float' function > for floats can not capture them all. Yes, but you can still get the formatting features you want by having both formats that take arguments (like "lit") and also higher-order formats (for example, a format which truncates whatever format it is given to a specific string length, or a format that right justifies within a certain length, or etc.) In fact, the system is more powerful precisely because you can do things like this to extend the system. Not only can you do %5.5f, you could also make something to display the float in binary, or to display the fraction as a vulgar fraction symbol (i.e. ½). John.