Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
2  
What lambda? -function? -calculus? wavelength? –  Henrik Feb 20 '11 at 18:26
add comment

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.