On Sat, May 7, 2011 at 8:51 AM, Base <basselh...@gmail.com> wrote:
> At the risk of sounding completely dense, I am having a hard time
> understanding the purpose of the Identity function.  As far as I can
> tell all it does is return what is passed to it.

It's most useful when you have functions that take functions as
arguments. For example, I have code that performs a SQL query and then
runs a map-reduce transformation on that. Sometimes, however, I want
just the original data so I can pass in identity (to map) and have it
be a "no-op".

Identity on its own isn't really useful - but in combination with
higher-order functions, it can be very indispensible!
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
Railo Technologies, Inc. -- http://www.getrailo.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to