Unit, bind, flatten

I’m 3/4 of the way through my Gold Card day, and I think I can finally tell a monad from a modron, and even from a maenad. Whether this will translate into a presentation anyone else can understand is still an open question.

Meanwhile, I’ve discovered:

  • A whole folder of monad examples in the Scala distribution.
  • That trying to do higher-order functional programming in straight Java does, in fact, really blow. An example that takes 74 lines in Scala takes… well, I don’t really know how many lines it takes in straight Java, because nine classes and 195 lines in, I’m only up to line 37 in the original (single) Scala file. We could extrapolate and guess 390 lines, but I wouldn’t bet on it. Maybe those BGGA closures aren’t such a bad idea after all…
  • James Iry’s “Monads are Elephants,” an introduction to Scala monads that’s got more words and less math than Burak Emir‘s. (Nothing against math — or Dr. Emir — but we language majors like our human-readable variable and function names.)
  • Scala for Java Refugees,” a nice tutorial from Daniel Spiewak.

And, last but not least:

  • That “Introductions to monads are bit of cottage industry on the Internet.” (James Iry again.)

So much for my plan to get rich writing Monads for Dummies.

Code monkey get up get coffee

I think I’ve mostly recovered from houseguests, bronchitis, a Hugo award nomination, and several days spent driving a zippy little turbo diesel Alfa Romeo at high speeds over narrow French country roads. (And yes, I did spend all my recovery time listening to Jonathan Coulton MP3s, why do you ask?)

Meanwhile, Neal Gafter’s posted some further notes on his Neapolitan ice cream puzzler, including a couple of solutions that should be interesting to anyone trying to decide what does and doesn’t constitute “enum abuse.” And Eric Lippert’s corrected my conclusions on C# readonly vs. Java final; the C# approach is rather interesting, I think.

Eric’s also commented on Dan’s question about state management in functional languages. I’ve got a gold card coming up; maybe I should do something with this Scala monad tutorial