From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id EAA26337; Tue, 4 Sep 2001 04:54:15 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA26556 for ; Tue, 4 Sep 2001 04:54:14 +0200 (MET DST) Received: from codex.cis.upenn.edu (CODEX.CIS.UPENN.EDU [158.130.6.15]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f842sD115546 for ; Tue, 4 Sep 2001 04:54:13 +0200 (MET DST) Received: from localhost (localhost [127.0.0.1]) by codex.cis.upenn.edu (8.10.1/8.10.1) with SMTP id f842ruW10866; Mon, 3 Sep 2001 22:53:56 -0400 (EDT) Message-Id: <200109040253.f842ruW10866@codex.cis.upenn.edu> To: Michael Leary Cc: caml-list@inria.fr Subject: Re: [Caml-list] flushing stdout with flush stdout not good? In-reply-to: Your message of "Mon, 03 Sep 2001 19:31:04 PDT." <20010903193104.A12284@ip178.usw22.rb1.bel.nwlink.com> Date: Mon, 03 Sep 2001 22:53:56 EDT From: Jon Moore Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > 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