Sunday, December 2, 2007

Slouching Towards Bethlehem

After five years of discussions about programming languages, there are signs that my friend Joe has started to grok the benefits of functional programming. He's listened to me talk about it and agreed that it sounds good, but he only recently did some reading that really got the message across. Read how a book on Erlang got him excited about FP.

Last weekend I went tide-pooling with a friend and two of her kids. Half way there, her son Will (7) noticed that we all had coats and complained that his mom hadn't told him to bring one. She said, "I did tell you, but only twice. I have to repeat things five times before you hear me."

We all have trouble absorbing information that seems counter to our experience. In Will's case, he couldn't imagine the cold, wet ocean breeze from the comfort of his living room. For Joe, the functional approach was just so foreign, especially given that he was solving problems so well with imperative languages, that he could never really feel any benefit.

At CUFP this year, many people speculated that the need to exploit multi-core processors would be a motivating factor for people to move towards functional programming. (Intel is betting on it.) This proved true in Joe's case. He's currently doing server work in Ruby and he mentioned a few weeks ago that he'd been running into limitations of the Rails/DB design. Reading about the ease of threaded programming in Erlang suddenly made things click.

Patience and persistence pay off. People will hear when they are listening, understand when they have the need, switch when they can no longer contain their excitement.

Shifting Sands of La Jolla

Finally, some photographic evidence of just how much the contours of Windansea beach change. We had a lot of rain come in off the ocean on Friday and you can see just how much of the sand was removed by the storm surge in one day. There was no ledge in the sand on Thursday evening.




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.

Saturday, October 27, 2007

Lamb Stew with Zucchini and Steel-Cut Oats

I grilled a leg of lamb earlier this week when refugees from the San Diego fires were staying with me. Normally I make this dish for parties and there is nothing left over, but this crowd had small appetites. Even after some lovely lamb sandwiches, there was plenty left. The weather has now turned colder and we're getting a bit of rain, so I decided a stew was in order. I had some lovely zucchini that would certainly go well with the lamb, but I felt the stew could use a binding agent.

Earlier this year I saw Alton Brown's show on oatmeal. All my previous attempts at making steel-cut oats had failed to impress, but his recipe produced a wonderful dish that has since been a staple. But that left me wondering why oats are such a niche grain: breakfast cereal, cookie filler and granola grain.

Alton's trick to cooking steel-cut oats is to delay the addition of salt, because it seals the starch in the grain. If allowed to escape, the starch forms a creamy sauce, just like Arborio rice in risotto. It seemed like that was just what I needed for my stew.

The experiment was a success. The oats didn't lose their texture, as rice sometimes does, and the starch thickened the sauce, but never felt like glue, as flour sometimes does. The dish also has the benefit of being wheat and gluten free (except for trace elements that might have been introduced while processing the oats), a plus for several people I know.

The following recipe fits easily into a large latte' mug.
  • Half a small yellow onion, diced.
  • Two small zucchini, diced.
  • 1/2 C grilled lamb, diced.
  • 1/4 C steel-cut oats.
  • 1 1/2-2 C chicken broth.
  • Olive oil.
Heat a sauce pan over low to medium heat, add enough olive oil to cover the bottom and sweat the onions until translucent. Add the zucchini, toss until they begin to soften, then add the oats and continue to toss until the zucchini is soft and moist looking. There should be enough oil to cover the oats so that they do not stick, and ideally they should toast a bit.

Add the lamb, toss, then add enough stock to cover the ingredients. Bring to a simmer, cover and cook for fifteen minutes. Taste the stew and season as needed. I put a lot of spices on my grilled lamb, so I added just a little salt at this point. Cover and simmer until the oats are tender, another 10-15 minutes.

I also have some leftover chuck roast. Perhaps I'll try the same again tomorrow with that instead of the lamb.

Friday, October 26, 2007

Don't you want a title that's not boring?

I've been meaning to create a blog for some time, but have been waffling between using blogspot and making my own blog technology in Haskell.

Well, today my friend Ellie (8) is visiting. She has her own blog (lala090909.wordpress.com) and has been bugging me to start mine. Clearly, she was right, so I had her create me an account at blogspot (she recommended wordpress.com, because everyone at Club Penguin uses it, but all the people I know use blogspot, so she acquiesced: "Fine, if you want to be boring.")

("Wow, that's a lot of writing," she just said.)

After typing in my name, she asked for the title. "Clifford's Posts," she suggested? "Ruminations," I replied. "Oh no, more boring," she moaned. When I insisted, she said, "Fine, how do you spell that?" Halfway through the letters, she said, "All capitals?" "No, just the first letter." "How about one capital, one lowercase, and so on." "Hmm...," I said. "You don't want it all boring, do you?"

Clearly, we have different audiences. The current point of contention is that she doesn't know what "ruminatons" means. I've delayed telling her for some time and she finally said, "Ruminations isn't that bad, I guess."

So here's the rub. I'm involved in starting a new business, using functional programming (Haskell) to make a website that will both teach math skills and be fun. Seems like I've got the boring part of the math down pat. I'm going to have to work on the fun part.

Addendum: After all that fuss, blogspot capitalized the title anyway.

Ellie just read this and said, "You're not boring, it's just that adults tend not to use colors and other things that make it exotic."