Browse thread
[Caml-list] flushing stdout with flush stdout not good?
[
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: | Jon Moore <jonm@d...> |
| Subject: | Re: [Caml-list] flushing stdout with flush stdout not good? |
> if I write them this way: > > let fso = flush stdout > let name s = printf "Name %s\n" s; fso > let color c = printf "Colour %s\n" c; fso I think what you mean to write here is: let fso () = flush stdout let name s = printf "Name %s\n" s; fso () let color c = printf "Colour %s\n" c; fso () In the code you wrote above, "fso" gets bound to () (and not to a function) after flushing stdout once. So the name and color functions you wrote are doing prints, and returning units, rather than invoking the flush as you thought. Thus, this is why the output becomes bursty (you're not actually flushing). Jon .......... Jonathan Moore http://www.cis.upenn.edu/~jonm University of Pennsylvania jonm@dsl.cis.upenn.edu 'Frater qui adiuvatur a fratre quasi civitas firma.' (Brother helped by brother is a fortress). ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr