Monadoku: An Introduction

I've never been a Haskell programmer, so monads have always been a bit of a mystery to me. I want to get them. I want to understand them. I want to know why other people like them so much. And the only way for me to do that is to use them/play with them/whatever in a way such that those things come together. So I've played a little bit, and I have my suspicions on "why". But I need to do a bit more, and this series of articles will be largely about that. But not solely; some of it will some minor diversions for my own edification or to lay some groundwork or just because it's fun or interesting. To me at least.

So what the hell is Mondoku? It's the exploration of monads, using Sudoku as a driver. When I first wanted to learn about actors, I knocked up a little Sudoku solver in Scala. I still have the code, but I don't know what version of Scala it was written in anymore, so there's not a chance in hell of getting it to compile. But I don't need to. The point is, I know how to solve Sudoku using an actor-like/message passingy/something or other framework. Sudoku is an interesting problem because some ways of solving it are piss easy, and other ways seem so daunting that you just start thinking about something else. So it's good in that it's a meaty problem, but by no means insurmountable, and simple at it's core. Which means that it will be useful to show different solutions that have different models of computation. "Different models of computation? What the hell does he mean by that?" I can hear you asking. Bear with me, that's kinda the point of the series. An exploration of how we split up data and computation, and how we chain computations together. All of these things are of critical importance to us as programmers. We've seen lots of stuff about data, and we have catalogs of patterns of similar types of computations, but there's not alot about chaining computations together, and I suspect that's what the meat of monads is. I may be wrong, but hopefully one way or the other, I'll figure it out along the way.

Oh yah, and Clojure. I like Clojure. I've been a fan of Lisps for a long time. Banged out more elisp than I care to admit. But Clojure had a lot of nice things going for it; the JVM, STM, a smart, engaged community, and it's fun. That last bit is the most important. So Clojure is what I'm going to be doing this exploration in. And all the code is available via GitHub. But now it's time for pancakes, so I'll be back later with the first article in the series, which focuses on the actor-like solution to Sudoku.

I'll try to keep this as a handy place that links to all the articles & relevant schtuff.

## No comments:

## Post a Comment