The Quality Without A Name

2005/07/25

Paul Graham’s Accumulator Generator, in PostScript

Filed under: Uncategorized — mayoff @ 6:45 pm

In Revenge of the Nerds, Paul Graham defines the accumulator generator problem. Solving it requires using a programming language that has, or can simulate, closures and a polymorphic add function. He presents solutions in a number of languages, submitted by various people.

He’s no longer accepting solutions, but I managed to solve it in PostScript anyway:

/make-adder {
    [ exch
        [ exch ]
        {
            dup 3 1 roll
            0 get add
            dup 3 1 roll
            0 exch put
        } /exec cvx
    ] cvx
} def

You can test it out in Ghostscript. For example:

GS>/x 1 make-adder def
GS>5 x ==
6
GS>/y 3 make-adder def
GS>2.3 x ==
8.3
GS>.7 x ==
9.0
GS>10 y ==
13

2005/07/13

Dell 2405FPW

Filed under: Uncategorized — mayoff @ 2:52 pm

At my office I’ve been connecting a Sony 20″ 1600×1200 LCD monitor to my Powerbook. However, this only lets me put two 80-column Terminal windows side-by-side. There’s more horizontal space, but not enough for a third 80-column terminal. (Not at my preferred font size, anyway). So I ordered a Dell 2405FPW, which is 24″ and 1920×1200. It has enough room for a third terminal.

Most of the other LCDs around the office are Apple displays, but the Dell displays have a few advantages. First, they’re cheaper. Second, the Dell stands are much more flexible. Third, the Dells have four USB ports. Fourth, the Dells support VGA, S-Video, and composite video inputs in addition to DVI. The 2405FPW also supports component video and has four memory-card reader slots. The only advantage of the Apple monitors is that they have a Firewire hub, but nobody here needs that.

My 2405FPW arrived Tuesday. The stand is height-adjustable and rotates, unlike the Apple stand. In addition, it supports rotating the monitor 90 degrees, into “portrait” orientation. MacOS X supports this (you set it in the Displays system preference pane), so I decided to try it just for fun.

It turns out that this is totally awesome. Here’s what it looks like:

Powerbook and 2405FPW

I actually had a sense of vertigo looking at the monitor this way. The viewable area is about 20.5 inches tall. What sold me on this arrangement is that I can now get four tall (57-line) 80-column terminals on the screen with no overlap:

Powerbook and 2405FPW with terminals

Blog at WordPress.com.