From: Nicolas FRANCOIS (AKA El Bofo) <nicolas.francois@free.fr>
To: Caml List <caml-list@inria.fr>
Subject: [Caml-list] Some troubles with stdout
Date: Thu, 8 Aug 2002 19:55:26 +0200 [thread overview]
Message-ID: <20020808195526.6fe14fce.nicolas.francois@free.fr> (raw)
This is a Matrice.print function that doesn't give me what I expect from
it :
let print m =
for i = 0 to D.lignes - 1 do
print_string "( ";
for j = 0 to D.colonnes - 1 do
A.print m.(i).(j);
flush stdout;
print_string " "
done;
flush stdout;
print_string ")";
print_newline ()
done;
print_newline ()
m is of type A.elem array array (it's a matrix), and using it with
A.elem = Num.num
and
A.print n = print_string (string_of_big_int n)
i get this answer :
# let m = Matrice_Z.parse
(Stream.of_string
"[[ 3, 4, -2, 1, -2],[ 1, -1, 2, 2, 7],[ 4, -3, 4, -3, 2],[ -1, 1,
6, -1, 1]]");;
val m : Matrice_Z.elem =
[|[|<abstr>; <abstr>; <abstr>; <abstr>; <abstr>|];
[|<abstr>; <abstr>; <abstr>; <abstr>; <abstr>|];
[|<abstr>; <abstr>; <abstr>; <abstr>; <abstr>|];
[|<abstr>; <abstr>; <abstr>; <abstr>; <abstr>|]|]
# Matrice_Z.print m;;
( )
( )
( )
( )
34-21-21-12274-34-32-116-11- : unit = ()
#
instead of the wanted :
( 3 4 -2 1 -2 )
( 1 -1 2 2 7 )
( 4 -3 4 -3 2 )
( -1 1 6 -1 1 )
(which, I agree with you, is far from perfect).
Where do I get it wrong with stdout channel ? What's the exact purpose of
flush, and why does the outputs get mixed ?
\bye
--
Nicolas FRANCOIS
http://nicolas.francois.free.fr
A TRUE Klingon programmer does NOT comment his code
-------------------
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
reply other threads:[~2002-08-08 17:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20020808195526.6fe14fce.nicolas.francois@free.fr \
--to=nicolas.francois@free.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox