Thursday, November 29, 2007

Functional Programming Marketing

Following the discussions at CUFP about how to achieve broader adoption of functional programming, I had my car tricked out for some direct advertising:

Okay, I confess. But it was so close:

Tuesday, November 27, 2007

Futurama on Type Inference

I enjoyed Futurama when it first appeared in 1999, but through the reruns on Cartoon Network and the magic of TiVo, my admiration has continued to grow. Wired magazine has an excellent article pairing a history of the show (past, present and future,) with the announcement of two new seasons released on DVD. I own about three DVDs and never watch any of them, but I won't wait for these episodes to appear on TV.

Futurama delights in science humor, (math, physics, computer science,) which seems like a disaster for mainstream media, even to me. But the Wired article reveals how the creators, Matt Groening and David X. Cohen, managed to (eventually) walk the tightrope of financial success by keeping the main story line humorous for all, but adorning it with humor for the minority.

A personal favorite, and one I think all functional programmers will enjoy, is this little gem about narrowing types:
Moon farmer: Yep, goes down to -173 degrees.
Fry: Celsius or Fahrenheit?
Moon farmer: First one, then the other.
Hats off to Futurama for making math funny.

Sunday, November 18, 2007

Data: Singular or Plural?

My brother Sam was visiting recently and corrected me when I used the word "data" as a collective singular rather than the plural. He made some huffy comment about the difference being important to scientists. Back to that in a moment.

A few days ago I discovered that professional wrestling was older than I thought while watching a film from the 1940's. Well today I discovered that the use of data as a singular noun dates from at least that far back as well. This time my source is "The Philadelphia Story," also filmed in the 1940's. Jimmy Stewart, playing an author working as a journalist, says, "Our research department didn't give us much data."

I was about to send a snide note to Sam, when I started to wonder about the 'data' statement in Haskell, used to construct new types. There is also a 'type' statement and a 'newtype', both apparently singular, but then, each constructs exactly one type. So I have to wonder, is "data" in this context also singular?

If Haskell used "datum" instead, and there was more than one element in the type, it wouldn't make sense, I suppose. Of course, no sane language designer would force you to use 'datum Singular = One', but 'data Plural = One | Two', would he? Details like that are important in the semantics of Haskell, though perhaps not the syntax. Still, perhaps I should be more careful about my usage.

Friday, November 16, 2007

Your Grandfather's Professional Wrestling

I've always thought of "professional wrestling" as a relatively new phenomenon, but I just discovered it is at least thirty years older than I thought. I am referring, of course, to the type of wrestling that is more opera than sport, with tough guys leaping from the ropes and whacking each other with chairs. I remember it on TV as early as the 1970's and always thought it was originated about then. I've certainly never seen earlier TV clips of anything like it.

Imagine my surprise to find essentially the same drama depicted in the 1941 film "Shadow of the Thin Man." It wasn't quite as gaudy, but all the elements were there: the wrestlers were big, fat and mean; the bout was acrobatic and exaggerated, nothing like olympic wrestling; and the fans relished the battle between good and evil, cheering wildly as the bad guy took a beating.

It seems the sport had a reputation of being fake even then. As Nora Charles passes the ring on her way out, she looks at the losing wrestler, his face down on the mat, struggling to escape a head lock. "I hope you get out of that," she says. He immediately stops grunting and replies, "Thank you, ma'am," as calmly as a doorman, then returns to his struggles.

Tuesday, November 6, 2007

The Sound of Wire Hangers

My brother was in town for a conference and left on an early flight this morning. I woke up a bit when I heard the sound of spoon on cereal bowl, a very distinctive and penetrating sound. I sat bolt upright sometime later when I heard three successive sproings, like very loose piano strings being plucked.

It turned out they were the sound wire hangers springing back into shape. I had washed some of his t-shirts and hung them to dry on a very high rod in his room. He couldn't reach the hangers themselves, so he had eventually just pulled on the shirts until they came off. It was a very odd sound to wake up to.

Monday, November 5, 2007

Stalking Spicy Cocoa (Cocoa Capsaicin)

Last winter I made a serious attempt to cut all refined sugar out of my diet. I was also not drinking coffee at the time. Either one would have been fine, but removing both left a gap that I needed to fill, so I started experimenting with a sugarless cocoa. I ended up with a recipe that I felt was drinkable, but not stunning. Still, after several months of making it, I found that I could not go back to the normal sugared cocoa. Anything over a pinch of sugar tasted out of balance. Winter is knocking at the door again (in San Diego, that means it is getting down to 50F at night and doesn't make it to 80F during the day), so I'm going to start fiddling again.

I knew two interesting facts about cocoa: adding a pinch of salt improves the flavor; the Aztecs used chile peppers instead of sugar. I like spicy foods and there's a local chocolate company that makes a nice chile pepper chocolate bar, so I felt I had a good starting point.

Removing the sugar definitely leaves a gap. Adding salt warms the flavor of the chocolate, but it is easy to go too far. With sugar, I add just a few grains of kosher salt per cup. Without sugar, I increased this to a small pinch with good results, but if I went as far as a normal pinch for savory dishes, the flavor of the salt came through. The quantities are small enough that measurements with standard kitchen equipment are tough, and I think it's better to find the break point with your own taste buds.

Next, I added cayenne pepper. This produced a satisfactory bite, but there was still a gap on the tongue where the sugar used to be. So I started adding other spices: cumin, coriander, cinnamon and nutmeg. You can get pretty aggressive with the cumin, but the coriander is like the salt in that a little helps and a little bit more is too much. It's hard to get a nice clean flavor with this technique, but you do get a sort of earthy bass line and that's what I ultimately came to like.

I also experimented with adding back just a pinch of sugar, about the same amount as the salt, and that was enough, given all the other new flavors, to make it taste sweet again.

As I'm writing this, it occurs to me that I should go back and get a whole variety of dried chile peppers and start from scratch. There are a lot of varieties that I have not dabbled with, many with more rounded flavors than cayenne. Also, I doubt the Aztecs used milk. Perhaps there is another path that will lead to a better result. Seems like an excellent project for the coming winter.

To make this yourself, put a small, heavy sauce pan over low heat and add a pinch each of:
  • kosher salt,
  • cayenne,
  • cumin,
  • coriander and
  • cinammon.
Toast the spices gently for thirty seconds or so. Add:
  • freshly grated nutmeg and
  • a heaping table spoon of (sugarless) cocoa powder (dutch process is good.)
Toss to combine. Add:
  • a mug full of milk,
whisking in a little bit at a time until the cocoa is fully combined with the milk. Heat until the milk begins to steam, but not to the point of simmering. Add:
  • 1/4 teaspoon vanilla extract.
Pour and serve. The spices accumulate in the bottom of the mug. If you don't like the grittiness, be careful as you pour to leave them behind or strain the cocoa through a fine sieve.

Saturday, November 3, 2007

Barbarians and Technology

I am reading "Wilful Behavior", by Donna Leon, a murder mystery set in Venice. Although it is written in English, certain items are only referred to by their Italian names. She never writes "cell phone," always "telefonino," which I take to be "little phone." Clearly, Leon thinks the Italian term is superior, or at least more colorful, and I would have to agree. It seems especially effective when we learn from Leon's detective that his wife thinks of modern humans as "barbarians with telefonini."

Thursday, November 1, 2007

British Programming Style

(Reposted to welcome Planet Haskell readers. Apologies if it appears twice.)

While attending ICFP 2007 in Freiburg, David Fox and I ate dinner with Norman Ramsey, Jeremy Gibbons and one other, whose name I now forget. Jeremy had brought us to the Heilige Geist (Holy Ghost) am Munsterplatz (cathedral square). Both the food and the company were great. David ordered the venison liver appetizer and I had the venison ragout, both of which were unusual and excellent. I taught the group how to play binary word search, which they took to quite readily. And, of course, we had a number of discussions about programming language research.

But the high point of the evening was a quiet remark made by Jeremy Gibbons. I have completely forgotten the context, but I vividly remember this sentence:
Operational semantics isn't really a British thing.