Sunday, July 06, 2008

poison ivy

I have a bad habit. When I walk through a place with lots of bushes and trees, I'll absentmindedly
tear a leaf off a tree or bush and tear it up slowly while I'm walking.
I don't like that I do it, because it seems rather destructive. I just
don't think about it much.

In CA, we have poison oak. In the summer it looks like this:
I'm very careful not to touch it, as I'm quite allergic. I had it
bad once in 7th grade, and I've been very careful since.

In Pittsburgh, they don't have poison oak. They have poison ivy. I didn't know
what it looks like until this week, when I started getting rashes
on my wrists, neck and back. For those of you who are moving from CA to the east, this is what poison ivy looks like:
It's really not a good idea to pick these leaves and tear them
to little pieces. Take it from me.

It's actually fascinating how it works. The oil from the leaves somehow modifies the proteins of the skin cells into which it comes in contact. The proteins it modifies are responsible for notifying your immune system that the cell is indeed part of your body, and
is not a foreign object. Once the oil manipulates the protein, your body can no longer tell
that your own skin is part of your body, and starts attacking it. Miracles of evolution abound.

PS: If you've never read them, Steven Jay Gould and Loren Eisley's books are filled with such facts and anecdotes.

Saturday, July 05, 2008

Shell award


I just won 92K British pounds from the "Shell
Petroleum Company of England"! I'm even more excited, because
when they write the number in decimal, it was 92,000,000.00
so I think they really mean I won 92 *million* pounds. I just
need to contact the "fiduciary agent" with my email address, bank
account and credit card numbers to claim my prize. They're
throwing in a beautiful Russian mail-order bride as well. So long
grad school...

Friday, July 04, 2008

Typing SML values

I recently spent a few weeks learning the basics of Haskell.
One of the many strengths is the ability to give the types
of functions in a structure. This seems like a necessary
feature, but it is lacking in SML and O'Caml. For instance,
in Haskell I can write

incr :: Int -> Int
incr x = x + 1

In ML I'd either write

fun incr x = x + 1

and hope I can do the static typing in my head, or else
the horrible

fun incr (x : int) : int = x + 1

Note that it is possible to give incr a type in a
signature, but if I don't want to expose incr (it's
just used in the implementation), I'm out of luck.
While this example may not be entirely convincing, when
functions take many arguments, and are nested, it becomes
increasingly difficult to do mental type checking.

A hack to do this in SML is

fun incr x = x + 1
val incr : int -> int = incr

in O'Caml

let incr x = x + 1
let incr : int -> int = incr

Granted, this is not nearly as nice, but ML will catch
type errors this way.

Monday, May 26, 2008

repeating history

"We have learned, a little late no doubt, that for states as for
individuals real wealth consists not in acquiring or invading the
domains of others, but in developing one's own. We have learned that
all extensions of territory, all usurpations, by force or by fraud,
which have long been connected by prejudice with the idea of 'rank,'
of 'hegemony,' of 'political stability,' of 'superiority' in the order
of the Powers, are only the cruel jests of political lunacy, false
estimates of power, and that their real effect is to increase the
difficulty of administration and to diminish the happiness and
security of the governed for the passing interest or for the vanity of
those who govern..." Talleyrand 1754-1838

Saturday, May 17, 2008

Parsing first order logic

I'm translating some of John Harrison's textbook code
to Haskell. I thought I'd try Happy, Haskell's "yacc",
for parsing instead of Harrison's combinator parsers.

Since both formulas and terms can be parenthesized,
I ran into trouble with the following:

(P) meaning "the propositional variable P"
(c) meaning "the term constant c"

Then I have a reduce reduce conflict, eg. in the following cases

(P) /\ Q
(c) = 5 /\ Q

It occurred to me that even something as simple as the
following dumbed-down grammar is not LR(1) as far as I can tell:

T is "terms" and F is "Formulas"

T ::= var | ( T )
F ::= var | ( F ) | T = T

I can't think of a way to make this LR(1). In fact, it seems it's
not even LR(k), as (c) could just as easily be (f(1,2,3,...,n) = 5).
Thus I think my 'happy' experiment is a failure. Of course, with a backtracking
combinator parser this is easily remedied.

Tuesday, May 13, 2008

Nouns and Adjectives

Florian and Fulya were playing an interesting game today: name all
the words you can(excluding colors and homonyms) that are both adjectives and nouns. They got 10 in 30 minutes. It took me longer. Maybe being a native
speaker is a disadvantage...

Update: Emily thought of 8 in about 5 minutes. Maybe it's just me
who's bad at this game. Or maybe it's native speaking *men*...

Sunday, March 23, 2008

Little, Big

I just finished the novel Little, Big by John Crowley.
I originally heard of it while reading the Wikipedia article
on Harold Bloom. It's a beautiful book, with language
as rich as anything I've read. I tend to mark particularly
good passages in books with those little postit flags, a practice
I highly recommend, as it doesn't damage the book. I was so surprised at much
of the prose that I have about 40 within the
first 200 pages. I noticed with delight that Crowley himself has
a similar practice.

Monday, November 26, 2007

Un Air de Famille


Another good French movie about family relationships. I find
the reviews extremely irritating that dwell on its comic aspects.
In homage to Shakespeare, the comedy makes the tragedy bearable.
A moving drama with sweetness and humor.

Ressources Humaines




I saw an intensely good movie over the weekend called
Ressources Humaines
about a father and son working at a factory in France. The son
is about to graduate from business school, and is doing an internship
for the administration in a plant where his father works as a laborer.
There is a clash between the administration and the union, and the
result is a real and moving clash between generations and ideals.

Ressources Humaines


I saw an intensely good movie over the weekend called
Ressources Humaines
about a father and son working at a factory in France. The son
is about to graduate from business school, and is doing an internship
for the administration in a plant where his father works as a laborer.
There is a clash between the administration and the union, and the
result is a real and moving clash between generations and ideals.

Wednesday, November 21, 2007

recent conversation

F: I'm very busy writing my thesis.
S: Wow, you're writing already?
F: I'm writing in the sense that I'm feeling worse and worse for not starting.

Saturday, October 20, 2007

SAVE

Funny story:

Conway wrote an assembler for the Burroughs 220 called SAVE. The name SAVE was not an acronym, but a feature: programmers lost fewer card decks because they all had SAVE written on them.

Friday, October 19, 2007

Liberty Cabbage

I'm slowly making my way through my high school U.S. history book.
It turns out that our modern "Freedom Fries" have an even more ridiculous
precursor. During WWI, we were calling sauerkraut "Liberty Cabbage".

zone

In emacs, try



(require 'zone)
(setq zone-idle 120)

(setq zone-programs '(zone-pgm-whack-chars
zone-pgm-five-oclock-swan-dive
zone-pgm-martini-swan-dive
zone-pgm-drip
zone-pgm-drip-fretfully
))

(zone-when-idle zone-idle)


These are hilarious. Especially the drip-fretfully.

Friday, September 14, 2007

ML Puzzle

How do you handle exceptions raised at the structure level?

e.g.

structure A = struct val _ = raise Fail "" end


Turns out there are implementation dependent ways to
set a top level exception handler. Sadly, not part of
the Basis.

Monday, June 25, 2007

The Heiligenstadt Testiment













This is the most utterly devastating letter I've ever read. There are many tragedies in the history of art and science. In music Mozart comes to mind. In mathematics Galois and Abel. The tragedy arises in different ways. Some people die too early, depriving all people to come of the lost works of their genius. Mozart is the most crushing example of this kind of tragedy. But from what I know, he doesn't seem to have been particularly unhappy. Beethoven, in contrast, didn't die particularly early. But from the age of 20 until his death in 1827 at age 57, he was almost totally deaf. 37 years of silence to one of the greatest benefactors to mankind the world will ever know. When I feel disappointed in life, I need only think upon this letter to put my sorrow into perspective.

Saturday, June 23, 2007

Thursday, June 14, 2007

Same Sex Marriage

Happily, the Congress of Massachusetts shot
down a potential amendment to the state
constitution declaring marriage to be between
a man and a woman. According to the NY Times,
the soonest such a petition could be brought
for a vote is 2012. My favorite line of the article:

Senator Gale D. Candaras, a Democrat, voted against the amendment Thursday, although she had supported it as a state representative in January. Ms. Candaras said her vote reflected constituent views in her larger, more progressive Senate district and her fear of a vicious referendum campaign.

Most moving, she said, were older constituents who had changed their views after meeting gay men and lesbians. One woman had “asked me to put it on the ballot for a vote, but since then a lovely couple moved in,” Ms. Candaras said. “She said, ‘They help me with my lawn, and if there can’t be marriage in Massachusetts, they’ll leave and they can’t help me with my lawn.”


Indeed, the biggest indicator of a change toward
pro-Gay rights was if the congressperson had got to
know gay people. Go figure...

Mac not sleeping fix

My Mac stopped going to sleep one day.
It would if you closed the lid, but never
while open, even if nothing but
the Finder showed up as a running program.
I did some experimenting with killing
background processes from the Activity Monitor,
and found that killing the XXX_ButtonManager
processes did the trick. I kill them every
time I restart, and the Mac sleeps like a baby.

Thursday, June 07, 2007

Gunter Grass

has written a great essay for the New Yorker about his youth during WWII as
a young soldier.