Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

If you're interested in examples of useful monoids and similar structures, you may want to have a look at the Algebird[0] project or the recent work on CRDTs[1]. The code savings in these projects comes from being able to write the complex distributed aggregation / conflict resolution / etc. code just once, and reuse it with a menagerie of useful implementations.

Personally, I like structuring things using these tools when I can get away with it. They're simple and broadly applicable abstractions, and mean I can reuse both my intuitions and my code in wildly diverse situations.

[0] https://github.com/twitter/algebird [1] http://highscalability.com/blog/2010/12/23/paper-crdts-consi...



What we want is a comparison: what was the OO code, and what did the functional code turn out to be? That way, we can judge for ourselves.

Typically, these examples take low-end crappy OO code and convert it to high-end elegant FP code. But this doesn't really convince anyone.


I don't know the OP's examples, but I think he is saying something subtly different: that he took (his own) low-end crappy OO code and converted it to high-end elegant OO code, using the insight gained from how he would have written it as FP.


I didn't get that from the article, but they aren't explicit about it.


I got that too, and that's exactly why I would like to see the code before and after. That's far more interesting than the rest of the article in my opinion.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: