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 BAA23366; Sun, 11 Apr 2004 01:52:01 +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 BAA23088 for ; Sun, 11 Apr 2004 01:52:00 +0200 (MET DST) Received: from mz2.forethought.net (mzpi4.forethought.net [216.241.36.13]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i3ANpwYM018358 for ; Sun, 11 Apr 2004 01:51:59 +0200 Received: from [216.241.35.41] (helo=swordfish) by mz2.forethought.net with esmtp (Exim 4.30) id 1BCSGT-0002AM-GB for caml-list@pauillac.inria.fr; Sat, 10 Apr 2004 17:51:57 -0600 Received: from matt by swordfish with local (Exim 3.35 #1 (Debian)) id 1BCSGc-0004ma-00 for ; Sat, 10 Apr 2004 17:52:06 -0600 Date: Sat, 10 Apr 2004 17:52:06 -0600 From: Matt Gushee To: caml-list@pauillac.inria.fr Subject: Re: [Caml-list] Fwd: Polymorphic optional label argument, with default Message-ID: <20040410235206.GB10420@swordfish> Reply-To: Matt Gushee Mail-Followup-To: caml-list@pauillac.inria.fr References: <20040410213616.GA28863@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040410213616.GA28863@redhat.com> User-Agent: Mutt/1.3.27i X-Miltered: at concorde by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; gushee:01 mgushee:01 havenrock:01 caml-list:01 2004:99 observations:01 toolkit:01 implemented:01 renderer:01 api:01 floats:01 gushee:01 englewood:01 manure:01 mgushee:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 235 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 image. 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 code). * 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 mgushee@havenrock.com its fields; http://www.havenrock.com/ When a nation ignores the Way, Horses bear soldiers through its streets. --Lao Tzu (Peter Merel, trans.) ------------------- 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