# Is Lambda function same as Actor? How can it be explained?

Sometime back I read (from a book) that conceptually Lambda function is similar to Actor.

However I am clear on the concept, and will appreciate any insight or explanations for this.

If they are indeed similar how? If not is there any relationship between the concepts?

-
What lambda? -function? -calculus? wavelength? –  Henrik Feb 20 '11 at 18:26

Usually 'lambda function' is not different from a 'regular function'; 'lambda' is just a syntactic way to quickly define an anonymous function on the spot. If a regular function is an Actor in your book, lambda is, too.

Functions in most languages are closures, that is, if they refer to some 'outside' objects, they keep referring to them and can store state in them, if they are mutable. This may help a function/actor to "designate the behavior to be used for the next message it receives". A pure function is incapable of this, of course.

Functions can usually return any kind of objects, so they can return whatever new actors they create. So even a pure function can "send messages" and "create actors" by returning them. An impure function can just send messages and create objects.

Lambda calculus, as the wikipedia article helpfully notes, is unsuitable for typical actor model, because it's pure and can't share state. But actor model can be implemented with mostly pure functions, as Erlang actor model shows.

-

Communicating Sequential Processes describes using (pure) functions to model processes. CSP looks an awful lot like Actors (but see here for how they're not identical): a process is a function that takes some input and returns another function describing its next behavior. Actors look an awful lot like CSP: an actor takes a message and returns another actor describing its next behaviour.

-