tag:blogger.com,1999:blog-69196690354025525752024-03-04T23:29:50.912-08:00RuMiNaTiOnSRecurring thoughts on food, functional programming (Haskell), diving and photography.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.comBlogger32125tag:blogger.com,1999:blog-6919669035402552575.post-78693613480331883952015-04-01T10:24:00.003-07:002015-04-01T10:25:39.740-07:00April Fools' Joke Exposes Weakness in Twitter VerificationThere was a <a href="https://twitter.com/magee9/status/583283980264321024" target="_blank">prank in my Twitter feed</a> today (April 1) that, on top of being very elegant, exposed a subtle loophole in Twitter's verification procedures. (<a href="http://imgur.com/FIKgtrp" target="_blank">Here is a screenshot</a>, in case the prank has been removed by now.) Notice the checkmark that indicates a verified account.<br />
<br />
The prank involves two soccer players, Jozy Altidore, USMNT striker who was given a red card yesterday for cursing at the referee, and Mike Magee, star of MLS team Chicago Fire, known mischief maker.<br />
<br />
Magee swapped the theme on his twitter account to make it look like he was Jozy Altidore and posted the spoof. Normally, this sort of thing gets rejected easily because of the verification badge. But the badge is there. I went looking to see how Magee had faked the badge.<br />
<br />
He hadn't. Magee is also a celebrity and also has a verified account. Anyone with a verified account can pretend to be someone else with a verified account, apparently.<br />
<br />
So I think if I were Twitter, I would change the name field for verified accounts to be immutable. Quickly, before Nathan Fillion finds out.<br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com1tag:blogger.com,1999:blog-6919669035402552575.post-3609050498633154522013-01-26T12:27:00.001-08:002013-01-26T14:27:52.961-08:00When is a programming feature 'helpful'?There was a kerfuffle in my twitter feed this morning which highlighted some issues about language design. Don Stewart retweeted <a href="https://twitter.com/garybernhardt/status/294874591120211968" target="_blank">this conversation about funny JavaScript behavior.</a> Reproduced in a JavaScript console, it looks like this:
<br />
<pre> > ['10','10','10','10','10'].map(parseInt)
[10, NaN, 2, 3, 4]
</pre>
It looks completely mysterious to a Haskeller, and by "mysterious" I mean "punishable by life in prison." I'd bet there's many a functional head listing on a sprained neck out there in Haskell-land,and that co-functional parents are explaining to their children what adult words are. I set about looking for an explanation, because I could not imagine how <em>map</em> could behave this way. I got the exact same answer in my browser, which made it unlikely that it was due to uninitialized memory. So first I tried using the identity function:<br />
<pre> > ['10','10','10','10','10'].map(function(x) {x;})
[undefined, undefined, undefined, undefined, undefined]
</pre>
Oh, right, JavaScript requires a <em>return</em>:<br />
<pre> > ['10','10','10','10','10'].map(function(x) {return x;})
["10", "10", "10", "10", "10"]
</pre>
Great! Sensible behavior. Next, I looked up <em>parseInt</em> and found that it takes two arguments: <em>parseInt(string, radix)</em>. JavaScript code is full of helpful functions that take variable numbers of arguments and guess what you mean based on their type, so this seemed a likely candidate for trouble.
<br />
<pre> > ['10','10','10','10','10'].map(function(x) {return parseInt(x,10);} );
[10, 10, 10, 10, 10]
</pre>
Much better. Presumably then, the broken version supplies a second argument to <em>parseInt</em> that it pulled out of its ass. The tail of <em>..2,3,4]</em> made me suspect there was some accumulation happening, so I tried this:
<br />
<pre> > [1,2,3,4,5].map(function(x,y) {return (x+y);} )
[1, 3, 5, 7, 9]
</pre>
Prison's too good for them, I thought. Apparently this sums adjacent elements, except...wait, there would have to be a zero prepended for that to work. I observed that addition being commutative, it was projecting out valuable information, so I tried something a little more revealing:
<br />
<pre> > [1,2,3,4,5].map(function(x,y) {return ('('+x+','+y+')');} )
["(1,0)", "(2,1)", "(3,2)", "(4,3)", "(5,4)"]
</pre>
Still looks like adjacent sums with a magical zero. At this point I had some coffee and realized I was confused about the types. I had two lists of small integers, one from a mysterious source, not one list being zipped with itself.
<br />
<pre> > [1,2,3,4,5].map(function(x) {return x*10;}).map(function(x,y) {return ('('+x+','+y+')');} )
["(10,0)", "(20,1)", "(30,2)", "(40,3)", "(50,4)"]
</pre>
Okay. The second argument is clearly not a function of the array contents and now looks like the array index of the current argument. Going back to the original problem:
<br />
<pre> > parseInt('10',0)
10
> parseInt('10',1)
NaN
> parseInt('10',2)
2
</pre>
Great, this sort of makes sense now. A radix of zero is assumed to be 10, a very C-like idiom, and the second example fails correctly because '10' is not a unary number. So, <em>parseInt</em> is not the villain, nor really is <em>map</em>. It is perfectly reasonable to have a variant for arrays that would operate on an element and its index. For me, the villain here is the handling of optional arguments. The <em>map</em> function is overloaded silently and that's the kind of help I don't want.
<br />
<br />
'Helpful' means different things to different people. To a Haskeller, the definition is something like: publish your promises and keep them. Explicit type signatures, referential transparency, static type-checking are all there to make those promises come true. In JavaScript, optional arguments are considered helpful, because they let you reuse the same function name in slightly different contexts.
<br />
<br />
Steadily, monotonically, over the years, I have moved away from convenience in the specification of a problem whenever it introduces uncertainty. When I first learned C, I memorized the precedence of operators so that I could write expressions with a minimum number of parentheses. Then I learned other things and forgot the precedences and just started parenthesizing everything until it was unambiguous. A friend in graduate school used Modula-3, which had no automatic casting between numeric types. C programmers were horrified, but I felt it was a breath of fresh air.
<br />
<br />
These conveniences should be part of interactive programming environments, not programming language specifications. Fuzziness, forgetfulness, disorder are part of the human condition and should be acknowledged, but they should not make it into the code. Say what you mean to the programming environment, by all means, but have the resulting program be completely unambiguous.
<br />
<br />
Which reminds me, the JavaScript <em>map</em> actually <a href="https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map">accepts a function of three arguments...</a>
Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com3tag:blogger.com,1999:blog-6919669035402552575.post-28969666760761164132013-01-12T14:11:00.000-08:002013-01-26T14:28:07.230-08:00Falafel WafflesI love falafel. Used to eat it all the time in NY. But it's not so common in San Diego. I'd make it myself, but I hate deep frying. But Mark Bittman's love of freshly-cooked chickpeas (the the resulting broth, which he dubs 'gold') set me to cooking them myself. Which made me want falafel.<br />
<br />
So I thought about alternatives to deep-frying. The essence of deep-frying, I reasoned, is total immersion in high heat, where high means more than boiling, hot enough to brown.<br />
<br />
Enter the waffle iron, a device that forms batter into a shape with a lot of surface area exposed to high heat. Clearly, this is genius on two scales, I thought: it will work beautifully; it rhymes.<br />
<br />
Trademark time! Google search! First entry: No, you aren't the first person to think of falafel waffles. D'oh! Still, there aren't many falafel waffle recipes out there, and many included wheat flour, but I wanted both wheat- and gluten-free, so I set out on my own expedition.<br />
<br />
I started with chickpea flour (Bob's Red Mill). For seasoning I used garlic, scallion and some fresh herbs (various mixtures of dill, cilantro, mint and basil.) The taste was great, but I had used very little water, just enough to bring the mixture to a paste, and that did not work so well in a waffle iron. If I left it long enough to brown, my falafel turned into a jawbreaker.<br />
<br />
So gradually I increased the liquids, water and some olive oil, until I got to a pour-able batter, just like flour waffles. On the advice of waffle experts, I added baking powder, and where others added a little wheat flour for binding, I added arrowroot. I haven't done controlled experiments on the effects of the arrowroot as a binding agent, so don't panic if you don't have any.<br />
<br />
<br />
In addition to the baking powder, I borrowed the traditional wet/dry method from baking: two bowls, one for wet ingredients, one for dry, mix each thoroughly, then combine. The wet and dry mixtures should be roughly equal in volume. This recipe uses 1/2 Cup of each, resulting in about two waffles in a medium-sized circular waffle iron.<br />
<div>
<br /></div>
<br />
<br />
The result is spicy, savory waffles, light and crunchy, with a uniform texture. They are different from traditional falafel, but close enough for my purposes. I eat them as a standalone snack, or with chopped cabbage (usually red) dressed with a sauce made of lemon and tahini (sesame paste).<br />
<br />
To restore some of the feel of traditional falafel, I often add small quantities of mashed chickpeas, cooked brown rice, or both. Both of these reduce the tensile strength of the waffle, but add a nice crumbly texture and nuttiness.<br />
<br />
<br />
I put the wet ingredients in a measuring cup and puree with an immersion blender:<br />
<br />
<ul>
<li>2 scallions or 2 cloves of garlic, or mixture</li>
<li>a few sprigs of herbs</li>
<li>pinch of salt</li>
<li>a tablespoon or two of olive oil</li>
<li>enough water to bring the level to 1/2 Cup.</li>
<li>Optional: a tablespoon or two of chopped/mashed chickpeas and/or brown rice (cooked)</li>
</ul>
Dry:<br />
<br />
<ul>
<li>1/2 Cup chickpea flour</li>
<li>pinches of salt, pepper, cayenne, cumin</li>
<li>1 teaspoon of arrowroot</li>
<li>1 teaspoon of baking powder</li>
</ul>
The resulting batter should pour easily. If not, add more water and mix until it does. Bean flour takes some time to re-hydrate. I let the batter rest for an hour; anything less than that seems to leave a hint of raw bean taste. This recipe makes about two waffles in a circular waffle iron.<br />
<br />
<br />
<br />
Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com2tag:blogger.com,1999:blog-6919669035402552575.post-51591385680758314752012-05-21T22:32:00.000-07:002013-01-26T14:28:14.047-08:00GHC Talks to the ScarecrowI have a strange sense of humor. It's essential that you know that before reading on. 'Cause really, this is a pretty dry little post about an obscure error in a Haskell program.<br /><br />Today, I got a message from GHC that always amuses me. Why? Because the message makes feel like GHC is poor little Dorothy, stuck at the fork in the road, confused by the Scarecrow's advice that some people go both ways.<br />
<br />
<a name='more'></a><br />
Here's a simplified version of the program:<br />
<br />
<blockquote class="tr_bq">
{-# LANGUAGE FlexibleInstances, OverloadedStrings #-}<br />import qualified Data.Text as T<br />class Argh a where<br /> toArgh :: a -> Char<br /> <br />instance Argh T.Text where<br /> toArgh = T.head<br />instance Argh [Char] where<br /> toArgh = head<br />x :: Char<br />x = toArgh "Argh!"</blockquote>
<span style="text-align: left;">In response, GHC complains:</span><br />
<blockquote class="tr_bq" style="text-align: left;">
Argh.hs:14:12:</blockquote>
<br />
<blockquote class="tr_bq">
Ambiguous type variable `a0' in the constraints:<br /> (Data.String.IsString a0)<br /> arising from the literal `"Argh!"' at Argh.hs:14:12-18<br /> (Argh a0) arising from a use of `toArgh' at Argh.hs:14:5-10<br /> Probable fix: add a type signature that fixes these type variable(s)<br /> In the first argument of `toArgh', namely `"Argh!"'<br /> In the expression: toArgh "Argh!"<br /> In an equation for `x': x = toArgh "Argh!"<br />Failed, modules loaded: none.</blockquote>
Funny, no? It's amusing to me because the directive OverloadedStrings is designed to make it easy on the programmer in the time of many string types, letting you use the quoted string to produce either [Char] or Text, depending on the context. But in this case, both contexts occur in the same place, since the class Argh has instances for both types.<br /><br />
Now, if GHC were psychic, it could see that all roads lead to Rome. Or the Emerald City. Or something like that. The result is the same, either path it chooses. But I'm just as happy that it doesn't choose for me. I'm just as happy to either remove the OverloadedStrings directive or put in a an explicit type declaration and move on. After a little chuckle thinking about the Scarecrow.<br />
<br />
<blockquote class="tr_bq">
</blockquote>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com2tag:blogger.com,1999:blog-6919669035402552575.post-9773411630073173082011-10-01T12:40:00.000-07:002013-01-26T14:28:40.869-08:00@ConalElliott re: What resources & practices (teaching Haskell)<div style="background-color: transparent; "><span id="internal-source-marker_0.3926584047731012" style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Conal Elliott asks: What resources & practices would you recommend for helping a group of Java & C++ programmers learn to work in Haskell? I saw the question first on Twitter, but my compression skills were not up to the task of answering there.</span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">I have two recommendations: </span><span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: bold; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">teach them the simplest definitions of the fundamentals;</span><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "> </span><span style="font-size: 11pt; font-family: Arial; background-color: transparent; font-weight: bold; font-style: italic; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">read programs with them, out loud, like children's books, skipping nothing.</span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">These steps are often passed hurriedly, by teachers so steeped in a subject they don't realize how different their worlds are, by students eager to build things as quickly in a new programming language as they do in the old. Most likely, the students will assume that they just need to learn new syntax to be off and running. Indeed, I am sure they are capable, self-motivated software professionals and that they would succeed in learning Haskell, just without the deeper understanding that can make it such a joy.</span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">As a test, ask your students to write down the definition of 'type'. I'll bet that their answers will be longer than 'set' and include some mention of bytes, words and big-endian. We were all trained to be mechanics instead of drivers, because all we had were go-carts.</span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">C and its children will have left clutter in their minds. Types will be obstacles, efficiency a drug, correctness assured by machismo. They will gloss over code without really reading it, trying to fit it into an existing model. Saying things out loud helps slow things down, forces them to make connections between symbols, words and definitions so fundamental they are rarely written down. (I backtracked through Paul Hudak's book for hours trying to find out how to say '::'; newcomers ask pretty regularly in #haskell.)</span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Make sure they know all the places that patterns can appear in code and how they work. Make sure they know that data constructors are functions. Have them verify that with :type in GHCi. And that type constructors are functions, verifying with :kind. They should be familiar with the syntax and semantics of higher-order types before they meet IO, so that they understand it is not magic.</span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Lists, recursion, functional algorithms, none of these will be challenges, but constructs they have not seen before will give them much more trouble if they cannot deconstruct them to primitives. I</span><span style="background-color: transparent; text-decoration: none; vertical-align: baseline; "> </span><span style="font-size: 11pt; font-family: Arial; background-color: transparent; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">cannot imagine Conal omitting such fundamental semantics from his lessons, but I can easily imagine both teacher and students, excited to build new stuff, skimping on the exercises necessary to flush out the old foundations and cement the new.</span><br /></div>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com9tag:blogger.com,1999:blog-6919669035402552575.post-54510732698338059152011-09-11T01:44:00.000-07:002011-09-11T01:45:42.802-07:00Two Degrees from 9/11<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium; "><div style="background-color: transparent; "><span id="internal-source-marker_0.19402280915528536" style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">On the morning of September 11, 2001, I didn’t board a bus to New York City, and in not doing so, buffered myself from a world of hurt.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">I wasn’t clever or prescient, just lucky. I was at the bus stop, I’d seen the bus and flagged it down. But just then, two women jogging by stopped and asked if I had heard what happened. I wanted to keep eye contact with the driver, but the anxiety in their voices made me turn and listen. I glanced back to the driver as he slowed, saw him looking for confirmation, but I didn’t signal him again and he drove on.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">I went back home, turned on the TV and soon saw the first tower fall. Had those ladies not happened by, I might well have seen that tower fall from the bus instead.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">One friend was not so lucky. He was at jury duty that morning, just ten blocks away from the towers. He saw both towers fall as he walked back to his office in SoHo, breathing the first fumes of the fires, crying uncontrollably at the insanity. Days later, he discovered that a good friend and colleague had been high up in a tower, unable to evacuate. That same victim was actually the boss of another friend of mine, who then had to step up and fill that position.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Another friend was a SCUBA instructor who had trained dozens of NY firefighters to dive. Over a dozen of his students died in the collapse.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Earlier that year, I had attended the wedding of a diver I knew, held at Windows on the World, the restaurant at the top of the north tower. He and his new bride were devastated that so many of the restaurant staff they had worked so closely with to plan the event were lost.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">It seemed that everyone lost someone, except for me. My connections were always indirect, like some tragic form of the Kevin Bacon game where I was always degree two. I do not know how much that separation lessened the blow, but it was significant.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">On Friday, I went to the NJ side of the Hudson River near the Lincoln Tunnel to see the damage for myself. Though still several miles away, the plume of smoke was trivial to spot, and the lack of that distinctive skyline was like a splinter in my mind.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Still, I did not find myself overwhelmed by anger and grief, like those more closely linked. I looked at New York City, not the way you look when you’ve grown up in a place, but with the eyes of a tourist. The New York metropolitan area is huge. Standing on the palisades, I could see a dense urban landscape, seemingly extending to infinity in all directions.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">Suddenly, all I could think of was how little physical damage the attacks had done. Perspective has that effect. The WTC towers were so huge, their presence swamped the mind, especially as one got closer. Just standing at the base and looking up, it felt like they were arching over you instead of going straight up. Their destruction was equally overwhelming. But from where I stood on the palisades, with two degrees of separation in my pocket, I could focus on the thousands of huge buildings, housing millions of people for miles around and see that they were all fine.</span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; "></span><br /><span style="font-size: 11pt; font-family: Arial; color: rgb(0, 0, 0); background-color: transparent; font-style: normal; font-variant: normal; text-decoration: none; vertical-align: baseline; white-space: pre-wrap; ">I’m not saying the impact wasn’t real, even for someone of degree two. Business dried up and I took advantage of a job offer in San Diego, where I’ve been ever since. All my friends mentioned above stayed and went through some hard times. I sometimes wonder, if I had caught that bus, would I have been degree one, and what might have been different as a result.</span></div></span>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-71329748577008920012008-12-28T11:40:00.000-08:002013-01-29T23:46:37.377-08:00Fish in Monk's Clothing"Merry Christmas! Could you come to the kitchen and help with the fish?" It wasn't exactly unexpected, but it was still a nice little challenge, like Top Chef the home edition. Unfamiliar kitchen, lots of competition for space, no specific instructions and the opportunity to make or break someone's Christmas dinner. On such occasions, it's good to have a little bit of wisdom from Julia Child in your back pocket.<br /><br />My travel plans to Illinois had been delayed for two days by snow and ice, so I ended up flying on Christmas day, getting to my brother's house about an hour and a half before guests were showing up for dinner. Everything on the menu was traditional in that household except for the fish, which my brother doesn't eat, so I got volunteered to cook that.<br /><br />Again, I did have some warning. Several days before, my brother had mentioned on the phone that some guests had asked for fish instead of tenderloin, and that he had bought some frozen tilapia filets. All he needed was a recipe. I said that for simple white fish, I used to like the method that Julia Child had gotten from some monks in the south of France, an episode entitled ``Fish in Monk's Clothing,'' where the fish is baked covered in lots of aromatic vegetables. "Search on the internet, I'm sure you'll find a recipe," I said.<br /><br />Well, he had searched and had found four recipes for tilapia, but none were Julia's. I didn't like the look of them and although I hadn't made this dish in years, I preferred to find my own way again. Fortunately, the dish turned out well, but the down side was that I had no recipe to give to the people who asked for one, only a bunch of vague constraints.<br /><br />The essential thing is that the mix of vegetables should taste good, but be reasonably mild so as not to overpower the fish, and should still have a lot of moisture in it. You need enough to cover the fish reasonably well. The vegetables drip flavor into the fish while at the same time protecting it from losing moisture in the direct heat of the oven.<br /><br />(For the Haskell readers, think of the following as a sort of QuickCheck test suite for the actual method.)<br /><ol><li>Chop and saute a bunch of aromatic vegetables, season with salt and pepper, thyme or other mild herbs, and reduce with some white wine. The vegetables should be soft, but still very moist and it's good to have some liquid remaining.<br /></li><li>TASTE the vegetables. If they don't taste good, fiddle with the seasoning until they do.<br /></li><li>Season the filets with salt and pepper, then place on an oiled baking pan. If the tails of the filets are much thinner than the main part of the body, overlap them so that the fish is roughly the same thickness all over.</li><li>Layer the vegetables over the fish along with any remaining liquid.</li><li>Bake gently until the fish is just opaque and flakes easily. I think we did 350F for about 15 minutes, but this will vary with the amount and size. You could also microwave it for 5-10 minutes, covered, if you use a glass or porcelain casserole dish.<br /></li></ol>As for which vegetables, that varies based on what I have on hand, but start by sweating an onion in olive oil and butter, then adding celery and a few chopped cloves of garlic. It is fine to brown the onion a bit, but not the garlic. This time we added some chopped mushrooms and parsley. I have added carrots in the past, but that's about as strong as I would go. Julia Child used a head of iceberg lettuce chopped up, but I've never had the nerve to try that. Spinach or swiss chard make a nice choice, but kale, mustard greens and cabbage are too strong. Fennel is a nice addition if you like anise flavor.<br /><br />Any simple white fish works here, such as flounder, sole, tilapia, catfish, etc. I think I've done it successfully with bluefish, but I would avoid salmon.<br /><br />How close this is to what Julia Child did, I really don't remember, because I only saw the show once long ago, but I'm pretty sure I've got the essence right. It's a simple way to marry fish with whatever vegetables are available. In any case, it was good enough for Christmas dinner.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com6tag:blogger.com,1999:blog-6919669035402552575.post-39789636604918651122008-12-14T19:37:00.000-08:002008-12-14T19:59:39.097-08:00The Pattern of Walking<a href="http://picasaweb.google.com/clifford.beshers/ThePatternOfWalking#slideshow">These images</a> may look like Christmas lights, but they were created simply by holding a camera on long exposure while walking on the beach at dusk. If you just wave the camera around, the patterns are uninteresting, because they have little cohesion, but just walking straight created unexpectedly interesting results.<br /><br />They remind me of high school physics, when we learned about cycloids by attaching a light to a bicycle tire. The walking images are more regular than I expected, but also far more convoluted than a cycloid. Just as the hidden motion of the tire was revealed in that experiment, these images must show something fundamental about walking. I'm just not sure what.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com2tag:blogger.com,1999:blog-6919669035402552575.post-7643046655388026482008-11-17T22:59:00.000-08:002008-11-17T23:00:57.713-08:00Never turn your back on the oceanThat's a good rule in SCUBA diving and it's a <a href="http://picasaweb.google.com/clifford.beshers/JonahAndTheWave#slideshow">good idea on the beach</a>.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com2tag:blogger.com,1999:blog-6919669035402552575.post-63153071539321363012008-11-10T23:18:00.000-08:002013-01-26T14:28:40.867-08:00Functional Programming and the UniverseIn Lee Smolin's TED talk <a href="http://www.ted.com/index.php/talks/lee_smolin_on_science_and_democracy.html"><span>How science is like democracy</span></a>, he describes how our understanding of space and time has evolved. He describes three stages of cosmology:<br /><ol><li>Aristotelian, which is hierarchical and all properties are defined with respect to that hierarchy;</li><li>Newtonian, where properties are all defined with respect to an eternal absolute background of space and time;</li><li>Quantum Theory or Relational Universe, where the universe is nothing but an ever evolving network of relationships, and all properties are about relations between subsystems.<br /></li></ol>Two quotes from the talk that jumped out at me:<br /><blockquote></blockquote><blockquote>According to Newton, space is just the way that god knows where everything is.</blockquote>And this one, regarding the modern relational model of the universe:<br /><blockquote>Space is just one aspect, so there's no meaning to say absolutely where something is, there's only where it is relative to everything else that is, so we call it a relational universe.</blockquote>In other words, even the physicists don't use an object-oriented model to describe objects any more.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-79188051115274811262008-10-31T08:41:00.000-07:002008-10-31T09:01:56.992-07:00Halloween SlideshowAs a public service, I've made a <a href="http://picasaweb.google.com/clifford.beshers/Halloween#">Halloween slideshow</a> out of photos I've taken over the last year. Comprising over a hundred scary, ghoulish and horrifying images, you can set it playing on a spare monitor and be frightened all day long.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-7663982495575075712008-10-14T22:36:00.000-07:002013-01-29T23:47:38.958-08:00Pie Night<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnaKNQKwCvMc61sM6xKdYQLFAFssuF70WE7r_hDx567r53LTnaHawcNMcQAWmRL9t92tX6v0r5jX9nMAWyMcEeNaanN0Anc1oBuUzke_vPvcA5UJkPmmUBrnBSrOOHooSYosvEykaxjYI/s1600-h/Pumpkins_320.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnaKNQKwCvMc61sM6xKdYQLFAFssuF70WE7r_hDx567r53LTnaHawcNMcQAWmRL9t92tX6v0r5jX9nMAWyMcEeNaanN0Anc1oBuUzke_vPvcA5UJkPmmUBrnBSrOOHooSYosvEykaxjYI/s200/Pumpkins_320.jpg" alt="" id="BLOGGER_PHOTO_ID_5257272441228023122" border="0" /></a>My friends Michael and Susan have a wonderful tradition that grew out of growing too many pumpkins.<br /><br /><br /><br /><br /><br /><p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIsldh55-NROAxCWxeXcIdC73Q8wHbqDpkbBVPVSaDreFMWcj77KHusdxm2O8tWI3gm-a54aKVJXgLiu-jU9DhrZ_N3NlfzcgJquNj7e2AgKz0seaUugXcvhM6mfYwT6XD70XN3mAzA3E/s1600-h/PieNight_320.jpg"><img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIsldh55-NROAxCWxeXcIdC73Q8wHbqDpkbBVPVSaDreFMWcj77KHusdxm2O8tWI3gm-a54aKVJXgLiu-jU9DhrZ_N3NlfzcgJquNj7e2AgKz0seaUugXcvhM6mfYwT6XD70XN3mAzA3E/s200/PieNight_320.jpg" alt="" id="BLOGGER_PHOTO_ID_5257270122038582322" border="0" /></a></p><br /><br /><br /> Pie night.<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJzeoIEmUNRgdq3xGSDpG-uz4gbpWfvlSs0eVFsNHVFm8NqFeR8MKkgpWGtjCROr0oeHAeID-asKT6aA4dUDFEusaM3a1Y8u4cgUDqET0ZMwkqYP_V7iZIOxKJBiz_XLH_BYOgyTuBA8/s1600-h/PieNightGap_320.jpg"><img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEipJzeoIEmUNRgdq3xGSDpG-uz4gbpWfvlSs0eVFsNHVFm8NqFeR8MKkgpWGtjCROr0oeHAeID-asKT6aA4dUDFEusaM3a1Y8u4cgUDqET0ZMwkqYP_V7iZIOxKJBiz_XLH_BYOgyTuBA8/s200/PieNightGap_320.jpg" alt="" id="BLOGGER_PHOTO_ID_5257272904931547842" border="0" /></a><br /><br /><br /><br /><br /><br /><br /><br /><br />They make 10-15 pies, everybody brings a pie, everybody eats pie until they can't eat no more.<br /><br /><br />And then we have pie for breakfast.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com1tag:blogger.com,1999:blog-6919669035402552575.post-71629019997557749912008-08-04T21:23:00.000-07:002013-01-26T14:28:40.868-08:00Two-dimensional zipI've been doing battle with things like CSS recently (the W3C will be first against the wall when the revolution comes,) so it was a pleasure to run into a little Haskell puzzle and an elegant solution.<br /><br />I was working with a matrix represented with a list of lists: [[a]]. I wanted to add the row and column indices to each element, giving: [[((Integer,Integer),a)]].<br /><br />This isn't a pattern I remember seeing before, but it seemed simple enough, so I just hacked away. Here's my first try:<br /><br />> index grid = zipWith indexrow [0..] grid<br />> where indexrow rn rs = zipWith (\cn r -> ((rn,cn),r)) [0..] rs<br /><br />Serviceable, but neither pretty nor general. The one dimensional case is so elegant; for any list, you can add indices with:<br /><br />> index1d xs = zip [0..] xs<br /><br />The zip function is simple and the infinite list of indices covers all cases. So it occurred to me I was looking for two things: a two-dimensional version of zip; and a grid of index tuples, semi-infinite in both directions.<br /><br />Both turned out to be simple enough. Here's the grid of tuples using list comprehensions:<br /><br />> indices2d = [[(r,c) | c <- [0..]] | r <- [0..]]<br /><br />And the two-dimensional zip:<br /><br />> zip2d = zipWith zip<br /><br />And it's easy to reproduce the "With" version:<br /><br />> zip2dWith f = zipWith (zipWith f)<br /><br />So now my function looks like this:<br /><br />> index2d grid = zip2d indices2d grid<br /><br />or just:<br /><br />> index2d' = zip2d indices2d<br /><br />This version is clearer, simpler and easily generalizable to higher dimensions.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com13tag:blogger.com,1999:blog-6919669035402552575.post-20878585854616572412008-05-29T20:45:00.000-07:002013-01-26T14:28:40.863-08:00Eschewing flipI realized recently that I've developed a small dislike of the Haskell function <span style="font-style: italic;">flip</span>, which reverses the order of arguments of a binary function:<br /><blockquote>mod 3 5 ==> 3<br />flip mod 3 5 ==> 2<br /></blockquote> <span style="font-style: italic;">flip</span> is generally used in place of a lambda expression, when constructing a specialized function:<br /><blockquote>map (\x -> mod x 17) [1..] -- with lambda<br />map (flip mod 17) [1..] -- with flip<br /></blockquote>Unfortunately, my brain really doesn't like that reversal. When reading any non-trivial expression using <span style="font-style: italic;">flip</span>, I have to stop and think about which argument is now where.<br /><br />I've found that I prefer sections. You need to have one of the arguments handy, but I find that's often the case:<br /><blockquote>map (`mod` 17) [1..] -- with section<br /></blockquote>I like this form better because it preserves the visual ordering of the arguments, which seems to be deeply seated in my reasoning process. Because of Haskell's flexibility with switching between prefix and infix application, it's easy for me to adopt a style to suit this preference.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com5tag:blogger.com,1999:blog-6919669035402552575.post-54907290670301865402008-05-13T15:06:00.001-07:002008-05-13T15:14:02.641-07:00Paul McCartney was in a band before Wings?Jeremy Shaw observed today that "Haskell is moving up in the world." His evidence was that a Google search for "haddock" now puts the Haskell documentation tool third on the list.<br /><br />I guess we'll know that Haskell is a complete and total success when we overhear some kid in a supermarket asking, "Haddock is a fish?"Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com2tag:blogger.com,1999:blog-6919669035402552575.post-32163446287096201912008-02-13T20:38:00.000-08:002008-02-13T22:36:07.230-08:00Rewinding the MindJeremy Shaw sent me <a href="http://ohgizmo.com/2006/10/01/dvd-rewinder/">this bit about a DVD rewinder</a>. Very humorous, of course, but there's also a nice little moral about programming in there.<br /><br />When I was at Linspire, we often got questions from people looking to switch to Linux for the first time: How do I defrag my disk? Where do I buy anti-virus software?<br /><br />We would explain that Linux filesystems didn't need defragmenting and that the virus problem was virtually non-existent. But sometimes, there was just no reassuring them. IT people sometimes said they simply had to have virus protection software, bought and paid for, because the company had made it mandatory for all computers. We felt a little silly, but we licensed one, shipped it and then they switched.<br /><br />I wonder how many people learning a functional language wondered how to allocate and deallocate memory like they did in C? Whether the answer is obvious or not depends on one's understanding of the semantics of the language. If you have a model of C semantics in your head and you're looking at Haskell code, you're predictions about what's going to happen are bound to be wrong.<br /><br />All these are examples of essentially the same problem. If we can't see (or otherwise sense) how a technology works, then a change in the underlying mechanism will leave us confused because our mental models are out of date.<br /><br />I tend to prefer designs that show a technology at work, such as record players as opposed to most CD or DVD players. Unfortunately, miniaturization and digitalization only make the problem worse. I suppose that's why Hollywood always has been at the forefront of computer graphics, because the audience has no idea what's going on without all the flashing lights.<br /><br />I will pursue these ideas further in some upcoming posts about functional programming and user interface design.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com5tag:blogger.com,1999:blog-6919669035402552575.post-54418920864993985442008-01-31T10:35:00.000-08:002013-01-26T14:28:40.866-08:00The Programming Grapevine<span style="font-size:100%;"><span style="font-family:Courier New;">Two non-Haskell programmers from Linspire went indoor rock climbing last night. One was wearing a Firefox t-shirt and someone next to him asked if he worked for Mozilla. He explained that he actually worked at Linspire, to which the guy said, "Oh, you guys use Haskell there, don't you?"<br /><br />It's nice to know that the word has gotten around.<br /><br />Well, David Fox and I left last summer and Jeremy Shaw has one foot out the door, so the Haskell presence at Linspire is just about over, but we continue to use and maintain many of the tools and libraries we built there. David and Jeremy have been cleaning up the version number policy in the Debian package builder (called the autobuilder) so that we can build Debian repositories of Haskell software. There is still some work to do, but you can look at our <a href="http://src.seereason.com/">darcs repositories</a> to see if there is anything that might interest you.<br /><br />To see what we're up to now, see Section 7.1.6 of the <a href="http://www.haskell.org/communities/12-2007/html/report.html">Haskell Communities and Activities Report.</a><br /></span></span>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-37364832224701581842008-01-14T21:33:00.000-08:002008-01-14T21:47:53.591-08:00Even a blind chicken finds a kernel of corn every once in a while.Translated, that means, if you take enough walks at sunset and snap enough photos, eventually you will get lucky. I took this photo this evening at Windansea beach in La Jolla:<br /><br /><div id="so57" style="padding: 1em 0pt;"><img style="width: 800px; height: 569px;" src="http://docs.google.com/File?id=dcqvq83w_19f2k486gs" /></div><br />No, it's not just a nice sunset. I mean <i>really</i> lucky. Look at this closeup of the left center of the image:<br /><div id="m9:r" style="padding: 1em 0pt;"><br /><img style="width: 800px; height: 523px;" src="http://docs.google.com/File?id=dcqvq83w_209xp4rxf8" /></div><br />That dolphin jumped only once that I saw. I just happened to press the shutter at the right time.<br /><br />If only I'd been using a real lens. The little 4X zoom lens on my Canon A630 is really at the edge of its range here.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com5tag:blogger.com,1999:blog-6919669035402552575.post-81447786310140070092008-01-14T12:40:00.000-08:002008-02-13T22:36:31.779-08:00MebbeMy friend David has always had a knack for brevity and wit, the most recent example being this snippet of Haskell:<br /><span style="font-size:100%;"><blockquote>mebbe x = maybe x id</blockquote>Not as clear as <span style="font-style: italic;">fromMaybe</span>, perhaps, but much funnier.<br /><br /></span>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-2488004332793931042008-01-06T12:55:00.000-08:002008-01-14T21:43:34.473-08:00I visited New York City at Christmas time, attending the Christmas Eve service at <a title="All Souls Unitarian Church" href="http://allsoulsnyc.org/" id="zdwd">All Souls Unitarian Church</a>, which I attended regularly growing up. I don't attend any church regularly, but if I did, this would be the one, as the ministry and congregation have a very open, rational, and gentle approach to religion. Even so, my mind generally wanders during the prayers because I find them a bit bland. My ears perked up this time, though, when Forrest Church said: "<i>Want what you have; Do what you can; Be who you are.</i>" That's a nice thought for someone who gets distracted easily by new projects.<br><br>He expanded on that idea later in the prayer:<br><blockquote><p class="western"> And let us do what we can,</p><p class="western">Not climb every mountain,</p><p class="western">But, dismissing pipe dreams,</p><p class="western">Climb one splendid mountain,</p><p class="western">Doing—not less than, not more than—but precisely what we can,</p><p class="western">That our life may be filled with attainable meaning. </p></blockquote> In the light of the new year, it seems a bit bland, but I guess that's the way of prayers: they resonate with your emotions. I was decompressing from my pre-Christmas rush to complete some projects and this caught me like a rogue wave. Here's the <a title="full text of the prayer" href="Doc?id=dcqvq83w_15fwk2h8gd" id="f6wa">full text of the prayer</a>.<br><br>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-71631465080323907742007-12-02T23:03:00.000-08:002008-02-13T22:36:50.844-08:00Slouching Towards BethlehemAfter 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. <a href="http://codenoise.com/2007/12/functional-invasion"> Read how a book on Erlang</a> got him excited about FP.<br /><br />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."<br /><br />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.<br /><br />At <a href="http://cufp.galois.com/">CUFP</a> 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. (<a href="http://cufp.galois.com/2007Abstracts.html#AnwarGhuloum">Intel is betting on it.</a>) 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.<br /><br />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.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-13303198485136444632007-12-02T22:40:00.000-08:002008-12-10T04:15:16.789-08:00Shifting Sands of La JollaFinally, 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.<br /><br /><br /><div style="text-align: left;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFOzJwYJaU70tSDmt8dN5ZmpOib05PGOsP_rpJFWoACfMjMehiM7wz1tQRShTrLTbZsD_GaccQmDPaBqvWbx40K4g76fTYZ2wuoS8iWyAuMbf8jyw4MT4k3PutCr4KGgzzJIHKbUjYPTE/s1600-r/IMG_4155.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgADFXjG72xeQRfJZ8x-IFKLRqZ0rq51wghjqi6zGtJx3NMtZXE-X1zElIN6KcPI1GPOeLHz2sdCjjb_ilzCaXChFcfo7PMyL15RvSE1YT9TkbvFGe3n2nhpt1ZY6cimBnQSNfPHF5wh3I/s400/IMG_4155.JPG" alt="" id="BLOGGER_PHOTO_ID_5139636661449455426" border="0" /></a><br /></div><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXtG7FXqUIF3PTlH4mndqUZ_2DLOCbWWffUKfLE4fY79Yywb5VlQDxEzfatvfRy17828iP_ujrmOdu9B3HfGyykKgvEA0YdV799ViBYa2_WMmZ0shcpzkOAFPVY0Ci1yhzF3DC55aCvgE/s1600-r/IMG_4160.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjb3-6QTrhNyTk6NaIxLJpojnP206pSkOwcBYbJE7J-7YkLys7YzXC1djVKVuhGV_wUkZ8wvH5uB0p3HOsIrpAaa-fsWUXGvcevftiGxvdksC134RTZHMEwMuEiRCcHOelCBBbFqcG58dU/s400/IMG_4160.JPG" alt="" id="BLOGGER_PHOTO_ID_5139636674334357330" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi01Y6eaPajXRR84gBi1aPBfZYEKBCkW2W7mr9xE0tnryrReuEOx2XK8yI4z2yQtDtfs8Qwfs3w_JAypQxEJbNF5jqBsNnao3ZFXi337G-brp88MTKKun83bF8mvsYRBqgismb6C0LLptw/s1600-r/IMG_4173.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQQqpnZS3ZIUBIvcToWJ0j2GLcgJR910TJBeECa-_2O6yJ9BIy3vdg-htNGWjNNK3Hc8GAXhkUK2bSu3mNgCdeFDRdjL9sOoMMxdl7mBBs7WDILm9m8Nu9k2V6s16qUwXCZg1BCtlZhZs/s400/IMG_4173.JPG" alt="" id="BLOGGER_PHOTO_ID_5139636691514226530" border="0" /></a>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com0tag:blogger.com,1999:blog-6919669035402552575.post-83181124174144614902007-11-29T21:31:00.000-08:002008-12-10T04:15:17.046-08:00Functional Programming MarketingFollowing the discussions at CUFP about how to achieve broader adoption of functional programming, I had my car tricked out for some direct advertising:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA0ev2H9-50EnH78tYE0XLu9uwM9AGHyAcSbNCJUKgOqSfJVWucvTTFp4jsKJAHmuXRB88zd4IsCutGaB8UZhPVVywYmBciEI1_qwbGLyOpELuLVmStlgcCQAIcNok66cfAcurM7RoDSU/s1600-r/FunctionalProgramming.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYwQKOuCMDog11u5hx4gqkmP_BZ2_EkvnlVgH__qUmu_oe5KsKWP5TpnLYKu2o-8G9E-bwnzZNKGBvcB9-4zGlbfEQdBh2hCd7qqE0crqrjiWBoUYmGmkl3APM9Bd7TY8Ml70dg870Jng/s400/FunctionalProgramming.jpg" alt="" id="BLOGGER_PHOTO_ID_5138505242692202226" border="0" /></a><br />Okay, I confess. But it was so close:<br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZohKWSNxDYl7mm7Qr8AMiIiYo-gpY5Yhn-mDgyB80dbg-ymXxtdpqzr-7IGmsYcmuEZQ7Xxz7FbqBn184G-k8N-mIw039YAwH7Sdot50YoCfgRBu-5dQ4k4GxNJAdhVgq19SAPBu-0pk/s1600-r/FunctionDrinks.jpg"><span style="font-weight: bold;"></span><br /><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4hSpaD8EdTPdQ83gHEAws3bdL_vQIX1LP23OmDv2W9fiSEH-DadNLEDqvTC5LJ0oUjVOGPZYTRMqwqVVD5YwNsbv6Tljd2AyGWv5KEFj8LcILXTw7tAVSuwInb0d5U1X0kwYkC5BSg_8/s400/FunctionDrinks.jpg" alt="" id="BLOGGER_PHOTO_ID_5138505478915403522" border="0" /></a>Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com1tag:blogger.com,1999:blog-6919669035402552575.post-63963078535095219802007-11-27T09:24:00.000-08:002007-11-27T16:37:46.787-08:00Futurama on Type InferenceI 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 <a href="http://www.wired.com/entertainment/hollywood/magazine/15-12/ff_futurama?currentPage=1">excellent article</a> pairing a history of the show (past, present <span style="font-style: italic;">and</span> 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.<br /><br />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.<br /><br />A personal favorite, and one I think all functional programmers will enjoy, is this little gem about narrowing types:<br /><b></b><blockquote><span style="font-weight: bold;">Moon farmer:</span> Yep, goes down to -173 degrees.<br /><span style="font-weight: bold;"> Fry:</span> Celsius or Fahrenheit?<br /><span style="font-weight: bold;"> Moon farmer:</span> First one, then the other.<br /></blockquote>Hats off to Futurama for making math funny.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com2tag:blogger.com,1999:blog-6919669035402552575.post-85071429314895646232007-11-18T19:47:00.000-08:002007-11-18T20:34:35.752-08:00Data: 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.<br /><br />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."<br /><br />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 '<span class="blsp-spelling-error" id="SPELLING_ERROR_0">newtype</span>', both apparently singular, but then, each constructs exactly one type. So I have to wonder, is "data" in this context also singular?<br /><br />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.Anonymoushttp://www.blogger.com/profile/07441435909838565635noreply@blogger.com8