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 UAA08404; Tue, 12 Jun 2001 20:17:44 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA08306 for ; Tue, 12 Jun 2001 20:17:39 +0200 (MET DST) Received: from mta5.snfc21.pbi.net ([206.13.28.241]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f5CIHbb18352 for ; Tue, 12 Jun 2001 20:17:38 +0200 (MET DST) Received: from checkerlap.d6.com ([64.160.54.6]) by mta5.snfc21.pbi.net (Sun Internet Mail Server sims.3.5.2000.01.05.12.18.p9) with ESMTP id <0GET0023YXF091@mta5.snfc21.pbi.net> for caml-list@inria.fr; Tue, 12 Jun 2001 11:16:13 -0700 (PDT) Date: Tue, 12 Jun 2001 11:18:13 -0700 From: Chris Hecker Subject: [Caml-list] pretty printers and format and matrices X-Sender: def6@shell16.ba.best.com To: caml-list@inria.fr Message-id: <4.3.2.7.2.20010612111351.029b8720@shell16.ba.best.com> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 4.3.2 Content-type: text/plain; charset="us-ascii" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Format has come up on the list a couple times, so I figured I'd ask a question I gave up on trying to solve a while back. I'd like to write a printer for the top level that will print out matrices as rectangular blocks of numbers, not lists of numbers. I couldn't figure out whether this was possible with install_printer in a clean way. The obvious things didn't work quite right. I finally gave up and ended up with this (open Bigarray first): let print2d a = for i = 0 to Array2.dim1 a - 1 do for j = 0 to Array2.dim2 a - 1 do Format.printf "%f\t" a.{i,j} done; Format.printf "\n"; done But this doesn't play nice with other printers like it should. I tried a few different attemps at putting the boxes in, but none worked. I also read the FAQ, but couldn't quite apply its info to this problem. Is there a "right" way to do this, or is the Format module not set up for vertical printing? Chris ------------------- 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