Blog: 2007-01

Latest  2010  2009  2008  2007  2006  2005  2004  2003  2002  2001
-12  -11  -10  -09  -08  -07  -06  -05  -04  -03  -02  -01

Checking In

I spent the last two weeks starting a new full-time contract at a certain software company here in Cambridge that is notorious for "hiring everyone" from MIT lately.

Before starting, I'd mentioned to an aspiring screenwriter I'd just met that the work involves using an esoteric computer programming language to develop some large software for the airline industry. Of course she'd seen the latest recruiting campaign posters on the T, and she immediately asked if it was with the guys "gazing wistfully at model airplanes." I conceded it was. That campaign was definitely better than the puzzles one, which unfortunately came off as second-rate Google wannabe.

As a matter of practice, I don't like to talk about companies I work for -- except in this case to say (in a tone of astonishment) that I'm getting paid to hack Lisp, and that I work with a lot of smart people.

If you're interested in working for them, I might get a kickback if I'm the one to submit your resume.

Oh, I forgot a little TMI... It's been a rough first couple of weeks, mostly due to the amount of domain knowledge I need to get up to speed on, but also because I started off with a sleep deficit. The night before my first day, I managed to strain a sensitive area badly (like you can do lifting a heavy object, kicking above your head, etc.), and as a result only got 45 minutes of sleep before my first day on the job. I've had groin strains before, and this was much worse. Had the next day not been my first day, with training scheduled and everything, I would've gone to the ER, since I was concerned that I might have testicular tortion. Don't laugh -- it's a medical thing, and a serious matter! I figured I'd rather be in pain all day than get off on the wrong foot at the new job by missing the first day, and also I didn't want to present myself at the hospital to be felt up by interns on the overnight shift unless I was absolutely certain I had to. After the first day, I looked up testicular tortion on the Web, and found that, if I had it, the few-hour window for an ER visit had already passed and that organ might as well be written off. I focused on my work that week, with only moderate soreness, and maintained a good sleep deficit. Writing two weeks later, everything seems intact, I'm sure you're relieved to know.

I'll write something more interesting later. Since starting the job, I've done nothing but work and sleep. And spend a pleasant weekend with M., so maybe I'll find time to post some restaurant reviews.

New Version of SICP Texinfo

There's a new version of SICP in Texinfo Format. This version adds @dircategory and @direntry directives, courtesy of Brad Walker.

Web Standards and Unsupported IceWeasel

Just encountered the first IceWeasel 'compatibility' issue since I 'upgraded' from Firefox (see 2007-01-09).

This orneriness of AOL might be triggered to IceWeasel sending an HTTP User-Agent header of:

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061205 Iceweasel/2.0.0.1 (Debian-2.0.0.1+dfsg-1)

In an ideal world, sites would employ only open standards and rely on protocol for interoperation. The error message from the AOL site suggests that they are special-casing particular Web browsers and refusing to permit interaction with any other browser, even if another browser implements the necessary protocols as well or better than some of the "officially supported" browsers. Bureaucracy should not be conflated with protocol.

I'm picking on AOL AIM Express here, since they're the first and only site I've found thus far that outright refuses to work with IceWeasel. However, it should be noted that special-casing for specific browsers is unfortunately commonplace. Perhaps the root cause of browser special-casing was the early standards-indifferent zeal of Netscape (nee Mosaic Communications) and Microsoft.

Firefox and IceWeasel

Please restart any running Iceweasels, or you will experience problems.

—Debian iceweasel package installation

I just upgraded from Debian package firefox to Debian package iceweasel on one of my boxes.

I really wish that Debian and Mozilla.com could resolve their differences. I don't like the fragmentation, and I don't like running something called "IceWeasel".

At the same time, the fact that Firefox can be forked to Iceweasel demonstrates a strength of open source software.

Tufts Historian Felipe Fernandez-Armesto Does Atlanta

See the video interview under heading "Day 3: Saturday January 6, 2007" Rick Shenkman's notes on the 2007 Annual Meeting of the American Historical Association.

Initially, I looked at the page curious about the circumstances of an academic I'd heard had been arrested for jaywalking. The video interview is simply captivating. I was as much caught up in Prof. Fernandez-Armesto's poise and mannerisms as with the content of his account. Watch at least the first of the three video segments, and you might see what I mean. Who knew these charming characters actually existed.

Scheme and Jeff Palm's Foxtrot Blackboard Examples

With Scheme would he have done better?

http://www.jeffpalm.com/fox/

Not really, since Scheme's power doesn't gain you much for this extremely simple problem. However, I implemented a few quick solutions over dinner using the rather minimal R5RS dialect of Scheme, just for illustration...

First, if this trivial problem were part of a larger algorithm, I might start out with a named-let:

(let loop ((count 500))
  (if (not (zero? count))
      (begin
        (display "I will not throw paper airplanes in class.")
        (newline)
        (loop (- count 1)))))

It looks verbose, but it lends itself to refactoring hairy algorithms into tail-recursive control structures that fit well with Scheme's linguistic constructs and execution model.

R5RS also provides do syntax, which could be used like:

(do ((count 500 (- count 1)))
    ((zero? count))
  (display "I will not throw paper airplanes in class.")
  (newline))

I virtually never use do in real code, since it obscures some opportunities for refactoring.

Of course, languages that provide a FOR-NEXT iteration construct might at first seem more elegant than Scheme. In real-world problems, however, uses of FOR-NEXT are often combined with things like premature exits, redundant conditional tests, mutations, etc., that can obscure a better form of the algorithm. However, if we really wanted a special syntax that helped us solve this problem, we could write a hygienic macro:

(define-syntax do-n-times
  (syntax-rules ()
    ((_ COUNT BODY0 BODYN ...)
     (do ((i COUNT (- i 1)))
         ((zero? i))
       BODY0 BODYN ...))))

This macro could then be used to implement a solution:

(do-n-times 500
  (display "I will not throw paper airplanes in class.")
  (newline))

Or, since the problem is not explicitly specified, we might be able to provide solution output in the form of a Lisp s-expression list of strings. For example, if we had a procedure make-list that accepted an integer for the desired size of the list and an object with which to populate each element of the list, we could do:

(make-list 3 "ho")

which would yield:

("ho" "ho" "ho")

So, a solution to our original problem would be:

(make-list 500 "I will not throw paper airplanes in class.")

make-list isn't actually part of the R5RS specification, but we can define the procedure in terms of R5RS:

(define (make-list size element)
  (let loop ((size   size)
             (result '()))
    (if (< size 1)
        result
        (loop (- size 1) (cons element result)))))

If that looks a little convoluted, that's because the code has been structured to take advantage of Scheme's tail-call optimization.

This is the kind of exercise that makes many Common Lisp hackers roll their eyes. In Scheme, there's always a number of purist ways to implement your solution from scratch, using precise, elegant, simple tools. Common Lisp, on the other hand, puts at your disposal an entire workshop of time-tested industrial-strength multi-function power tools. Some of the Common Lisp tools are battle-scarred, or for historical reasons have odd, complicated attachments, but they usually get the entire job done faster than anyone else.

I've just accepted a new contract involving Common Lisp, so I'll be doing a lot less Scheme and a lot more CL (or, as we CLers call it, simply "Lisp").

Wesley Autrey

Great story, great photo (despite the logo on the cap).

Cara Buckley, "A Man Down, and a Stranger Makes a Choice," New York Times, 2007-01-03

Winter Beverage: Ah!Laska Organic Cocoa

If you like cocoa but are trying to avoid caffeine and milk, a passable subsitute is Ah!Laska Organic Cocoa. In Cambridge, MA, it's available at Harvest Co-op.

See also 2006-09-30.

Earlier to... 2006-12

© Copyright Neil Van Dyke      Contact