He just said monoids!

September 28, 2012 at 9:00 am
filed under Coding
Tagged , , ,

I like to listen to talks off of InfoQ, mostly from Rich Hickey. Today on my way home I was listening to Reducers. It’s a pretty fascinating talk— I tried to read Iteratees/Enumerators a week or so go, having seen it linked from the Reducers post on the Clojure blog.

Anyway, the interesting thing is that to get parallelism you end up at an implementation of fold. And to do that right, you need a function to combine two things. I got kind of excited at this point, I will admit, because I knew about this.

I remember reading about monoids in Learn You a Haskell. And monoids, as I understand them, have basically two properties: you can combine (aka reduce) them into one, and they have an identity. In Haskell, that’s mappend and mzero!

Of course, not long after this, Rich comes right out and says they’re monoids. At that point, I’d already gotten home, so I had to pause it so I could go walk my dog (which I am still procrastinating about).

Nevertheless, it was pretty exciting to know that I actually had a decent idea of what was going on. Huzzah! I’m still sort of getting my head around this idea of reducers, though, which are essentially a protocol for inverting the relationship between a collection and a mapping/reducing/filtering function. Can’t wait to actually see the slides with code.

%d bloggers like this: