Browse thread
[Caml-list] Printing text with holes
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Jean-Marc EBER <jeanmarc.eber@l...> |
| Subject: | Re: [Caml-list] Printing text with holes |
> > This would allow you to do: > let _ = stdout <$ "Hello " <$ first_name <$ " " <$ last_name <$ "! It is " > <$ (string_of_int time) <$ " o'clock.\n";; > > Not quite as clean, but close, and it doesn't require p4. > With "old" printf approach, you write something like: let _ = printf "Hello %s %s! It is %i o'clock.\n" first_name last_name time Matter of taste: I prefer the printf version. More generally, I have found the printf approach (more precisely OCaml's Format 'magic' standard module) of incredible power and flexibility, if (and only if :-) ) used consistently through *all* your program. This is especially true when you generate "big" documents, where you compose recursively many "nice" ways to pretty-print your result(s). Jean-Marc Eber ------------------- 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