Here's the low-down, to which any mathematician would attest:
A function is a transformation that maps an element to an element.
A functional is a transformation that maps a function to an element.
A functor is a transformation that maps a function to a function. (The truth functions in propositional logic are also sometimes called functors.)
Simple, isn't it? We seem to use the first one correctly, but not the other two. What people commonly call a functor (thanks to Dr. Coplien, shame!) is what the C++ Standard calls a function object. It seems some people like to use "functional" to mean the same thing. Shame again! A function object is simply that, an instance of a class that behaves like a function by virtue of its operator(). Some function objects, like bind2nd, do behave like functors, in that they take a function object as input and return a function object as output. Only these deserve the functor moniker, although you may prefer "function object adaptor" (or is it spelled "adapter" :-) , as denoted in the C++ Standard.
Tuesday, December 28, 2004
It appears that I have been using the term "functor" incorrectly. This is from an email posted on Boost-users list by Jeff Flinn, he quotes a letter to the editor of C++ Report: