Message from JavaScript discussions

November 2017

— This way, for each iteration, you have access to current and previous version of an "entry"

— 

Caveats:
.once may be slow
useOldEntry HAS to be called synchronously within the callback to avoid possibility of skipping entries

— Pros:
Pure functional ish
Gets the job done

— Alright maybe I need to see this in action in my actual code to see the picture

— But, ehh, monads may be nicer

— Because, yes the concept seems doable

— But I can't see the spot to fit It

— I have an actual nodejs example

— A HTTP server that increments a counter without modifying state

— 

function count(i) {
server.once('request', function (req, res) {
res.end(String(i));
return count(i + 1);
});
}

count(0);

Message permanent page

— Use on existing server to create a request counter

— The "pro" here is that it avoids mutating state
The con is that this STILL isn't a pure functional monadic interface

Message permanent page