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] Suggestion: Pervasives.identity
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Richard Jones <rich@a...>
Subject: Re: [Caml-list] Suggestion: Pervasives.identity
On Fri, Apr 23, 2004 at 10:48:56AM -0500, Brian Hurt wrote:
> Possibly stupid question: what use would this function be?

I've had to define an identity function from time to time.  Most
recently I wanted to define a function for printing labels on charts:

let plot ?(labels = identity) data =
  (* ... *)

Called as:

plot ~labels:string_of_int data

if the label was an int instead of the default string.  There was a
thread on this on ocaml-beginners I think.


Richard Jones.
Merjis Ltd. - improving website return on investment - CRM improvement consultancy

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