Version française
Home     About     Download     Resources     Contact us    
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.

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
http://www.winwinsales.co.uk/ - CRM improvement consultancy

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