* [Caml-list] Some troubles with stdout
@ 2002-08-08 17:55 Nicolas FRANCOIS
0 siblings, 0 replies; only message in thread
From: Nicolas FRANCOIS @ 2002-08-08 17:55 UTC (permalink / raw)
To: Caml List
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-08-08 17:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-08 17:55 [Caml-list] Some troubles with stdout Nicolas FRANCOIS
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox