Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Does this function exist?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lukasz Lew <ll189417@z...>
Subject: Re: [Caml-list] Does this function exist?
>     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 Archives:
Bug reports: FAQ:
Beginner's list: