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 WAA13004; Mon, 9 Sep 2002 22:26:34 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA12990 for ; Mon, 9 Sep 2002 22:26:33 +0200 (MET DST) Received: from students.mimuw.edu.pl (zodiac.mimuw.edu.pl [193.0.96.128]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g89KQW129708 for ; Mon, 9 Sep 2002 22:26:33 +0200 (MET DST) Received: by students.mimuw.edu.pl (Postfix, from userid 2738) id 42662179C8; Mon, 9 Sep 2002 22:18:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by students.mimuw.edu.pl (Postfix) with ESMTP id 391D23F8D; Mon, 9 Sep 2002 22:18:08 +0200 (CEST) Date: Mon, 9 Sep 2002 22:18:08 +0200 (CEST) From: Lukasz Lew X-X-Sender: ll189417@zodiac.mimuw.edu.pl To: John Prevost Cc: caml-list@inria.fr Subject: Re: [Caml-list] Does this function exist? In-Reply-To: <86hegzarek.fsf@laurelin.dementia.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > ll> Hello Is there in OCaml a function ['a -> ()] which would > ll> print striong representation of first arument on stdout, just > ll> like OcamlTop does? > > ll> print [3; 3];; > > ll> should print: "- : int list = [3; 3]" > > ll> It would be very usefull for debugging. Lukasz Lew > > It would be, but I don't believe that it's really possible--you need > type information in order to determine what to display, and that > information is not available at runtime. If you know the type of what > you're printing, you can always use printf. 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? Lukasz Lew ------------------- 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