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] possible typechecker bug
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile Starynkevitch <basile.starynkevitch@i...>
Subject: Re: [Caml-list] how can I print graphics on my local printer under Linux?
PL wrote:
> I am doing graphics with Caml. These graphs are drawn in a new window on my
> screen,
> opened by Caml. I would like to have these graphs printed on my local
> printer.

May I suggest using the camlimages library (also used in advi)? See for more. Another option would be 
(on unix or linux systems) to open a pipe to some software like gnuplot, 
  latex, lout, troff, etc etc.... The Graphics library is portable, but 
(IMHO) not very rich (because of the portability issue).

> I have troubles understanding the #install_printer intruction of Caml.

This question is (I suppose) unrelated to the previous one. The 
#install_printer directive (only available with the interactive toplevel 
-and perhaps in the debugger) tell the toplevel how to print your 
datatypes (usually abstract ones). Here is a simplistic example (where 
@. is a pretty printing indication, see the Format module documentation 
of the stdlib

# type color_t = Blue | Red;;
type color_t = Blue | Red
# let color_printer ff col = match col with
   Blue -> Format.fprintf ff "Blue_Color@."
   | Red ->  Format.fprintf ff "Red_Color@."
val color_printer : Format.formatter -> color_t -> unit = <fun>
# #install_printer color_printer;;
# Blue;;
- : color_t = Blue_Color

Hope above will help you

Basile STARYNKEVITCH -- basile dot starynkevitch at inria dot fr
Project - phone +33 1 3963 5197 - mobile 6 8501 2359
home email: basile at starynkevitch dot net
all opinions are only mine

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: