Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Jérôme_Marant <jerome.marant@f...>
Subject: Re: [Caml-list] How to read three integers from a text-file... ?
On Fri, Apr 26, 2002 at 08:32:44AM +0900, Jacques Garrigue wrote:
> From: Chris Hecker <checker@d6.com>
> > 
> > >   Well, this would make a static printf rather that the well known printf
> > >   from C, since the format string may be known only at runtime in some
> > >   cases.
> > 
> > As Markus says, the Printf.printf doesn't work in this case anyway right 
> > now, since it happens completely at compile time, I believe.
> 
> Type-checking is completely at compile time, but you can define your
> format independently if you want:
> 
> # let fmt : (_,_,_) format = "Hello %s, it's %d:%d.\n";;
> val fmt : (string -> int -> int -> 'a, 'b, 'a) format = <abstr>
> # Printf.printf fmt "Chris" 9 30;;
> Hello Chris, it's 9:30.

  Jacques,

  Would it be difficult to add arguments reordering to printf like:
  (we already talked about this in previous messages)
 
    printf " %2$d %1$s " 1 "hello";;

  Which gives:

    hello 1


  Thanks.

-- 
Jérôme Marant
-------------------
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