This is something I know nothign about either, and it
would certainly
help _me_ if somebody could explain what lambda calculus and
'closures' are useful for.
The lambda calculus is useful in the same way that any theoretical
discipline is useful. It does not itself solve problems; it informs
and supports the creation of methods to solve problems. I'm not the
best person to ask about it, because it is something I know only
peripherally.
Closures, on the other hand, are IMO of great practical use if you're
working in a language that supports them; like most language concepts,
having the concept sometimes helps even when the language doesn't
support it, because it means you can implement it, or a useful subset
of it, and then use the resulting tool - without the conceptual tool,
it's a lot harder to come up with such things.
In languages that have them, closures are useful for currying (there's
theory poking its head up again) and encapsulation - in simple cases
these are a bit like OO approached from another angle, but they allow
some things that are rather outside the bounds of most OO paradigms,
though in OO languages with multiple inheritance it's possible to
simulate closures with suitably contrived collections of objects. But
closures, like most language features, are really convenience: anything
closures allow you to do, you can mangae to do without them by
simulating them manually. But it's awkward (to varying degrees,
depending on things like what language you're using).
It's difficult to give a practical problem closures are useful for in
much the same way it's difficult to give a practical problem resistors
are useful for: they are things which are used to build solutions,
rather than themselves being solutions.
Loosely put, closures take a blob of code and the bindings of some
variable names to variables and return a thing which can be executed
like the blob of code, but, while it's executing the code, the
name<->variable mappings saved in the closure are temporarily
reinstated. This means they can be useful when you want to package up
some code along with some state for it to operate on but would rather
not resort to global variables. In languages without closures, this
can lead to the "callback function and its argument" pattern, but that
has problems when you want to pass two arguments, or you want to share
the state among multiple functions.
/~\ The ASCII Mouse
\ / Ribbon Campaign
X Against HTML mouse at
rodents-montreal.org
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B