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 BAA16293; Tue, 10 Sep 2002 01:09:59 +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 BAA15582 for ; Tue, 10 Sep 2002 01:09:59 +0200 (MET DST) Received: from relay-2m.club-internet.fr (relay-2m.club-internet.fr [194.158.104.41]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g89N9w914048 for ; Tue, 10 Sep 2002 01:09:58 +0200 (MET DST) Received: from warp (lns02m-9-126.w.club-internet.fr [212.194.20.126]) by relay-2m.club-internet.fr (Postfix) with SMTP id 874B31686; Tue, 10 Sep 2002 01:09:54 +0200 (CEST) Message-ID: <003c01c25856$16352a90$5200a8c0@warp> From: "Nicolas Cannasse" To: "Lukasz Lew" , "John Prevost" Cc: References: Subject: Re: [Caml-list] Does this function exist? Date: Tue, 10 Sep 2002 01:10:27 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > OK, so I want just "[3; 3]", (no type information), > > I can use printf, but it isn't very easy to write when you have i.e. > list of pairs of lists. And i believe that there is unversal ``print''. > Can you help? You still can use the (undocumented because unsafe) Obj module of the standard distribution. This enable you to recursivly scan ocaml blocks : let rec print_ints x = let r = Obj.repr x in match Obj.is_int r with | true -> Printf.sprintf "%d" (Obj.magic x : int) | false -> (* recursivly print fields from 0 to (Obj.size r)-1 *) ... val print_ints : 'a -> unit Nicolas Cannasse ------------------- 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