When volcanic eruptions created the island of Ferdinandea in 1831, it was quickly claimed by Italy, France, the UK, and Spain. While they were arguing, the little island eroded away.
How to put this? Language isn't what I thought it was. (This definitely falls into the category of thought-provoking stuff I won't pretend to understand.)
A little background. Before your third birthday, you subconsciously achieved a thorough familiarity with the grammar of the language spoken in your home. Never mind that you said I've sawn instead of I've seen. That's small stuff. You knew when to use the and when to use a. You knew which of they run and they runs was right, that big green circle sounds better than green big circle, how to figure out what it means in context, and much more. You will never have conscious understanding of all the syntactic rules you already had subconsciously at three. No one does. Not even people who make a career out of studying exactly that.
Linguists aren't dumb. Why is it that toddlers are able to do this amazing thing that all the linguists in the world, given several decades to work, can't do?
Beats me, but there's something else kids do that's even more amazing. They invent grammar.
I'm tempted to block-quote about a page out of this book I'm reading (Foundations of Language by Ray Jackendoff). It's fascinating stuff. “Derek Bickerton documents in detail that children of a pidgin-speaking community do not grow up speaking the pidgin, but rather use the pidgin as raw material for a grammatically much richer system called a ‘creole’.” If adults could do that, there wouldn't be a pidgin phase. The kids do it. Where does that come from?
Communities can exist for millenia without developing writing. They don't go without grammatically complex spoken language. Hmmm.
Even better, there's a school for the deaf in Nicaragua where the kids, unprompted, made up their own sign language. “Besides offering the wonder of a whole language coming out of nowhere, Nicaraguan Sign Language sheds some light on questions about creole. Evidently a community is necessary for language creation, but a common stock of pre-existing raw material is not.” I always assumed the syntax of a language like English comes together incrementally, over thousands of years. Shows what I know. It was probably invented in a single generation.
Parahã, a language spoken by a few hundred people in Brazil, contains, according to Wikipedia, “two very rare sounds, [ɺ͡ɺ̼] and [t͡ʙ̥]”. In case you don't have the fonts I do, that first one looks like two upside-down lowercase rs with a squiggle underneath like a bird in flight, and a arc over the top; and the second one looks like tB with a dot under the B and an arc over the top. I wonder how they're pronounced.
In the version of
g++that ships on the Mac these days (GCC 4.0.1), you can get the old-school SGI STLhash_mapcontainer by doing#include <ext/hash_map>andusing __gcc_cxx::hash_map;. But the GCC guys have already replaced thehash_containers with newer standards-track containers,unordered_mapand friends, which you can get in a more recent libstdc++.In C++, a class's private members are not entirely hidden from code that uses the class. It's possible for public names to collide with private names. For example:
class A { private: void f(); }; // This method is private, but its name matters... class B { public: void f(); }; // ...because it'll conflict with this one. class C : public A, public B {}; C().f(); // Error: request for member ‘f’ is ambiguous.Leaky abstractions make me sad. This doesn't seem to come up often in practice, but I think it's one reason STL implementations tend to contain lots of extra underscores. Another reason for that, as Blake Kaplan pointed out to me, is that a standard C++ program can do:
#define n 3 #include <vector>
and the headers should be able to cope with that.
24 July 2008
Last week I learned...
23 July 2008
Stuff I learned recently
Twelve thousand years ago, a gigantic dam of solid ice blocked the Clark Fork River, creating Glacial Lake Missoula.
The lake was almost 2,000 feet deep.
And periodically the dam would explode, laying waste to parts of what's now Montana, Idaho, Washington, and Oregon.
Thundering waves and chunks of ice tore away soils and mountainsides, deposited giant ripple marks, created the scablands of eastern Washington and carved the Columbia River Gorge.
Mendellsohn's Wedding March has about 50 times more notes in it than I had realized.
“Between 1958 and 1992, Russia dumped 18 nuclear reactors into the Arctic Ocean, several of them still fully loaded with nuclear fuel,” writes Scott G. Borgerson. The article also points out that last summer, “[f]or the first time, the Northwest Passage—a fabled sea route to Asia that European explorers sought in vain for centuries—opened for shipping.”
Calque is a loanword and loanword is a calque. (Source.)
Recent Linux and Windows operating systems implement address space layout randomization. The goal is to prevent certain security attacks that depend on specific code being in predictable memory addresses.
According to a 2005 research paper by Richard Haier et al, women's brains have about 10 times the amount of white matter related to general intelligence (that is, in areas whose size correlates with IQ) as men's. Contrariwise men have have about 6.5 times the amount of IQ-correlated gray matter. I find that pretty startling.
Here are some of Haier's own words on brains and genes.
02 July 2008
What is a noun?
But what about earthquakes and concerts and wars, values and weights and costs, famines and droughts, redness and fairness, days and millennia, functions and purposes, craftsmanship, perfection, enjoyment, and finesse?
—Ray Jackendoff, Foundations of Language: brain, meaning, grammar, evolution
I learned in school that a noun is a word that names a person, place or thing.
A few years after that, the definition changed. In hindsight this seems creepy. It happened twice. I don't remember any explicit discussion or even acknowledgment of the change. We would do nouns one way one year, and when that time came around the next year, we would have different textbooks with a different definition. I remember the changes: first “event” and later “idea” were added to the list ...bringing nouns like earthquakes and purposes in from the cold, I guess. We regret the omission, etc.
I didn't know this until a couple days ago, but linguists apparently consider this whole approach to parts of speech hopelessly, fundamentally broken. Morally bankrupt, in fact. That a child is taught the ”person, place or thing“ definition approximately once every 12 seconds preys on the linguist's soul. It causes him to make awkward scenes at parties. Even the funny papers are bristling with painful reminders of this horrible truth.
I never noticed before, but there is a problem or two with this whole “person, place or thing” thing. All the most common words for people (you, I, he, she, they) and things (this, that, these, those, it) are pronouns, while all the most common words for places (here, there, in, out, up, down, to, from, and on and on) are adverbs and prepositions. All the other definitions I learned for parts of speech are bogus, too. I learned that “action words” are verbs; but homocide, defenestration, and touchdown are all nouns. (So is pirouette. My wife didn't believe me.) I learned that prepositions tell about relationships, particularly spacial relationships; but proximity and distance are nouns (and cover and surround are verbs!). I learned that words that describe properties of things are adjectives; but weight, beauty, shape, and color are nouns.
So what is the definition of a noun, exactly? Well, I'll tell you. I don't know. Strangely, I don't think linguists like to say! Here's a pretty good near miss by Geoffrey K. Pullum, writing in Language Log:
The way to tell whether a word is a noun in English is to ask questions like: Does it have a plural form (the terrors of childhood)? Does it have a genitive form (terror's effects)? Does it occur with the articles the and a (the terror)? Can you use it as the main or only word in the subject of a clause (Terror rooted me to the spot), or the object of a preposition (war on terror)? And so on. These are grammatical questions. Syntactic and morphological questions. Not semantic ones.
A bit vague, isn't it? That's way above average, though. Here's an honest attempt; it starts with “A noun is a member of a syntactic class…”. Until I edited it, Wikipedia's article on nouns started, “In linguistics, a noun or noun substantive is a lexical category which is defined in terms of how its members combine with other kinds of expressions.”
There's an interesting twist to how all this gets bootstrapped in the toddler brain. All the first words you learn are nouns, words for people and things in your little one-year-old world. You'll be able to put words together into sentences before you master any pronouns. That is, at the time when you're learning the basic grammar of the language, there is a semantic distinction between the nouns you know and all other words. The values and weights and costs come later.
14 June 2008
Barleycorn Bay
See earlier puzzles for, er, something of an explanation.
“Now listen close-like,” said my new friend, “'cos I'm only going to say this once. All the inhabitants of Barleycorn Bay, and I've met them each and every one, are either heroes or vagabonds. Or both. Every one of the heroes is blonde; every one of the vagabonds is a magician, except for any that be Quakers; and all the magicians are nanny goats. Every one that isn't a walrus isn't a ruminant.”
“Isn't a what?” I said.
“And every living soul in Barleycorn Bay that isn't clean-shaven is red-headed, excepting the nanny goats of course. Needless to say,” he added, scratching his beard with a steel hook, “there are no clean-shaven pirates.”
I thought it over for a while. “Is there such a thing,” I wondered aloud, “as a nanny goat that's also a walrus?”
“I reckon there could be,” he replied, “although I've never met one.”
“What about a blonde redhead?”
“Don't be ridiculous.”
01 June 2008
Facts
David Macaulay wrote and illustrated a book entitled Castle. If you have a child four or older, you have a perfect excuse to buy it. Mill is fascinating, too.
That “if Microsoft designed the iPod package” video was commissioned by Microsoft. To my mind, that makes it even cleverer.
In an underground passageway somewhere near Shinjuku, there is a machine that cleans your glasses.
A hot-air balloon that can carry 8 people costs “all your money”. Or if you prefer, about a hundred thousand dollars.
You can write a regular expression that matches only strings of a composite number of x's. (Hint: Too easy for a hint.)
I knew that Galileo discovered the first four of Jupiter's moons, the Galilean moons. I didn't know that the fifth known moon wasn't discovered until almost 300 years later, when Tennesseean E. E. Barnard discovered Amalthea.
And it took me completely by surprise to learn that Richard Feynman ever worked at a computer hardware startup, Thinking Machines Corporation.
28 May 2008
Crowd vs. Committee
I just found this in an old notebook. Apparently I wrote it a couple years ago. Most of it seems to make more sense to me now.
| Wisdom of Crowds | Design by Committee |
|---|---|
| Both: Participants may be biased. | |
| Bias averages out | Bias creates “riders” |
| Not much work | Lots of work |
| No consensus required | Seeks consensus. Decisions may be postponed to avoid stirring up trouble. |
| Minority (“special”) interests can be publicised but are often ignored | Minority interests are not ignored |
| No experts—skepticism (Presumption is that a random individual is not an expert.) | All experts—openness |
| Lossy, mass communication (of arguments, etc.) | Tedious explicit communication |
| Both: No overarching design or uniting vision. | |
| Nobody cares | Possibly competing visions |
| Simple output. | Unbounded complexity in output. |
| Immediate feedback. | Long-term, invisible feedback. |
| Individuals have low individual impact. | Individuals are influential. |
| Neglecting the topic somehow doesn't matter. | Neglect causes warts (that is, areas where the design is painfully bad —ed.) |
| Product needn't be understood (markets) | Product is ideas. |
| Mechanism for approaching a good result exists (market; averaging) | Democracy (voting) and consensus are the only such mechanisms. |
| Interfaces are well-defined before work starts (ballot; prices) | Interfaces have to be designed. |
| Individuals can't introduce bureaucracy | Individuals sometimes manage to introduce bureaucracy |
23 May 2008
Curlicues
J was writing his sister A's name for her on a piece of construction paper. J is 4 years old and A is 2, and somebody recently taught J that he can decorate his letters with outrageous curlicues. So J says, “Do you want me to put curlicues on it?” And A replies, in her tiny stern voice, “There are no Qs in my name!”
10 May 2008
Firefox 3
Firefox 3 is nearing release. Check out what's new, especially the Awesomebar, which has changed my life.
(Awesomebar itself is the work of superhacker Ed Lee, but it relies on Places, the new bookmarks and history system, 2+ years in the making.)
If you're interested in security, especially the difficulty of giving users correct, actionable security-related info at a glance, read about Firefox's new site identification and malicious site detection features.
06 April 2008
This week I learned...
In the children's section of the Nashville public library, the mother lode of folk tales is in the nonfiction section. Aha!
There's a whole family of egg-eating snakes that swallow eggs bigger than their heads, squeeze out the insides, and spit out the shell.
According to this blog post, native speakers of Chinese are gradually forgetting how to write.
According to Jared Diamond, out of 148 species of large, wild, terrestrial herbivorous mammals, only 14 have ever been successfully domesticated. (Guns, Germs, and Steel.)
Every time I go to the Nashville library, I leave feeling like I've just picked somebody's pocket. It's a wonderful library. (I don't know that it's particularly unusual in this regard.)
04 April 2008
This month I learned...
The past three or four weeks are a bit of a blur, but:
Just before he died, Beethoven claimed to be working on a Tenth Symphony. Fragments of this were discovered among Beethoven's sketchbooks in the 1980s (!), and musicologist/composer Barry Cooper stitched together a highly speculative, but performable, first movement.
I knew that John Harrison invented the first clock that could keep time on a ship and that such clocks cracked the longstanding problem of determining longitude at sea, leading to the first accurate maps. (H1 was his first attempt; his masterpiece, H4, was a 5-inch watch with a diamond-studded movement.) I didn't know that Harrison faced competition from an astronomical method relying on careful on-ship measurements of lunar occlusions of certain stars, huge tables of laboriously pre-calculated data, and maybe four hours of additional calculations to be done on the ship. It was a usability disaster, as one might expect. But at the time, the idea of making a clock run reliably on a pitching, rolling ship apparently seemed even crazier.
Bill McCloskey's memoize is a replacement for
makein a few lines of Python. The complete source code fits on my screen. This is the coolest hack I've seen all year.The word goodbye comes from the saying “God be with you”. According to the American Heritage dictionary's etymology note, “A letter of 1573 written by Gabriel Harvey contains the first recorded use of goodbye: ‘To requite your gallonde [gallon] of godbwyes, I regive you a pottle of howdyes,’ recalling another contraction that is still used.”
According to Wikipedia, the lungfish has the largest genome of any vertebrate. But as of today, Wikipedia does not say anything about the lungfish's lungs! (I usually try to contribute in cases like this, but here I haven't a clue.)
On the Mac, if
ls -loutput has an@symbol here:-rw-r--r--@ 1 jason jason 54838 Sep 27 2007 #tamarin 9-25-07.colloquyTranscript
then the file has extended attributes. These are used, for example, to mark files as “saved from the web”, triggering a warning if a user tries to open the file.
14 March 2008
A bad guy in a lose-lose situation
I guess there's no point denying that J, my four-year-old, has a bit of an aggressive streak. Paraphrased from memory:
J: I'm going to try and splash him into that swimming pool. He's a bad guy. (The “bad guy” is a toy car.)
If he misses, he's going to be shot out of a cannon that will shoot him so hard, he will crash into the sun, and then he will blow up and his car will blow up.
(J. rolls the car off the table at a mixing bowl; it falls in.)
Me: Hey, you got him into the swimming pool.
J: (casually) Yeah, there's sharks in there.
I'm just glad he has it in for the bad guys.
29 February 2008
This week I learned...
I spent most of this week sick in bed, but I did discover that:
According to the Jameel Poverty Action Lab at MIT, the cheapest way to improve attendance in Kenyan schools is mass deworming.
There's a guy removing Garfield from Garfield comic strips. The result: “an even better comic about schizophrenia, bipolar disorder, and the empty desperation of modern life”.
Guy Steele wrote The TELNET Song. Before webcomics, if hackers wanted to laugh without leaving the net, they had to make their own humor.
Also, I like this poem: “The Trash Can”.
23 February 2008
This week I learned...
A shibboleth is language that sends cultural signals beyond its plain meaning. The word comes from a fairly amazing Bible story.
Now I want a word for language invented to annoy, like “Democrat Party”.
Aristotle believed slavery to be “expedient and right”. All the best arguments by learned apologists for slavery in the U.S. South were from his writings, particularly in the Politics.
Incidentally, Aristotle thought democracy was a crummy form of government. And, in his ideal society, homeschooling would be banned.
There are expressions of the Golden Rule in the scriptures of many religions.
I don't understand what this means, exactly, but the x86 instruction set contains an
FNOPinstruction. The manual describes it as a floating-point no-operation instruction. How this might be different from a regularNOPI don't know.So there's a widely known interview question: write a function to count the number of bits of a 32-bit int that are set to 1. This function is called the population count—that link describes a surprising use for it.
The last time I tested this, summing 4 queries into a 256-value lookup table is fastest for 32-bit integers, faster than the awesomely clever bit-twiddling solution. I shouldn't have been surprised. The lookup table fits easily into cache. The bit-twiddling solution has a lot of dependencies; the CPU can't find any instruction-level parallelism there.
Anyway, what I learned a week or two ago is that future Intel chips will have an SSE instruction,
POPCNT, that does this, in parallel, for several words at a time. (Someone I mentioned this to commented that he doesn't want to be fired for pronouncing that.)Often when I write these blog entries, I'm still unsure of the significance of some of the things I've just learned. For example, I learned something about Java monitors (or pthreads condition variables, which are the same thing). When thread 1 notifies, waking thread 2 on a separate CPU, the lock associated with the monitor ensures that CPU 1's writes are flushed to main memory and CPU 2 sees them before thread 2 starts running. There's no need for write-barrier magic in
Object.notifyitself.Apple's Shark profiler has a feature that lets you compare two profiles. But the result is calculated by comparing percentages, not comparing the absolute number of samples. So, for my purposes, useless.
The .mshark files produced by Shark are gzipped binary property lists, but the actual samples are stored in there as raw binary data which I haven't tried to decipher.
08 February 2008
This week I learned...
Special double issue! Two weeks' worth of trivia, including a week spent in Mountain View.
With GNU Radio, you can buy some cheap hardware, plug it in, and your computer becomes a GPS receiver, a garage door opener, an HDTV tuner, an AM/FM radio, a cell phone. This is subversive technology. Hollywood wants regulations that would ban such nonsense.
Radio waves bounce off meteor trails. This is actually usable as an alternative to satellite communications, depending on the application. For example, the USDA has a network of solar-powered snow depth sensors that use meteor trails to phone home.
On the Mac, Alt+[ types a left double-quote mark and Alt+{ types the right one. Much better than typing
“.GCC generates a floating-point instruction for
isnan(x); it amounts tox != x(NaNs are not equal to themselves). Intel engineers claim integer instructions can be much faster, on x86 at least, due to floating-point exception nastiness.Xavier Leroy has written a provably correct “lightly-optimizing” back-end that compiles a subset of C to PowerPC machine code. Sandrine Blazy and Zaynah Dargaye have hooked it up to a provably correct front-end.
A little background here. A compiler works by lowering code step by step from relatively high-level internal representations, like parse trees, to successively lower-level representations, until it gets down to machine code. At each level it can apply optimizations: some optimizations, like common subexpression elimination, work at a very high level, and some work at the machine-code level. Stack up enough lowering passes and optimizations, and you've got yourself a compiler. There's considerable interest these days in using formal methods to prove the correctness of program transformations. First you define mathematically what it means for two programs to be equivalent. Then you prove that a given transformation always produces a result that's equivalent to the original. Stack up enough provable lowering passes and optimizations, and you've got yourself a provably correct compiler.
This kind of work has been done for subsets of Java, but C's pointers and undefined behavior present some nasty problems. Leroy's work is hedged in with disclaimers, but it's still pretty amazing stuff, and an interesting read. For example, he proposes the following sneaky technique. Write your compiler pass however you want, and don't bother proving it correct. Then just verify the correctness of the transformation afterwards (for the particular program being transformed). It's apparently much easier to prove a verifier correct than the transformation code itself. Plus, you can then tweak the transformation without redoing any proof work. The only risk is that your transformation is incorrect, in which case your compiler flunks out with an internal error at compile time.
The PDP-11 had probably the nicest of all the widely used CISC instruction sets.
emacsclient is my new
EDITOR. It connects to my existing Emacs process, if any (I had to put(server-start)in my.emacsfile) and loads the file there.Speaking of emacs:
M-/is the autocomplete key. It's moderately smart. You also want to knowC-x r SPACEx (save current cursor position in x) andC-x r jx (jump to the position saved in x).When you run a
configurescript, it generates aconfig.statusfile in the build directory. That file is helpful when debugging stupid build problems.In the late-1990s, there were two computer science research projects called Dynamo, both involving dynamic optimization: one at Indiana University and of course the awesome one, at HP Laboratories.
25 January 2008
This week I learned...
NestedVM can take any program that GCC can compile and run it in a Java VM. It does this by compiling the program to a MIPS executable and then translating the MIPS machine code to Java bytecode. Now, there isn't any high-level type information in a MIPS binary, so there isn't any in the bytecode. Instead each instruction is translated to something that bangs on some large
intarrays that represent virtual memory. (Thesbrksystem call is implemented usingnew int[].)The paper has sentences like, “The NestedVM runtime fills the role typically assumed by an OS kernel.” :)
I think the point of this, aside from being cool, is to make C++ code run anywhere Java does. I don't know how many platforms have JVMs but not gcc back-ends, though. (GCC actually has a back end for Java, but it can't handle C++.)
So if you know C, you know that
&&has short-circuit behavior: if the left-hand side is false, the right-hand side doesn't get evaluated. This week I learned that if the right-hand side of&&is simple enough and has no side effects, as inx > 0 && x < N, a good compiler emits code that evaluates it anyway, essentially treating the&&as&. A conditional branch is slower than a few redundant instructions.Objective C exceptions on Mac are implemented using
setjmp/longjmp. They don't cooperate with C++; if you throw an Objective C exception across a frame containing C++ objects, the destructors don't get called. This triggered some bugs in Mozilla, which apparently has Cocoa GUI code or something. (Sorry, I don't pay much atttention to that stuff.:))If you compile with
gcc -g3, thengdbcanprintexpressions that use macros! I knew Jim Blandy had implemented this but I never actually went and dug up the magic to make it work. This will make my life a lot easier, at least for a year or two.The
gcccompiler itself uses a garbage collector. I'm told the GC is autogenerated from the source; so thegccsource distribution actually includes a bunch of autogenerated code.gcc -Sprints Intel assembly code with the operands reversed. I don't remember if I ever knew this or not. What a pain.And some more about GCC internals, from here.