Monday, December 29, 2008

Should you buy books on Ebay?

Some interesting consequences.  I don't know what to think of this.

Deadweight loss

Interesting article about deadweight loss at Christmas.  I've always thought gift certificates or cards are a bad present.  I was wrong.
Intrigued by this mismatch between wants and gifts, in 1993 Joel Waldfogel, then an economist at Yale University, sought to estimate the disparity in dollar terms. In a paper* that has proved seminal in the literature on the issue, he asked students two questions at the end of a holiday season: first, estimate the total amount paid (by the givers) for all the holiday gifts you received; second, apart from the sentimental value of the items, if you did not have them, how much would you be willing to pay to get them? His results were gloomy: on average, a gift was valued by the recipient well below the price paid by the giver.
The most conservative estimate put the average receiver's valuation at 90% of the buying price. The missing 10% is what economists call a deadweight loss: a waste of resources that could be averted without making anyone worse off. In other words, if the giver gave the cash value of the purchase instead of the gift itself, the recipient could then buy what she really wants, and be better off for no extra cost.
Non-cash gifts from extended family were found to be least efficient
Perhaps not surprisingly, the most efficient gifts (those with the smallest deadweight loss) were those from close friends and relations, while non-cash gifts from extended family were the least efficient. As the age difference between giver and recipient grew, so did the inefficiency. All of which suggests what many grandparents know: when buying gifts for someone with largely unknown preferences, the best present is one that is totally flexible (cash) or very flexible (gift vouchers).

Sunday, December 28, 2008

Obama and Warren

A cogent post about Obama's choice of Rick Warren for the inauguration.

By the historical standards of presidential hubris, Obama’s disingenuous defense of his tone-deaf invitation to Warren is nonetheless a relatively tiny infraction. It’s no Bay of Pigs. But it does add an asterisk to the joyous inaugural of our first black president. It’s bizarre that Obama, of all people, would allow himself to be on the wrong side of this history.

Obama and exercise

I just keep liking this guy more and more.
It's a schedule he started as a 22-year-old student at Columbia University in New York, and it immediately transformed him. In his 1995 autobiography, "Dreams From My Father," Obama said he was a casual drug user and an underachiever until he decided to start running three miles each day. He stopped staying out late, fasted on Sundays and became a voracious reader, spending most of his time alone in his apartment reading classic literature and philosophical texts.
Physical fitness yielded mental fitness, Obama decided, and the two concepts have been married in his mind ever since.

Saturday, December 27, 2008

Drugs and doctors

A damning book review, written by an editor of the New England Journal of Medicine, against the medical profession and pharmaceutical industry. 

The problems I've discussed are not limited to psychiatry, although they reach their most florid form there. Similar conflicts of interest and biases exist in virtually every field of medicine, particularly those that rely heavily on drugs or devices. It is simply no longer possible to believe much of the clinical research that is published, or to rely on the judgment of trusted physicians or authoritative medical guidelines. I take no pleasure in this conclusion, which I reached slowly and reluctantly over my two decades as an editor of TheNew England Journal of Medicine.
The medical profession is truly losing the trust of the public.  Consider the rising rate of people opting out of immunizing their children.  After reading articles like this, you can almost sympathize.

Thursday, December 18, 2008

Anthony McGill is playing at Obama's inauguration

A great clarinetist I went to high school with is playing at Obama's inauguration with Yo-Yo Ma and Itzhak Perlman. 

Sunday, December 14, 2008

Bubbles

Fascinating article about financial bubbles and human psychology, complete with experiments.

Saturday, December 13, 2008

Austenbook

http://www.much-ado.net/austenbook/

Mouse euthanasia

There was a mouse in my kitchen sink this morning.  I trapped it in a yogurt container.  I'm not sure what to do with it.  I looked up "humanely kill mice".  I found a surprising amount of literature.  Apparently freezing (I was going to just leave it outside in the trash) is not recommended.  Apparently it's very painful.  I think I'm going to try a small animal gas chamber.  Seems simple enough.  Kind of like a science experiment too.  I don't have the guts to grab it by the tail and bang it against a table, as most people suggest.

.....

Hmm.  Not sure I'd recommend that method.  I just put the yogurt container in a big ziploc bag with a glass of vinegar.  Then I undid the lid, and dropped about a tablespoon of baking soda into the vinegar. I was very surprised to see how much CO2 came out.  The gallon ziploc was full within about 5 seconds. It definitely did the trick, but perhaps it's a little elaborate.  I should have just put a mousetrap in the sink.

Monday, December 08, 2008

Funny

From the Wikipedia article on AJAX (Asynchronous Javascript and XML):

"Despite the name, the use of JavaScript and XML is not required, and they do not have to be used asynchronously."

Sunday, December 07, 2008

svn peg revisions

I needed a peg revision for the first time today.  I deleted a directory from a repository, say foo at revision X, and created a new one with the same name.  Then I deleted the new one and wanted the old one back.  I'm now at revision Y.  When I tried to

svn copy -r X foo ./foo

I got the error

svn: File not found: revision Y, path 'foo'

What a strange error message!  Why revision Y?  Anyway, svn is confused.  The solution is

svn copy -r X foo@X ./foo

Friday, December 05, 2008

Alice Walker to Obama

http://www.theroot.com/id/48726

Monday, November 24, 2008

Bhargava

A nice interview with Princeton mathematician and musician Manjul Bhargava

Tuesday, November 18, 2008

Bach Cantata Pilgrimage

"Study Bach.  There you will find everything."  -Brahms. 
"Not Brook (Bach), but Ocean should have been his name." -Beethoven
 
I recently got ahold of about a third of the Bach cantatas from John Elliot Gardiner's "Pilgrimage" project.  It is supurb, far better than the other two sets of cantatas I've heard before.  I've written before about cantata BWV 106, which is impeccable in this collection.  I'm also listening to some I've never heard before.  BWV 33 jumps out at me as another great example.  The rousing first movement theme culminates in a simple hemiola, that is so incredibly effective I smile just thinking of it.  I don't often wish I played the oboe, but I certainly do now.

Why a Detroit bailout is a terrible idea.

http://online.wsj.com/article/SB122669746125629365.html

I agree completely, especially with the oft given rationale that it would allow GM to retool to build fuel efficient vehicles.  "It's like asking the cigarette industry to help with cancer research".

Update:

Here's another one.  I hadn't heard of Leyland.  Perhaps the WTO may actually keep us from doing something stupid this time, rather than keeping us from protecting sea turtles. 

http://www.nytimes.com/2008/11/18/business/economy/18car.html?em

Update:

Yet another, from Mitt Romney.  I haven't agreed with anything he's said since his presidential campaign.

http://www.nytimes.com/2008/11/19/opinion/19romney.html?em

Monday, November 17, 2008

KDE menu bar

If the menu bar disappears in a KDE app, you can recover it by hitting Ctrl-m.

Saturday, November 15, 2008

Coach

Great coach story.

Inspiring guy

http://www.nytimes.com/2008/11/14/sports/othersports/14haverford.html?em

Thursday, November 13, 2008

Malik Rahim

Last night I went to an awards dinner for the Thomas Merton Center.  The main award recipient was Malik Rahim, a community organizer from New Orleans.  The stories he had to tell were horrific, but the speech overall was empowering.  Mostly he stressed getting involved in social justice work where you are. 

Wednesday, November 12, 2008

Cannonballs

A nice essay from an inspiring outdoorsman.

Like, totally

Nice article about using "like" in modern English, and how it's really not that bad.

Tuesday, November 11, 2008

The Irrelevant South

A very upsetting article about the racist South.  The only silver lining is that the South is becoming increasingly irrelevant in politics.  It's almost a shame how much they will benefit from the expected expansion of infrastructure and social services.

Sunday, November 09, 2008

Evil

If only there were evil people somewhere insidiously committing evil deeds, and it were necessary only to separate them from the rest of us and destroy them. But the line dividing good and evil cuts through the heart of every human being. And who is willing to destroy a piece of his own heart?

-Solzenitzen, The Gulag Archipelago

Friday, November 07, 2008

The Problems of Philosophy

I'm reading The Problems of Philosophy by Bertrand Russell.  It's a pleasing introduction to some of the basic problems.  The jargon is minimal, and the explanations are, I think, as clear as could be hoped for.  The final chapter, The Value of Philosophy, which I read first for its catching title, is a good place to begin if you are tempted to think, as I was, that philosophy has little of value to offer us today.

Tuesday, November 04, 2008

iPod fiasco

My iPod had a little accident while I was home in CA for my grandfather's funeral.  It was raining for the first time in six months, and I happened to be out doing errands.  Somehow, my iPod managed to fall out of my pocket while I was getting in the car.  The door closed on the cord though, and I didn't notice.  I then proceeded to drag the ipod along the pavement and through big puddles for 3 blocks or so.  Surprinsingly, the ipod structure didn't look damaged, but all the water did its work, and after a few death throes (flickers), it became a no longer I-functioning body.

I got a new iPod the next day.  Besides CoverFlow, which is truly annoying, the new iPod nanos are nice.  I also discovered a good auction site, uBid, something like ebay, but for new things.  There I got a Macally mirage cover for it.  It's very nice.

Monday, November 03, 2008

Unison Aborted

I use the Unison file synchronizer extensively.  I was very disappointed when I was recently trying to copy a directory structure I copied from a cd lately.  I ran unison, and it failed with the sole message "Aborted".  No file or directory name, no hint to the problem.  After much frustration, I finally found the problem.  The Windows machine that made the cd had for some reason created a bunch of files beginning with a ".".  (perhaps for indexing purposes?)  After deleting these files with

find . -name "\.*" -exec rm -f {} \;    

Unison worked correctly.  Why couldn't they issue a reasonable error message?

Update:

Turns out those '.' files were "Resource forks", a Mac HFS relic.   If you
add "rsrc = false" to the profile, it will ignore the offending files.

Sunday, October 26, 2008

Saturday, October 25, 2008

Methane Clathrates

Yet another frightening aspect of global warming.

What an idiot

From today's NY times article. 
 
As is often the case when stocks fall steeply, the market is starting to entice some investors, many of whom say they have never seen prices so low, to buy. Among them is Mr. Grantham, the GMO chairman.

After years of warning that stocks were unreasonably overpriced, he said he now believed they were below their fair value and had been slowly acquiring holdings in blue-chip companies.
“It’s a very nerve-racking time to be a value investor,” Mr. Grantham said. “You put a little bit into the market, and the next day you think, ‘What an idiot, what an idiot.’ ”
After hearing Warren Buffet and Jeremy Siegel say "buy now", I thought, who am I to disagree with those guys?  At least Mr. Grantham can made me smile.

Wednesday, October 22, 2008

Voting machines II

http://www.democracynow.org/2008/10/22/votes

Why oh why can't we have a better voting infrastructure?

Voting machines I

OK, this is a little better than nothing.  It is still pathetic.  Instead of congratulating themselves on a test of 10 machines, they should start to take this seriously and require paper trails and random post
election audits.

http://www.post-gazette.com/pg/08296/921755-470.stm

Monday, October 20, 2008

Thursday, October 16, 2008

Wednesday, October 15, 2008

Calibrate your battery

I think it should be more well known that you need to calibrate your laptop battery.  I saw today that the capacity is down to %89.  Calibrating is simply a matter of totally discharging the battery, then turning it off for a few hours, then rebooting.  

Tuesday, October 14, 2008

Don't update to Aquamacs 1.5

If you use fullscreen mode on multiple monitors, Aquamacs 1.5 is broken.  The second monitor won't go to full screen.  Luckily, you can still download 1.4 from the historical releases page.

Saturday, October 04, 2008

Thursday, October 02, 2008

Mia Farrow in Darfur

Mia Farrow has posted, in addition to her blog has posted a slideshow of her
time in a Darfur refugee camp.  This is one of the fascinating images.

Camel spiders

Nicholas Kristof wrote that the two scariest animals in nature are polar bears and camel spiders.  I'd never heard of camel spiders, so I looked them up.  Yep...  no exaggeration.  If you're brave, try camelspiders.net.  I'm not including a picture.  You'll see why.

Wednesday, October 01, 2008

space(s)?

I corrected a sentence in a book a friend is writing:

"... for various kinds of real and complex vector space ..."

I said this should be

"... for various kinds of real and complex vector spaces .."

Interestingly, he pointed out that it is a British/American English difference.

Ian Hibell

Here is a inspiring story about Ian Hibell,  who made his way all over the world on a bike. He was recently killed, after making his way the equivalent of 6 times around the equator, by some Greek jackass racing around Athens.

Monday, September 29, 2008

Sunday, September 28, 2008

Henry DeYoung

There is a good article in the Post Gazette today about Henry DeYoung, a fellow graduate student at Carnegie Mellon.  In fact, we have the same adviser, Frank Pfenning.  I'm in a course that is being videotaped so he can attend.  It's a very inspiring story.  

Saturday, September 27, 2008

Flea

Flea, the bassist of the Red Hot Chili Peppers, is now a freshman at the USC school of music.  I heard an interview with him on NPR today.  He is studying Bach chorales, and seems to love it.  This is in addition to starting a free music school for children in LA that now teaches 600 kids music daily.  Inspiring guy...

Berkeley and taxes

I started listening to a course in American economic history from Berkeley.  In the first lecture, the professor, J. Bradford Delong notes that the students are paying $10,000/year for their education.  This
amounts to California taxpayers covering $20,000/year of each Berkeley student's education.  He then notes that the bulk of tax money comes from people making $70-80K/year, and that the Berkeley students can expect to earn more (perhaps much more) than this.  What rationale can be given for such a bargain?  Delong's conclusion is that each Berkeley student has a social contract with the residents of California to work hard, and to do good work.  I thought this is a nice message.  

Friday, September 26, 2008

latex: colortbl + pdfsync

I just had a frustrating experience.  I was typesetting a table in latex for my LPAR paper.  I was using the colortbl package to add colors.  Strangely, if I used the usual lcr column types, it worked fine.  If I tried to set the column width manually however, the cell ended up taking up the entire page.  After a bunch of fiddling, I found that when I commented out \usepackage{pdfsync}, everything returned to normal. So these packages are incompatible, which is unfortunate.

Tuesday, September 23, 2008

Brancusi as copper

Interesting story from this article on Calatrava in the New Yorker.
In 1926, Marcel Duchamp tried to bring in a sculpture of Brancusi, a bird in copper, for an exhibition. When it arrived at customs, the officials said, ‘You have to pay a duty on copper entering this country.’ The organizers of the exhibition said, ‘But this is a piece of art,’ and the customs said, ‘No, this is a piece of copper.’ Brancusi won.”

Sunday, September 21, 2008

Dinner politics

I just got back from a dinner party.  The topic of
conversation turned to politics fairly quickly.  There
was one McCain supporter in the room, versus four
Obama supporters.  I only said a few things, none of
them terribly trenchant.  I noticed some interesting things
about people's argument styles though.  The most informed
person in the room, person A, was very direct, almost confrontational.
What made his thoughts so compelling was the amount of
facts he had at his disposal.  The one who struck me the
most, though, was person B.  Person B had many good points,
but they were made in a really friendly and unconfrontational
light.  This made person C (the republican) more able to
discuss her thoughts without feeling, I think, attacked as
she probably did from my arrogant ramblings.  Person D was remarkable for
her ability to share meaningful feelings, citing for example,
that while Obama may be inexperienced (Person C's main argument)
his experience with constitutional law and general and obvious
intelligence made her feel like he would be able to understand
complex matters deeply, which in turn gave her a sense of trust.
Note to self: have lots of facts, be open, and nice!   Even when
someone is defending Palin.  You'll learn more from others,
and have more friends.  Though I'm somewhat skeptical having
conservative friends is a worthwhile goal...

Mac security update + X11/Terminal hang

I just had an incredibly frustrating experience.  I
installed the latest security update for my mac laptop.
When I rebooted, X11 no longer functioned.  Moreover,
Terminal would start, but was clearly hanging, and
Aquamacs wouldn't open. 

The problem turned out to be a command in my .bashrc
file

xset b off

that was intended to turn off sounds emanating from X11.
Once this was commented out, everything works fine.
You can access your bashrc file by opening Terminal and
hitting Ctrl-C.  This will allow you to use vi to change the
relevant file.

Saturday, September 20, 2008

Wall Street Journal

I started reading a conservative newspaper to get a feel
for what the other side considers newsworthy.  I figured
the Wall Street Journal was a good place to start. 
I went to the "most emailed" box today, as I often do at
the New York Times.  The number 1 article was by Rush
Limbaugh.  "This isn't good...",  I thought.  It was a
surprise to me, though, that when I read the article, about
two comments of Limbaugh's that he claims were taken
out of context in Obama commercials, I actually agreed
with him.  He came to the conclusion that Obama was
stoking racial tension and thus is not a worthy president,
which is understandable coming from a neoconservative
pundit, but it does seem he was deliberately misquoted.
(Though I'm trusting that he was really parodying in
the second passage, which I don't have %100 confidence
in without knowing more of the monologue.) 

In addition to Limbaugh, there was a bad writer
named Peggy Noonan, and the editorial was unabashedly
pro-Palin.  Unlike the Times, I found no evidence of another
point of view.  I'll look for one in the coming days.  I wonder
who is the analogue of David Brooks or Bill Kristol.

Thursday, September 18, 2008

*nix command: ps2pdf -sPAPERSIZE=a4

I was trying to read this paper.  I downloaded the pdf, but the
top inch is cut off.  The postscript looks fine in a postscript
viewer like gv, but I prefer pdf viewers.  Running ps2pdf on
the postscript gave the same result as the pdf download on
the webpage.  Turns out the format is a4, so you need to run

ps2pdf -sPAPERSIZE=a4  paper.ps

This solved the problem.

Friday, September 05, 2008

Big Brother?

I wonder if Mitt Romney has ever read 1984. In fact, I
wonder if he reads the newspaper. During his RNC speech he
said something about how the GOP is the party of big ideas,
while the democratic party is that of "Big Brother". While
it's true that the government in 1984 was big, that doesn't
seem to be the defining quality. Among other things, it was
the loss of privacy, basic human rights, and continual
warfare. Iraq, Bush's warrant-less wire tapping and the
administration's odd justifications for the use of torture
seem much more in the spirit of the government of Oceania.

Also interesting is the fact that the derivative of
government spending is much steeper during Republican
administrations. So the interpretation of democratic
administrations being "big government" seems mistaken as
well. I wish the standards of rhetoric were higher in such
important political events. I don't imagine Jefferson or
Madison spouting the banalities I heard repeatedly. Of
course, they would have read 1984 before quoting it.

Bach Cantatas

Bach wrote well over 200 cantatas. They run from about 15 minutes
to 45 minutes.  I first started listening to them after hearing them live
(weekly) at Boston's excellent Emmanuel Episcopal Church. I sang a
number of them with the Bach Cantata Chor in Pittsburgh before the
music director retired in 2007. It's nice to always know there's
a pile of great music you've never heard, just waiting to be remembered.
There are so many though, it's difficult to remember which ones you like. I started
a list
so I could remember. Please let me know your favorites that I'm leaving out.
I'm listening to BWV206 a lot lately.

Sunday, August 10, 2008

Fact: svn server version

Fact: It is not possible for a client to get the server version number in Subversion.

It took me awhile to find the answer to this because googling for
"subversion version server" is not terribly helpful, considering subversion
is version control software.

Saturday, August 09, 2008

Mathematica Undo

Mathematica is generally a good program. The programming language may be primitive, but the symbolic and graphics functionality are excellent. However, I just can't believe that it only has one level of undo. I just lost 20 minutes of work because of this. If you must use Mathematica notebooks as opposed to text edited files, save often!

Thursday, August 07, 2008

*nix command of the day: texdoc

texdoc looks up tex documentation, e.g.

texdoc amsthdoc

opens a pdf of the documentation for the AMS theomem package.

Wednesday, August 06, 2008

Quote

“Every kid is always talking about what his parents have been through, and no kid has any clue what he’s talking about.” - Charles Rangel

1984

I'm reading George Orwell's novel "1984". It occurred to me
yesterday that, while it adds critically to his message, and mirrors
both the Soviet and Chinese postwar situations, the emphasis on the
scarcity of goods is almost counterproductive to his aims. It seems
to me that the message would be more poignant if there was plentiful
food and goods. For it is to an authoritarian plenty, rather than the
poverty of 1984, where countries like China are heading in the era
of globalization. It is this model that will compete with liberal
democracy in the coming years. Nicholas Kristof's "China Wakes"
describes some of 1984's horrors in modern China.

Update:
Now that I've read further, it seems the story wouldn't work
if there were plentiful goods. I'm finding it hard to take this book
seriously. Animal Farm is a much better satire.

Thursday, July 31, 2008

Total solar eclipse


The exploratorium in San Francisco, my favorite museum as a child, is
webcasting the total solar eclipse from China tomorrow. Check it out! More info at Wikipedia:

It's happening from 8-12 UTC. Here in PA we're at UTC-5, but because of daylight savings it's UTC-4, so PA folks can watch from
4-8 AM.

Tuesday, July 22, 2008

Knitro

I've been using a nice nonlinear optimizer called Knitro. It's not free, but has
a free student license. This note regards installing Knitro. You first fill out a form
and get a license. You are suppose to put the license in a file so that the
executable can see that you have permission. I followed all the instructions, but
I kept getting the following error:

### Could not find a valid license.
Your machine ID is 93-04-3c-a2-d3.
Please contact info@ziena.com to obtain a license.
Go to http://ziena.com/trial.html for a KNITRO student version license.
Failed to find a Ziena license.

If you get this, make sure you have no spaces after the license key. Once
I removed the spaces it worked.

Monday, July 21, 2008

Random fact: flammible flour

From wikipedia:

Flour dust suspended in air is explosive, as is any mixture of a finely powdered flammable substance with air,[1] see Lycopodium. In medieval flour mills, candles, lamps, or other sources of fire were forbidden. Some devastating and fatal explosions have occurred at flour mills, including an explosion in 1878 at the Washburn "A" Mill in Minneapolis, the largest flour mill in the United States at the time.[2]

Random fact: flammible flour

From wikipedia:

Flour dust suspended in air is explosive, as is any mixture of a finely powdered flammable substance with air,[1] see Lycopodium. In medieval flour mills, candles, lamps, or other sources of fire were forbidden. Some devastating and fatal explosions have occurred at flour mills, including an explosion in 1878 at the Washburn "A" Mill in Minneapolis, the largest flour mill in the United States at the time.[2]

Wednesday, July 09, 2008

Fireflys in Pittsburgh

The best place to see fireflys in Pittsburgh is in Frick
Park at 9:15 PM. They are only very active for about
30 minutes, but if you catch it it's an incredible thing
to see. The best place is in one of the canopies that
are very dark at 9:15 because of the tree cover.

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.