Browse thread
[Caml-list] Some troubles with stdout
- Nicolas FRANCOIS
[
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: | 2002-08-08 (17:47) |
From: | Nicolas FRANCOIS <nicolas.francois@f...> |
Subject: | [Caml-list] Some troubles with stdout |
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