Browse thread
[oliver: Re: [Caml-list] Suggestion: Pervasives.identity]
- oliver@f...
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | oliver@f... |
| Subject: | [oliver: Re: [Caml-list] Suggestion: Pervasives.identity] |
----- Forwarded message from oliver ----- To: Martin Jambon <martin_jambon@emailuser.net> Subject: Re: [Caml-list] Suggestion: Pervasives.identity On Fri, Apr 23, 2004 at 08:18:21PM +0800, Martin Jambon wrote: > Hello, > > Is there a good why there is no predefined identity function? > (fun x -> x) is sometimes less readable, and seems to be not > compiled (yet?) as this black magic: > external identity : 'a -> 'a : "%identity" > > In the same style, we already have Pervasives.ignore, so why not > Pervasives.identity? > When/where/why do you need such a function? And why don't you define it yourself? let id x = x THIS does not seem to compicated or unconvenient to do it by yourself. But why do you want to have such a function? I see no reason to have such a function. If you for example call a function and give it as one parameter a <something> why should you instead give it an id <something> ?! and why not give back then id ( id <something> ) or id ( id ( id <something> ) )???? What would that be good for? Why not saying x instead of (fun x -> x) ????? Do you like function calls so much, that you are doing as much as you can in your code? Ciao, Oliver ----- End forwarded message ----- ------------------- 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