Version française
Home     About     Download     Resources     Contact us    
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: skaller <skaller@u...>
Subject: Re: [Caml-list] Fwd: Polymorphic optional label argument, with default
On Sun, 2004-04-11 at 18:33, Richard Jones wrote:

> But not if I want the default to be the most common case (which is
> that my graph will be a graph of ints).  I want the common case in
> there so that most of the time end users of the API won't need to
> worry about ~labels and optional arguments.

Of course it is trivial to do with two functions:

let plot_extended label_printer g = ...
let plot g = plot_extended string_of_int g

although I still prefer

let plot g = plot_extended polyprint g

since it remains polymorphic.

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
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