Redux in a single line of RxJS.

Redux in a single line of RxJS.

action$.scan(reducer, initstate).subscribe(renderer)

The scan() operator in RxJS is just like reduce() operator in most fuctional libraries except for one thing, it emits partial reductions continuously as a stream which you can subscribe to. This is applied to a stream of actions (actions$) and the reducer is a pure function which is applied to each action in turn with the signature.

(state, action) => newstate

The state is the “accumulator” of the reduction and scan() emits a stream of states as its output. The render object is an Observer which is like a listener with callbacks for next(value), error(err) and complete().

Another attempt to explain Haskell to the wilfully ignorant.

Another attempt to explain Haskell to the wilfully ignorant.

This post is an experiment I decided to attempt after conversations with Ben Lesh and some other folks. I will assume as little knowledge of Haskell as I possibly can here. Later we’ll talk about some tools we have in Haskell to make the pattern more conceptually compact.

Via Emlyn O’Regan

Via Emlyn O’Regan

Originally shared by Mark Lewis

I read quite a few articles on driverless cars. This is the first one in a while that I have felt really has creative elements to it. They might be pushing the idea a bit too far, but it is a very interesting idea and goes beyond some of my previous thinking in different areas. What I liked most though was how the author points out that the auto industry could produce enough autonomous cars to replace all human-driven cars in a rather short period of time. That’s significant. The timeline for scaling up autonomous ride sharing is one of the things I’ve worried about the most, but apparently, if current production switched over to fully autonomous, it would produce a complete global supply of such cars in a rather short period of time because so many fewer cars are needed if the cars aren’t left sitting in parking lots all the time.