in reply to Re: IO::Lambda: call for participation
in thread IO::Lambda: call for participation
An example. lambda {} is a (lightweight) object capable of holding the state for you (like monads do), so the following (deliberatly simiplified) construct
lambda { read { sysread(...) write { syswrite(...) }} }
makes sure that a socket handle will only receive writing (and only writing) events after reading events were received.
With this approach, other functional tricks can be done, f.ex. a map analog will make sure that all lambda objects (connections, states) execute sequentially:
where instead "1 + shift" there could be a full-fledged http connection, for example, or a DBI statement, or lock waiting procedure - all non-blocking, of course. So again, back to the question, it's mainly "lambda" because it shares some interesting hacks with functional programming.print mapcar( lambda { 1 + shift })-> wait(1..5); 23456
|
---|