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] Fwd: Polymorphic optional label argument, with default
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Matt Gushee <mgushee@h...>
Subject: Re: [Caml-list] Fwd: Polymorphic optional label argument, with default
On Sat, Apr 10, 2004 at 10:36:16PM +0100, Richard Jones wrote:
> I have a function defined:
>   let plot ?(labels = string_of_int) graph =
>     (* ... *)

I don't think I can directly address your problem as stated here, but I
have one or two observations that might be relevant:

 * I had to grapple with a similar issue in developing my ChartPak
   toolkit: how do you generate a string from an arbitrary data type?
   I decided on an architecture where each chart type is implemented as
   an OCaml module. That module transforms a data set into a collection
   of abstract graphical objects (by that I mean that their shapes and
   relative positions are defined, but their actual dimensions are not).
   This collection is passed to a renderer which creates the actual

   This approach is more complex internally and less dynamic than I
   would like, but it does make for an API that is both fairly simple
   to use and not too hard to extend (assuming you can compile OCaml 

 * Do you really need to handle arbitrary data types? You will certainly
   have floats, ints, and strings, but what else? Maybe you should focus
   on providing a simple interface for the most common data types.

 * BTW, what sort of application/library are you working on here? If it
   is much like mine (and is open source and intended for general
   distribution), maybe we should think about joining forces.

Matt Gushee                 When a nation follows the Way,
Englewood, Colorado, USA    Horses bear manure through           its fields;   When a nation ignores the Way,
                            Horses bear soldiers through
                                its streets.
                            --Lao Tzu (Peter Merel, trans.)

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