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] Passing printf format strings to functions
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-09-15 (08:35)
From: Erik de Castro Lopo <ocaml-erikd@m...>
Subject: Re: [Caml-list] Passing printf format strings to functions
On Wed, 15 Sep 2004 10:12:28 +0200
Jean-Christophe Filliatre <Jean-Christophe.Filliatre@lri.fr> wrote:

Thanks Jean-Christophe for a very thorough and well explained

> Indeed, there is  no static way to check that  the resulting format is
> indeed of  type (string->string->'a,'b,'c) format. 

Ahh, now I understand. 

With the knowledge you provided and some hacking I did after
I sent the original email, I was able to use a constant format
string like:

    Printf.printf  "    %-*s    %s\n" format_width (fst a) (snd a) ;;

and acheive the result I desired.

  Erik de Castro Lopo  nospam@mega-nerd.com (Yes it's valid)
"The earth is degenerating these days. Bribery and corruption abound.
Children no longer mind parents ...and it is evident that the end of
the world is approaching fast." -- Assyrian Tablet Engraved in 2800 B.C.

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