The Universe of Discourse

Wed, 01 Sep 2021

On having the right theorem

A recent Math StackExchange question asks “Prove every permutation of the alphabet contains a subset of six letters in order”. That is, you take a string of length 26 that contains each letter once; you can find a subsequence of six letters that is either increasing or decreasing.

Choosing a permutation at random, suppose we have:

    q y x u l i n g w o c k j d r p f v t s h e a z b m

Then the sequence x w v t s e b has length 7 and is in descending order. Or:

    t h e q u i c k b r o w n f x j m p s v r l z y d g

This contains the ascending sequence h q r s v y. Also the descending sequence t q o n m l d.

I thought about this for a while but couldn't make any progress. But OP had said “I know I have to construct a partially ordered set and possibly use Dilworth's Theorem…” so I looked up Dilworth's theorem.

It turns out I did actually know Dilworth's theorem. It is about partially-ordered sets. Dilworth's theorem says that if you partition a partially-ordered set into totally-ordered subsets, called ‘chains’, then the number of such chains is at least as big as the size of the largest “antichain”. An antichain is a subset in which no two elements are comparable.

This was enough of a hint, and I found the solution pretty quickly after that. Say that !!S[i]!! is the position of letter !!i!! in the string !!S!!. Define the partial order !!\prec!!: $$ i\prec j \qquad \equiv \qquad i < j \text{ and } S[i] < S[j] $$

That is, !!i\prec j!! means that !!i!! is alphabetically earlier than !!j!! and its position in !!S!! is to the left of !!j!!. This is obviously a partial ordering of the letters of the alphabet. Chains under !!\prec!! are, by definition, ascending sequences of letters from !!S!!. It's easy to show that antichains are descending sequences.

Partition !!S!! into chains. If any chain has length !!6!! or more, that is an ascending sequence of letters and we win.

If not, then no chain has more than 5 letters, and so there must be at least !!6!! chains, because !!5·5=25!! and there are !!26!! letters. Since there are at least !!6!! chains, Dilworth's theorem tells us there is an antichain of at least !!6!! letters, and hence a descending sequence of that length, and we win.

Once you have the idea to use Dilworth's theorem, the problem collapses. (You also have to invent the right !!\prec!! relation, but there's really only one possible choice.)

Maybe I'll write a followup article about how just having a theorem doesn't necessarily mean you have an algorithm. Mathematicians will say “partition !!S!! into chains,” but actually programming something like that might be nontrivial. Then finding the antichain among the chains might also be nontrivial.

[Other articles in category /math] permanent link

Sat, 28 Aug 2021

Mo in an alternate universe

In a transparent attempt to capitalize on the runaway success of The Wonderful Wizard of Oz, the publishers of L. Frank Baum's earlier book A New Wonderland re-released it under the title The Magical Monarch of Mo. What if this ploy had actually worked? Would the book have inspired a movie?

We're off to see the Monarch,
The Marvelous Monarch of Mo…

Naah, it kinda falls apart after that.

[Other articles in category /book] permanent link

How to fix hiring?

On Twitter, Mike Coutermarsh suggested:

Job interview: “algorithms”

Reality: “Turn a 127 message deep slack thread between 5 engineers into a decision”

I suppose this was meant facetiously but I think it might contain the germ of a good idea.

Applicants are usually given timed a programming quiz. What if instead, the candidate was supplied with the 127-message Slack thread and given 24 hours to write up a proposal document? I honestly think this might produce good results.

Such a submission would be extremely probative of the candidate's talents and abilities, including:

  • reading and understanding technical arguments
  • balancing engineering tradeoffs
  • foreseeing potential issues
  • writing clear English
  • planning
  • seriousness
  • writing coherent, well-organized, and persuasive documents

It is much more difficult to cheat on this task than on a typical programming exercise. The candidate certainly can't submit a prewritten essay that they found somewhere; that would be easy to detect. A candidate who can take someone else's prewritten essay and quickly rewrite it to plausibly appear original is probably quite well-qualified on many of the important metrics! (Plus an additional important one: the ability to do research. They had to locate, recognize, and read the essay they rewrote.)

It shouldn't be hard to change up the essay topic periodically, since the engineers will be producing several of those 127-message Slack threads every month. This also tends to impede cheating.

When a good candidate comes for an in-person interview, you have a ready-made topic of conversation. Instead of coding at the whiteboard, you can ask them to discuss their proposal.

Complaints that this would discriminate against candidates with poor command of English do not hold water. Good command of English is one of the job requirements, and the whole point of a job interview is to discriminate against unqualified candidates. Besides, if the hiring process encourages candidates to improve their English writing abilities, rather than cramming a bunch of red-black-tree algorithms, language trivia, or irrelevant brainteasters, so much the better for everyone.

[Other articles in category /misc] permanent link

Why is the S combinator an S?

The most important combinator in combinatory logic is the !!S!! combinator, defined simply:

$$ S x y z ⇒ (x z)(y z) $$

or in !!\lambda!!-calculus terms:

$$ S = \lambda x y z. (x z)(y z). $$

A wonderful theorem states that any !!\lambda!!-expression with no free variables can be converted into a combinator expression that contains only the combinators !!S, K,!! and !!I!!, where !!S!! is really the only interesting one of the three, !!I!! being merely the identity function, and !!K!! a constructor of constant functions:

$$ \begin{align} I x & = x \\ K x y & = x \\ \end{align} $$

In fact one can get along without !!I!! since !!S K K = I!!.

A not-too-infrequently-asked question is why the three combinators are named as they are. The !!I!! is an identity function and pretty obvious stands for “identity”.

Similarly the !!K!! constructs constant functions: !!K x!! is the combinator which ignores its argument and yields !!x!!. So it's not hard to imagine that !!K!! is short for Konstant, which is German for “constant”; no mystery there.

But why !!S!!? People typically guess that it stands for “substitution”, the idea being that if you have some application $$A\,B$$ then !!S!! allows one to substitute some term !!T!! for a free variable !!v!! in both !!A!! and !!B!! prior to the application:

$$ S\, A\, B\, T = A[v/T]\, B[v/T]. $$

Although this seems plausible, it's not correct.

Combinatory logic was introduced in a 1924 paper of Moses Schönfinkel. In it, he defines a family of combinators including the standard !!S!!, !!K!!, and !!I!!; he shows that only !!S!! and !!K!! are required. His initial set of combinators comprises the following:

$$ \begin{array}{cllrl} I & \textit{Identitätsfunktion} & \text{“identity function”}& I\,x =& x \\ C & \textit{Konstanzfunktion} & \text{“constancy function”} & C\,x\,y =& x \\ T & \textit{Vertauschungsfunktion} & \text{“swap function”} & T\,x\,y\,z=& x\,z\,y \\ Z & \textit{Zusammensetzungsfunktion} & \text{“composition function”} & Z\,x\,y\,z=& x\,(y\,z) \\ S & \textit{Verschmelzungsfunktion} & \text{“fusion function”} & S\,x\,y\,z=& x\,z\,(y\,z) \end{array} $$

(Schönfinkel also had combinators representing logical operations (one corresponding to the Sheffer stroke, which had been discovered in 1913), and to quantification, but those don't concern us right now.)

!!T!! and !!Z!! are now usually called !!C!! and !!B!!. These names probably originated in Curry's Grundlagen der kombinatorischen Logik (1930). Curry 1930 is probably also the origin of the change from !!C!! to !!K!!. I have no idea why Schönfinkel chose to abbreviate Konstanzfunktion as !!C!! instead of !!K!!. Curry notes that for !!I, K, B, C, S!! Schönfinkel has !!I, C, Z, T, S!!, but does not explain his changes. In Curry and Feys’ influential 1958 book on combinatory logic, the !!B!! and !!C!! combinators given names that are are literal translations of Schönfinkel's: “elementary permutator” and “elementary compositor”.

Returning to the !!S!! combinator, one sees that its German name in Schönfinkel's paper, Verschmelzungsfunktion, begins with the letter V, but so does Vertauschungsfunktion, so abbreviating either with V would have been ambiguous. Schönfinkel instead chose to abbreviate Verschmelzungsfunktion with S for its root schmelzen, “fusion”, and Vertauschungsfunktion with T for its root tauschen, “swap”. The word schmelzen is akin to English words “melt” and “smelt”.

The “swap” is straightforward: the !!T!! combinator swaps the order of the arguments to !!x!! in !!x\,y\,z!!: $$T\,x\,y\,z = x\,z\,y$$ but does not otherwise alter the structure of the expression.

But why is !!S!! the “melting” or “fusion” combinator? It's because Schönfinkel was interested in reducing abitrary mathematical expressions to combinators. He will sometimes have an application !!(f\, x)(g\, x)!! and he wants to ‘fuse’ the two occurrences of !!x!!. He can do this by rewriting the expression as !!S\, f\, g\, x!!. Schönfinkel says:

Der praktische Nutzen der Function !!S!! besteht ersichtlich darin, daß sie es ermöglicht, mehrmals auftresnde Veränderliche — und bis zu einem gewissen Grade auch individuelle Functionen — nur einmal auftreten zu lassen.

Clearly, the practical use of the function !!S!! will be to enable us to reduce the number of occurrences of a variable — and to some extent also of a particular function — from several to a single one.

(Translation from van Heijenoort, p. 362.)

So there you have it: the !!S!! combinator is so-named not for substitution, but because S is the first letter of schmelzen, ‘to fuse’.


  • Schönfinkel, M. “Über die Bausteine der mathematischen Logik” (“On the building-blocks of mathematical logic”), Mathematische Annalen (1969), p. 305–316; Berlin, Göttingen, Heidelberg.

    English translation in Van Heijenoort, Jean (ed.) From Frege to Gödel: a Source Book in Mathematical Logic, 1879–1931 (1967) pp. 355–366 Harvard University Press; Cambridge and London.

  • Curry, H.B. “Grundlagen der kombinatorischen Logik” (“Fundamentals of combinatory logic”), _American Journal of Mathematics Vol. 52, No. 3 (Jul., 1930), pp. 509-536.

  • Curry, H.B. and Robert Feys Combinatory Logic (1958) p. 152 North-Holland Publishing Company, Amsterdam.

[Other articles in category /math] permanent link

Thu, 22 Jul 2021

The convergents of 2x

Take some real number !!\alpha!! and let its convergents be !!c_0, c_1, c_2, \ldots!!. Now consider the convergents of !!2\alpha!!. Sometimes they will include !!2c_0, 2c_1, 2c_2, \ldots!!, sometimes only some of these.

For example, the convergents of !!\pi!! and !!2\pi!! are

$$ \begin{array}{rlc} \pi & \approx & \color{darkblue}{3},&&& \color{darkblue}{\frac{22}{7}}, & \color{darkblue}{\frac{333}{106}}, && \color{darkblue}{\frac{355}{113}}, & \color{darkblue}{\frac{103993}{33102}}, && \frac{104348}{33215}, & \color{darkblue}{\frac{208341}{66317}}, & \ldots \\ 2\pi & \approx & \color{darkblue}{6}, & \frac{19}{3}, & \frac{25}{4}, & \color{darkblue}{\frac{44}{7}}, & \color{darkblue}{\frac{333}{53}}, & \frac{377}{60}, & \color{darkblue}{\frac{710}{113}}, & \color{darkblue}{\frac{103393}{16551}}, & \frac{312689}{49766}, && \color{darkblue}{\frac{416682}{66317}}, & \ldots \end{array}

Here are the analogous lists for !!\frac{1+\sqrt{5}}2!! and !!1+\sqrt5!!:

$$ \begin{array}{rlc} \frac12{1+\sqrt{5}}& \approx & 1, & 2, & \color{darkblue}{\frac32}, & \frac53, & \frac85, & \color{darkblue}{\frac{13}8}, & \frac{21}{13}, & \frac{34}{21}, & \color{darkblue}{\frac{55}{34}}, & \frac{89}{55}, & \frac{144}{89}, & \color{darkblue}{\frac{233}{144}}, & \frac{377}{233}, &\frac{610}{377} , & \color{darkblue}{\frac{987}{610} }, & \ldots \\ 1+\sqrt{5} & \approx & & & \color{darkblue}{3}, &&& \color{darkblue}{\frac{13}4}, &&& \color{darkblue}{\frac{55}{17}}, &&& \color{darkblue}{\frac{233}{72}}, &&& \color{darkblue}{\frac{987}{305}}, & \ldots \end{array} $$

This time all the convergents in the second list are matched by convergents in the first list. The number !!\frac{1+\sqrt5}{2}!! is notorious because it's the real number whose convergents converge the most slowly. I'm surprised that !!1+\sqrt5!! converges so much more quickly; I would not have expected the factor of 2 to change the situation so drastically.

I haven't thought about this at all yet, but it seems to me that a promising avenue would be to look at what Gosper's algorithm would do for the case !!x\mapsto 2x!! and see what simplifications can be done. This would probably produce some insight, and maybe a method for constructing a number !!\alpha!! so that all the convergents of !!2\alpha!! are twice those of !!\alpha!!.

[Other articles in category /math] permanent link

Fri, 09 Jul 2021

“Forensic” doesn't mean what I thought it did

Last week at work we released bad code, which had somehow survived multiple reviews. I was very interested in finding out how this happened, dug into the Git history to find out, and wrote a report. Originally I titled the report something like “Forensic analysis of Git history” (and one of my co-workers independently referred to the investigation as forensic) but then I realized I wasn't sure what “forensic” meant. I looked it up, and learned it was the wrong word.

A forensic analysis is one performed in the service of a court or court case. “Forensic” itself is from Latin forum, which is a public assembly place where markets were held and court cases were heard.

Forensic medicine is medicine in service of a court case, for example to determine a cause of death. For this reason it often refers to a postmortem examination, and I thought that “forensic” meant a postmortem or other retrospective analysis. That was the sense I intended it. But no. I had written a postmortem analysis, but not a forensic one.

[Other articles in category /lang/etym] permanent link

Thu, 08 Jul 2021

A simple dice-throwing game that seems hard to play

I ran into a fun math problem yesterday, easy to ask, easy to understand, but somewhat open-ended and seems to produce fairly complex behavior. It might be a good problem for a bright high school student to tinker with.

Consider the following one-player game. You start with a total of n points. On each turn, you choose to throw either a four-, six-, or eight-sided die, and then subtract the number thrown from your point total. The game continues until your total reaches zero (and you win) or goes below zero (and you lose).

This game seems surprisingly difficult to analyze. The computer analysis is quite easy, but what I mean is, if someone comes to you offering to pay you a dollar if you can win starting with !!n=9!! points, and it would be spoilsportish to say “just wait here for half an hour while I write this computer program”, what's your good move?

Is there even a way to make an educated guess, short of doing a full analysis? The !!n≤4!! strategy is obvious, but even for !!n=5!! you need to start calculating: rolling the d4 is safe. Rolling the d6 gives you a chance of wiping out, but also a chance of winning instantly; is that an improvement? (Spoiler: it is, quite substantially so! Your chance of winning increases from !!36\%!! to !!40.7\%!!.)

With the game as described, and optimal play, the probability of winning approaches !!45.66\%!! as the number of points increases, and the strategy is not simple: the best strategy for !!n≤20!! uses the d4 in 13 cases, the d6 in 4 cases, and the d8 in 3 cases:

$$\begin{array}{rcl} n & \text{Best play} & \text{Win %} \\ \hline 1 & 4\quad & 25.00\% \\ 2 & 4\quad & 31.25 \\ 3 & 4\quad & 39.06 \\ 4 & 4\quad & 48.83 \\ \hline 5 & 6 & 40.69\% \\ 6 & 6 & 47.47 \\ 7 & 4\quad & 44.01 \\ 8 & \quad8 & 47.04 \\ \hline 9 & 4\quad & 44.80\% \\ 10 & 4\quad & 45.83 \\ 11 & 4\quad & 45.42 \\ 12 & 4\quad & 45.77 \\ \hline 13 & 6 & 45.48 \% \\ 14 & \quad8 & 45.73 \\ 15 & 4\quad & 45.60 \\ 16 & \quad8 & 45.71 \\ \hline 17 & 4\quad & 45.63 \% \\ 18 & 4\quad & 45.67 \\ 19 & 4\quad & 45.65 \\ 20 & 6 & 45.67 \end{array} $$

It seems fairly clear (and not hard to prove) that when the die with fewest sides has !!d!! sides, the good numbers of points are multiples of !!d!!, with !!kd+1!! somewhat worse, and then !!kd+2, kd+3, \ldots!! generally better and better to the next peak at !!kd+d!!. But there are exceptions: even if !!d!! is not the smallest die, if you have a !!d!!-sided die, it is good to have !!d!! points, and when you do you should roll the !!d!!-sided die.

I did get a little more insight after making the chart above and seeing the 4-periodicity. In a comment on my Math SE post I observed:

There is a way to see quickly that the d4 is better for !!n=7!!. !!n=1!! is the worst possible position. !!n=2,3,!! and !!4!! are increasingly good; !!4!! is best because you can't lose and you might win outright. After that !!5!! is bad again, but not as bad as !!1!!, with !!6,7,8!! increasingly good. The pattern continues this way, with !!4k−3,4k−2,4k−1,4k!! being increasingly good, and then !!4k+1!! being worse again but better than !!4k−3!!. For !!n=7!!, the d6 allows one to land on !!\{1,2,3,4,5,6\}!!, and the d4 on !!\{3,4,5,6\}!!. But !!1!! is worse than !!5!! and !!2!! is worse than !!6!!, so prefer the d4.

The d4-d6-d8 case is unusually confusing, because for example it's not clear whether from 12 points you should throw d4, hoping to land on 8, or d6, hoping to land on 6. (I haven't checked but I imagine the two strategies perform almost equally well; similarly it probably doesn't matter much if you throw the d4 or the d6 first from !!n=10!!.)

That the d6 is best for !!n=13!! is very surprising to me.

Why !!45.66\%!!? I don't know. With only one die, the winning probability for large !!n!! converges to !!\frac2{n+1}!! which I imagine is a fairly straightforward calculation (but I have not done it). For more than one die, it seems much harder.

Is there a way to estimate the winning probability for large !!n!!, given the list of dice? Actually yes, a little bit: the probability of winning with just a d4 is !!\frac 25!!, and the d6 and d8 can't hurt, so we know the chance of winning with all three dice available will be somewhat more than !!40\%!!, as it is. The value of larger dice falls off rapidly with the number of sides, so for example with d4+d6 the chance of winning increases from !!40\%!! to almost !!45\%!!, and adding the d8 only nudges this up to !!45.66\%!!.

The probability of winning with a d2 is !!\frac 23!!, and if you have a d3 also the probability goes up to !!\frac 34!!, which seems simple enough, but if you add a d4 instead of the d3 instead it goes to !!68.965\%!!, whatever that is. And Dfan Schmidt tells me that d3 + d4 converges to !!\frac{512}{891}!!.

I wrote it up for Math StackExchange but nobody has replied yet.

Here's Python code to calculate the values. Enjoy.

[ Addendum: Michael Lugo points out that the d2+d4 probability (“!!68.965\%!!, whatever that is”) is simply !!\frac{20}{29}!!, and gives some other similar results. One is that d3+d4+d5 has a winning probability of !!\frac{16}{27}!!; the small denominator is surprising. ]

[Other articles in category /math] permanent link

Wed, 07 Jul 2021

Examples of dummy pronouns

Katara is interested in linguistics. When school was over for the year and she had time to think about things, I gave her all my old linguistics books. The other day for some reason I mentioned to her that I had known people who were engaged in formal research on the problem of how to get a computer to know what a pronoun referred to, and that this is very difficult.

(I once had a co-worker who claimed that it was simple: the pronoun always refers back to the nearest noun. It wasn't hard to go back in his Slack history and find a counterexample he had uttered a few minutes before.)

Today I wanted to tell Katara about dummy pronouns, which refer to nothing at all. I intended to send her the example from Wiktionary:

it is good to know that you are okay

I started my message:

Here's an interesting example of how hard it can be to find what a pronoun refers to

Then I realized I no longer needed the example.

[Other articles in category /lang] permanent link

Mon, 05 Jul 2021

Duckface in German

In English, this is called duckface:

Ariana Grande looking over her
shoulder with her lips abnormally everted

In German, I've learned, it's Schlauchbootlippen.

Schlauch is “tube”. A Schlauchboot is a tube-boat — an inflatable rubber dingy. Schlauchbootlippen means dinghy-lips.

[Other articles in category /lang/etym] permanent link

Sun, 27 Jun 2021

Dogs that look like board games

In Korean, “바둑이” (/badugi/) is a common name for a spotted dog, especially a black-spotted dog. This is because “바둑” (/baduk/) is the native Korean name for the game of go, in which round black and white stones are placed on a board.

In English, black-and-white spotted dogs are sometimes named “Checkers” for essentially the same reason.

[Other articles in category /lang/etym] permanent link

Mon, 19 Apr 2021

Odd translation choices

Recently I've been complaining about unforced translation errors. ([1] [2]) Here's one I saw today:

picture of two cows in a field.  One has a child-sized toy plastic car
on its head.  The cow with the car on its head is saying: “БИП-БИП ВАШ

The translation was given as:

“honk honk, your Uber has arrived”

“Oleg, what the fuck”

Now, the Russian text clearly says “beep-beep” (“бип-бип”), not “honk honk”. I could understand translating this as "honk honk" if "beep beep" were not a standard car sound in English. But English-speaking cars do say “beep beep”, so why change the original?

(Also, a much smaller point: I have no objection to translating “Что за херня” as “what the fuck”. But why translate “Что за херня, Олег?” as “Oleg, what the fuck” instead of “What the fuck, Oleg”?)

[ Addendum 20210420: Katara suggested that perhaps the original translator was simply unaware that Anglophone cars also “beep beep”. ]

[Other articles in category /lang] permanent link

Wed, 14 Apr 2021

More soup-guzzling

A couple of days ago I discussed the epithet “soup-guzzling pie-muncher”, which in the original Medieval Italian was brodaiuolo manicator di torte. I had compained that where most translations rendered the delightful word brodaiuolo as something like “soup-guzzler” or “broth-swiller”, Richard Aldington used the much less vivid “glutton”.

A form of the word brodaiuolo appears in one other place in the Decameron, in the sixth story on the first day, also told by Emilia, who as you remember has nothing good to say about the clergy:

… lo 'nquisitore sentendo trafiggere la lor brodaiuola ipocrisia tutto si turbò…

J. M. Rigg (1903), who had elsewhere translated brodaiuolo as “broth-guzzling”, this time went with “gluttony”:

…the inquisitor, feeling that their gluttony and hypocrisy had received a home-thrust…

G. H. McWilliam (1972) does at least imply the broth:

…the inquisitor himself, on hearing their guzzling hypocrisy exposed…

John Payne (1886):

the latter, feeling the hit at the broth-swilling hypocrisy of himself and his brethren…

Cormac Ó Cuilleanáin's revision of Payne (2004):

…the inquisitor himself, feeling that the broth-swilling hypocrisy of himself and his brethren had been punctured…

And what about Aldington (1930), who dropped the ball the other time and rendered brodaiuolo merely as “glutton”? Here he says:

… he felt it was a stab at their thick-soup hypocrisy…

Oh, Richard.

I think you should have tried harder.

[Other articles in category /lang] permanent link

Mon, 12 Apr 2021


A few months ago I was pondering what it might be like to be Donald Trump. Pretty fucking terrible, I imagine. What's it like, I wondered, to wake up every morning and know that every person in your life is only interested in what they can get from you, that your kids are eagerly waiting for you to die and get out of their way, and that there is nobody in the world who loves you? How do you get out of bed and face that bitter world? I don't know if I could do it. It doesn't get him off the hook for his terrible behavior, of course, but I do feel real pity for the man.

It got me to thinking about another pitiable rich guy, Ebeneezer Scrooge. Scrooge in the end is redeemed when he is brought face to face with the fact that his situation is similar to Trump's. Who cares that Scrooge has died? Certainly not his former business associates, who discuss whether they will attend his funeral:

“It's likely to be a very cheap funeral,” said the same speaker; “for, upon my life, I don't know of anybody to go to it. Suppose we make up a party, and volunteer.”

“I don't mind going if a lunch is provided," observed the gentleman with the excresence on his nose.

Later, the Spirit shows Scrooge the people who are selling the curtains stolen from his bed and the shirt stolen from his corpse, and Scrooge begs:

“If there is any person in the town who feels emotion caused by this man's death," said Scrooge, quite agonized, “show that person to me, Spirit, I beseech you!”

The Spirit complies, by finding a couple who had owed Scrooge money, and who will now, because he has died, have time to pay.

I can easily replace Scrooge with Trump in any of these scenes, right up to the end of chapter 4. But Scrooge in the end is redeemed. He did once love a woman, although she left him. Scrooge did have friends, long ago. He did have a sister who loved him, and though she is gone her son Fred still wants to welcome him back into the family. Did Donald Trump ever have any of those things?

[Other articles in category /book] permanent link

Soup-guzzling pie-munchers

The ten storytellers in The Decameron aren't all well-drawn or easy to tell apart. In the introduction of my favorite edition, the editor, Cormac Ó Cuilleanáin, says:

Early in the book we are given hints that we are going to get to know these ten frame characters…. Among the Decameron storytellers, for instance, Pampinea emerges as being bossy, while Dioneo has a filthy mind. But little further character development takes place.

I agree, mostly. I can see Dioneo more clearly than Ó Cuilleanáin suggests. Dioneo reminds me of Roberto Benigni's Roman filthy-minded Roman taxi driver in Night on Earth. I also get a picture of Bocaccio's character Filostrato, who is a whiny emo poet boy who complains that he woman he was simping for got tired of him and dumped him for someone else:

To be humble and obedient to her and to follow all her whims as closely as I could, was all of no avail to me, and I was soon abandoned for another. Thus I go from bad to worse, and believe I shall until I die.… The person who gave me the nickname of Filostrato [ “victim of love” ] knew what she was doing.

When it's Filostrato's turn to choose the theme for the day's stories, he makes the others tell stories of ill-starred love with unhappy endings. They comply, but are relieved when it is over. (Dioneo, who is excused from the required themes, tells instead a farcical story of a woman who hides her secret lover in a chest after he unwittingly drinks powerful sedative.)

Ah, but Emilia. None of the characters in the Decameron is impressed with the manners or morals of priests. But Emilia positively despises them. Her story on the third day is a good example. The protagonist, Tedaldo, is meeting his long-lost mistress Ermellina; she broke off the affair with him seven years ago on the advice of a friar who advised that she ought to remain faithful to her husband. Tedaldo is disguised as a friar himself, and argues that she should resume the affair. He begins by observing that modern friars can not always be trusted:

Time was when the friars were most holy and worthy men, but those who today take the name and claim the reputation of friars have nothing of the friar but the costume. No, not even that,…

Modern friars, narrates Emilia, "strut about like peacocks" showing off their fine clothes. She goes on from there, complaining about friars' vanity, and greed, and lust, and hypocrisy, getting more and more worked up until you can imagine her frothing at the mouth. This goes on for about fifteen hundred words before she gets back to Tedaldo and Ermellina, just at the same time that I get around to what I actually meant to write about in this article: Emilia has Tedaldo belittle the specific friar who was the original cause of his troubles,

who must without a doubt have been some soup-guzzling pie-muncher…

This was so delightful that I had to write a whole blog post just to show it to you. I look forward to calling other people soup-guzzling pie-munchers in the coming months.

But, as with the earlier article about the two-bit huckster I had to look up the original Italian to see what it really said. And, as with the huckster, the answer was, this was pretty much what Bocaccio had originally written, which was:

il qual per certo doveva esser alcun brodaiuolo manicator di torte

  • Brodaiuolo is akin to “broth”, and it has that disparaging diminutive “-uolo” suffix that we saw before in mercantuolo.

  • A manicator is a gobbler; it's akin to “munch”, “manger”, and “mandible”, to modern Italian mangia and related French manger. A manicator di torte is literally a gobbler of pies.

Delightful! I love Bocaccio.

While I was researching this article I ran into some other English translations of the phrase. The translation at Brown University's Decameron Web is by J.M. Rigg:

some broth-guzzling, pastry-gorging knave without a doubt

which I award full marks. The translation of John Payne has

must for certain have been some broth-swilling, pastry-gorger

and two revised versions of Payne, by Singleton and Ó Cuilleanáin, translate it similarly.

But the translation of Richard Aldington only says:

who must certainly have been some fat-witted glutton.

which I find disappointing.

I often wonder why translators opt to water down their translations like this. Why discard the vivid and specific soup and pie in favor of the abstract "fat-witted glutton"? What could possibly be the justification?

Translators have a tough job. A mediocre translator will capture only the surface meaning and miss the subtle allusions, the wordplay, the connotations. But here, Aldington hasn't even captured the surface meaning! How hard is it to see torte and include pie in your translation somewhere? I can't believe that his omitting it was pure carelessness, only that Aldington thought that he was somehow improving on the original. But how, I can't imagine.

Well, I can imagine a little. Translations can also be too literal. Let's consider the offensive Spanish epithet pendejo. Literally, this is a pubic hair. But to translate it in English as "pubic hair" would be a mistake, since English doesn't use that term in the same way. A better English translation is "asshole". This is anatomically illogical, but linguistically correct, because the metaphor in both languages has worn thin. When an anglophone hears someone called an “asshole” they don't normally imagine a literal anus, and I think similarly Spanish-speakers don't picture a literal pubic hair for pendejo. Brodaiuolo could be similar. Would a 14th-century Florentine, hearing brodaiuolo, picture a generic glutton, or would they imagine someone literally holding a soup bowl up to their face? We probably don't know. But I'm inclined to think that “soup-guzzler” is not too rich, because by this point in Emilia's rant we can almost see the little flecks of spittle flying out of here mouth.

I'm offended by Aldington's omission of pie-munching.

[ Addendum 20210414: More translations of brodaiuolo. ]

[Other articles in category /book] permanent link

Mon, 29 Mar 2021

Skin worms?

The King James Version of Job 19:26 says:

And though after my skin worms destroy this body, yet in my flesh shall I see God:

I find this mysterious for two reasons. First, I cannot understand the grammar. How is this supposed to be parsed? I can't come up with any plausible way to parse this so that it is grammatically correct.

Second, how did the worms get in there? No other English translation mentions worms and they appear to be absent from the original Hebrew. Did the KJV writers mistranslate something? (Probably not, there is nothing in the original to mistranslate.) Or is it just an interpolation?

Pretty ballsy, to decide that God left something out the first time around, but that you can correct His omission.

[Other articles in category /book] permanent link

Fri, 26 Mar 2021

Something I didn't know and I bet you didn't either

The Panama Canal has a loyalty program.

If you're planning to ship at least 450,000 TEU per year, you can register in advance and get a discount on your tolls.

[Other articles in category /misc] permanent link

Sun, 21 Mar 2021

Two sentences that made me stop to think

In The ancient fabric that no one knows how to make:

Islam was born in Bangladesh and moved to London about 20 years ago.

Whaaaat? Then I realized: It's someone named “Islam”. Okay.

In Wikipedia's article on some comic book person called “Steppenwolf”:

His decapitated head is crushed by the foot of Darkseid, enraged by his lieutenant's failure.

For this to be correct, Steppenwolf would have to have a second head growing out of his main head. Then if someone cut off the second head, the main head would be a decapitated head.

Not out of the question for a comic book person, but in this case not correct. I changed it to “disembodied head”.

[ Addendum 20210322: Shortly afterward, another editor changed it to “severed head”, which I agree is better. ]

[Other articles in category /misc] permanent link

Sun, 14 Mar 2021

Synthesizer bands

Many years ago I bought tickets to see Depeche Mode live, and I wondered if I wasn't making a mistake. Would they appear on stage, press “play” on the sequencers, and then stand around doing nothing while Dave Gahan sang?

And yes, it was pretty much like that. They were definitely overstaffed. I think there were four people on stage and at any particular time one or two of them were standing around looking bored.

I hadn't thought of this in a long time, but I was reading a Washington Times article about the German synth-pop band Alphaville, contemporaries of Depeche Mode. The article is from 2017, and includes this exchange:

Question: How is it possible that you’ve never played live in America before?

Answer: In the ‘80s we didn’t play live at all because we couldn’t play.

Meaning, they couldn't play any actual instruments. Marian Gold sang, but the rest of the music was preprogrammed on sequencers or assembled in an editing studio. The group composed and produced the music, but there simply was no "performance" in real time. I have to credit Alphaville for refusing to pretend to be performers and instrumentalists.

(For an contrasting approach, consider The Residents, who face the same issue and have dealt with it in a completely different way. The Residents’ stage show is elaborate and spectacular. You hear the music, but there's no way to know who's playing it. There are people on the stage, but are they the composers? Are they instrumentalists? Are they even in the band? Who knows? And does it matter? No, not really. The Residents have never had names or separate identities anyway. I imagine that Daft Punk took a similar approach.)

[Other articles in category /music] permanent link

Fri, 12 Mar 2021

Trans-Siberian Railway

For no particular reason, I looked up the Trans-Siberian Railway today and learned that its name in Russian is

Транссибирская магистраль

pronounced roughly “trans-siberskaya magistral”. The Транссибирская is clear, but what is магистраль?

Wiktionary says it means "main line" or "trunkline". But it doesn't give an etymology. Still, it's not hard to guess: it's akin to the French (and also English) word “magistral” which means something that relates to a master.

So it's the Trans-Siberian master train line. But "train line” is implicit, the way English-speaking recording engineers use "master" to refer to a master tape, or Americans will call a trunk road an "arterial". English loves to turn adjectives into nouns in that way, but I didn't know that Russian did it also.

[Other articles in category /lang] permanent link

Thu, 11 Mar 2021

Debate between Bird and Fish

I recently read Finkel and Taylor's excellent little book Cuneiform. On page 27 they discuss the kinds of texts that young boys studied in school:

Alongside ‘citizenship training’ through hymns, myths and law codes, schoolboys learnt how to debate. They trained on texts arguing the benefits to mankind of antagonistic pairs: winter and summer, sheep and grain or bird and fish.

“Hey,” I said. “I've read that!” I love when this happens, something pops up that I would have wanted to know a little more about, but it's already something I do know a little more about. I feel like I'm getting somewhere in my project of reading every book ever written. Progress!

From The Debate Between Bird and Fish, Sumerian, around 4000 years ago:

“You cause damage in the vegetable plots; you are a nuisance. In the damp parts of fields, there are your unpleasing footprints. Bird, you are shameless: you fill the courtyard with your droppings.”

Bird retorts:

You are bereft of hips!

It's not so much a debate as a diss battle.

[ Addendum 20210312: Now I would like to see an cartoon version of the debate, animated by Chuck Jones. ]

[Other articles in category /lang] permanent link

Mon, 08 Mar 2021

Canon in Euopean languages and Arabic

Today I was reading about Avicenna's work The Canon of Medicine and learned that the original Arabic title

القانون في الطب

is rendered in Latin script as al-Qānūn fī al-Ṭibb with al-Qānun (“the law”) being translated into English as “Canon” (“rule” or “law”). The English word comes via French and Latin, ultimately from Greek κανών, “rule”.

Is the resemblance between Qānūn and κανών a coincidence, or is the Arabic word originally borrowed from Greek?

I was about to write the next sentence “and where could I have looked this up?” but then I remembered that this kind of thing can be looked up in English Wiktionary. English Wiktionary is not a dictionary of English, but a universal dictionary in English. It not only defines English words, but also words in many other languages, with the descriptions and etmologies written in English.

So I looked it up, and it is a Greek loanword!

The Internet is amazing and wonderful. Truly, we live in an age of marvels.

[Other articles in category /lang/etym] permanent link

Sun, 07 Mar 2021

Henry G. Baker archive

(Summary: Henry Baker's web site has disappeared after 30 years. I kept an archive.)

Henry G. Baker is a computer programmer and computer scientist, one of the founders of the Symbolics company that made Lisp Machines.

I discovered Baker's writing probably in the early 1990s and immediately put him on my “read everything this person writes” list. I found everything he wrote clear and well-reasoned. I always learned something from reading it. He wrote on many topics, and when he wrote about a topic I hadn't been interested in, I became interested in it because he made it interesting.

Sometimes I thought Baker was mistaken about something. But usually it was I who was mistaken.

Baker had a web site with an archive of his articles and papers. It disappeared last year sometime. But I have a copy that I made around 1998, Just In Case.

Baker's web site is a good example of mid-1990s web design. Here's his “Gratuitous Waste of Bandwidth” page. It features a link to a 320×240 pixel color photo of Baker, and an inlined monochrome GIF version of it.

Browsers at the time could inline GIF files but not JPEGs, and it would have been rude to inline a color JPEG because that would have forced the user to wait while the browser downloaded the entire 39kb color image. It was a rather different time.

Some of my favorite articles of his were:

(The Internet Archive also has a more recent copy of the site.)

[Other articles in category /prog] permanent link

Sat, 06 Mar 2021

Pasta la Vista

Last week I thought “there must be a restaurant in California somewhere called ‘Pasta la Vista, Baby’”, so I asked the Goog. The Goog says it does not know of one!

It says there is a ‘Pasta La Vista’ in Winnipeg, which I was not expecting, and also one called ‘Pasta A La Vista‘ which has an acceptable excuse, since it is in Bella Vista, AR.

There are quite a few Pasta La Vistas in Europe. And there is one called ‘Pasta la Vista Baby’. It is near the University in Örebro, sixth-largest city in Sweden. This isn't the last place I would have expected to find ‘Pasta la Vista Baby’, but I don't think it's in the top thousand either.

[Other articles in category /food] permanent link

Tue, 02 Mar 2021


Often when I'm reading something that was translated from another language, I get to wondering what the original was. Often this appears in connection with some sort of wordplay. For example, the first chapter of Stanisław Lem's novel The Cyberiad begins:

One day Trurl the constructor put together a machine that could create anything starting with n. When it was ready, he tried it out, ordering it to make needles, then nankeens and negligees, which it did, then nail the lot to narghiles filled with nepenthe and numerous other narcotics. The machine carried out his instructions to the letter. Still not completely sure of its ability, he had it produce, one after the other, nimbuses, noodles, nuclei, neutrons, naphtha, noses, nymphs, naiads, and natrium. This last it could not do, and Trurl, considerably irritated, demanded an explanation.

"Never heard of it," said the machine.

"What? But it's only sodium. You know, the metal, the element..."

"Sodium starts with an s, and I work only in n."

In the end Trurl asks the machine to make “nothing”, which is an important plot point.

Okay, but The Cyberiad was written in Polish. I wondered for years: was it “N” in Polish also? If the Polish word for “nothing” happened to begin with a “W”, then the Polish text would have had to have had a machine that could create anything starting with “W”. Then the translator couldn't keep the “W” the way it was, because the whole point of the story leads up to “nothing”; they have to rewrite the whole thing with “N”.

One day I met the translator, Michael Kandel, and was able to ask. And yes, it was originally “N”; the polish word for “nothing” is nic.

(Here's a related question on SF Stack Exchange. It discusses how the original “N” items turn into their somewhat-similar “N” counterparts in English.)

But anyway, I meant to talk about Pippi Longstocking, which was originally written in Swedish.

Pippi and the Ibex

In one episode, Pippi goes to school, where the teacher tries to teach her the alphabet. She shows her a card with a letter ‘i' and a picture of an ibex. Pippi says:

“I think it looks exactly like a straight line with a little fly speck over it. But what I'd really like to know is, what has the ibex to do with the fly speck?”

Clearly Pippi is describing a lowercase letter ‘i’. “Ibex” is a pretty strange choice of animal, in English or in Swedish, so I wondered: was the picture an ibex in the original Swedish? It turns out it was not! “Ibex” in Swedish is stenbock. In the original Swedish, the picture is an igelkott, a hedgehog.

Well, in the translation I had as a kid, by Florence Lamborn, it was an ibex. But a different English translation (by Tiina Nunnaly) makes it an iguana, and another that I found, by Edna Hurup, contains the following elaborate invention:

[The teacher] therefore brought out a picture of a pretty little green island surrounded by blue water.

My philosophy of translation is opposed to this sort of thing. I will take all sorts of liberties, and I might make up an island if I have to, but having done so I would not describe it in detail as Ms. Hurup did so shamelessly. In the original the hedgehog is not described:

Därför tog hon fram en liten vacker plansch föreställande en igelkott.

(“Therefore, she took out a small, beautiful poster depicting a hedgehog.”)


Today I was thinking about Pippi, and I recalled that one of her goals in attending school was to learn “pluttification”:

“Hey, everybody,” hollered Pippi, swinging her big hat. "Am I in time for pluttification?”

In English “pluttification” is obviously Pippi's misunderstanding of “multiplication”:

“All kinds of things,” said the officer. “Lots of useful things, like the multiplication tables, for instance.”

“I've been fine for nine years without any pluttification tables,” said Pippi…

What was pluttification in Swedish?

It turns out, it wasn't any different. The Swedish for “multiplication tables” is multiplikationstabellen.

”Hejsvejs”, hojtade Pippi och svängde sin stora hatt. ”Kommer jag lagom till pluttifikationen?”

Pippi's Name

Long ago I wondered about Pippi's full name, which in the Lamborn version I read was:

Pippilotta Delicatessa Windowshade Mackrelmint Ephraim's Daughter Longstocking

The original Swedish was:

Pippilotta Viktualia Rullgardina Krusmynta Efraimsdotter Långstrump

and the English was a fairly close translation. Viktualier is “victuals”, and I think turning it into “Delicatessa” is clever. (Viktualia is actually a real Swedish name, although quite rare.) Rullgardina is exactly “windowshade”. (Literally “roll-curtain”.) Krusmynta is a nonsense compound of krus (see below) and mynta (mint). I thought that krus was “mackerel” but I can't find anyone to agree with me; everyone says that the Swedish for “mackerel” is makrill, as in most European languages.

The Nunnaly translation has:

Pippilotta Comestibles Windowshade Curlymint Ephraimsdaughter Longstocking

“Commestibles” is terrible, but “Curlymint” is just fine, because krusig is indeed “curly”.

The Hurup translation says:

Pippilotta Provisionia Gaberdina Dandeliona Ephraimsdaughter Longstocking

I don't like “Provisionia”, but it can be defended as a more literal translation than “Delicatessa”. I can't imagine why Hurup decided to replace “Windowshade Curlymint” with “Gaberdina Dandeliona”.

English Wikipedia has a whole section about this if you are not tired of it yet.


I recall that in the version I read, Captain Ephraim was "formerly the Terror of the Seas, and now a cannibal king", and that the original Swedish version of “cannibal king” was negerkung, “king of the negroes”. Mathilda Haraldsson's undergraduate thesis describes this as a “quite strong expression”, but adds that in the 1940s neger was considered inoffensive. (Recall that in the United States at the time, “negro” was the polite term.) It does appear that some people today consider negerkung offensive. And in any case it was never accurate; the people in question are not Africans, but Polynesians. In the Swedish version I looked at just now, the word has been changed to söderhavskung, “King of the South Seas”.

To me the most offensive part of all this is Lamborn's description of Ephraim's subjects as “cannibals” . As far as I can tell, the original Swedish says nothing about cannibalism, and this is a disgusting and completely unnecessary invention. Nunnaly makes it just “king of the natives” but Hurup inexplicably retains “Cannibal King”.

Norwegian Wikipedia has an article about Lindgren's use of negerkung, but Swedish Wikipedia does not!

[ Addendum: I just noticed that my discussion of the cannibal thing omits the word “racist”. This was an oversight. The cannibal thing is racist. ]

[ Addendum 20210303: Justin Pearson, Anders Nielsen, and Adam Sjøgren have each informed me that krusmynta is not a nonsense compound as I said. It is a standard term for spearmint. Also, is not Swedish Wikipedia. The language code for Swedish is sv. Wikipedia SE is Northern Sami Wikipedia. ]

[Other articles in category /lang] permanent link

Mon, 01 Mar 2021

More fuckin' user interface design

Yesterday I complained that Google couldn't find a UI designer who wouldn't do this:

Three circular
red-and-white buttons, one with an icon of a microphone, one with an
icon of a hanging-up telephone handset, and one with an icon of a
video camera.

Today I'm going to complain about the gmail button icons. Maybe they were designed by the same person?

Check out the two buttons I have circled.

One of these "archives" the messages, which means that it moves the messages out of the Inbox.

The other button moves the messages into the Inbox.

I don't know the right way to express this, but I know the wrong way when I see it, and the wrong way is and .

How about, ummm, maybe make the arrows go in opposite directions? How about, put the two buttons next to one another so that the user at least is likely to notice that both of them exist? Maybe come up with some sort of symbol for an archive, like a safe or a cellar or something, and use the same symbol in both icons, once with an arrow going in and once with an arrow coming out? Or did Google test this and they found that the best user experience was when one button was black and one was white? (“Oh, shit!" says the confused Google engineer, “I was holding the survey results upside-down.”)

I explained in the last article that I consider myself an incompetent designer. But I don't think I'm incompetent enough to have let and into production.

Hey, Google, would you like to hire me? Someone once said that genius is the ability to do effortlessly what most people can't do at all, and it appears that compared with Google UI engineers, I'm a design genius. For an adequately generous salary, I will be happy to whack your other designers on their heads with a rolled-up newspaper until they learn to stop this bullshit.

[Other articles in category /tech] permanent link

Sat, 27 Feb 2021

Fuckin' user interface design, I swear

I'm so old I can remember when forms were introducted to the web; as you can imagine it was a big advance. The initial spec included the usual text boxes, radio buttons, and so forth, two types of “submit” buttons, and a “reset” button. Clicking “reset” would reset the form contents to a defined initial state, normally empty.

So you'd have a bunch of form widgets, and then, at the bottom, a Submit button, and next to it, a Reset button.

Even as an innocent youth, I realized this was a bad design. It is just setting people up for failure. They might get the form all filled out, be about to submit it, but click a few pixels off, hit the Reset button by mistake, and have to start all over again.

Obviously, the Submit button should be over on the left, just under the main form, where the user will visit it in due course after dealing with the other widgets, and the Reset button should be way over on the right, where it is less likely to be hit by accident.

(Or, more likely, it shouldn't be anywhere; in most cases it is nothing but an attractive nuisance. How often does someone need to reset the form anyway? How badly would they have to screw it up to decide that it would be quicker to start over than to simply correct their errors?)

Does my “obviously” come across as superior and condescending? Honestly, it comes from a place of humility. My thinking is like this:

  • The field of user inteface design is skilled work
  • I have no training or experience in this field
  • Also, I have no talent in design generally (Just look at this page!)
  • Experience has proved that I am very stupid about this whole area
  • But this particular problem is apparent even to a blockhead like me
  • So it must be extremely obvious

But maybe I'm not giving myself enough credit. I said “obviously” but it sure wasn't obvious to many people at the time. I remember 90% of the forms I encountered having that Reset button at the bottom, at least into the late 1990s.

A still from _The Simpsons_, showing
the sushi chef's instruction book, open to the page about “FUGU”.  A
surly purple fish is depicted.  Several large sections are marked off
with dotted lines and labeled with skulls.  Only one narrow sliver
lacks a skull-and-crossbones.

And it's on my mind because my co-workers had a discussion about it at work last week: don't put the Cancel button right next to the Submit button. If this was obvious to dumbass me in 1994, why isn't it common knowledge by now?

Don't put the Yes button right next to the No button. That encourages mistakes. Obviously.

Don't put the commonly-used "close this window" keyboard shortcut right next to the infrequently-used and irreversible "quit this application" shortcut. In particular, don't put "close this window" on control-W and "quit this application" on control-Q. I'm looking at you, Firefox.

And that brings me to my real point. Can we talk about Google Meet?

These three buttons are at the bottom of the Google Meet videoconferencing app. The left one temporarily mutes and unmutes the microphone. The right one controls the camera similarly.

Three circular
red-and-white buttons, one with an icon of a microphone, one with an
icon of a hanging-up telephone handset, and one with an icon of a
video camera.

And if you click the button in between, you immediately leave the meeting and quit the app.

Now, as I said I'm pretty damn stupid when it comes to design, but geez, louise. Couldn't Google find someone less stupid than me?

[ Addendum 20210228: Google fucks up again. ]

[Other articles in category /tech] permanent link

Tue, 16 Feb 2021

The ideal gas law

Katara is toiling through A.P. Chemistry this year. I never took A.P. Chemistry but I did take regular high school chemistry and two semesters of university chemistry so it falls to me to help her out when things get too confusing. Lately she has been studying gas equilibria and thermodynamics, in which the so-called ideal gas law plays a central role: $$ PV=nRT$$

This is when you have a gas confined in a container of volume !!V!!. !!P!! is the pressure exerted by the gas on the walls of the container, the !!n!! is the number of gas particles, and the !!T!! is the absolute temperature. !!R!! is a constant, called the “ideal gas constant”. Most real gases do obey this law pretty closely, at least at reasonably low pressures.

The law implies all sorts of interesting things. For example, if you have gas in a container and heat it up so as to double the (absolute) temperature, the gas would like to expand into twice the original volume. If the container is rigid the pressure will double, but if the gas is in a balloon, the balloon will double in size instead. Then if you take the balloon up in an airplane so that the ambient pressure is half as much, the balloon will double in size again.

I had seen this many times and while it all seems reasonable and makes sense, I had never really thought about what it means. Sometimes stuff in physics doesn't mean anything, but sometimes you can relate it to a more fundamental law. For example, in The Character of Physical Law, Feynman points out that the Archimedean lever law is just an expression of the law of conservation of energy, as applied to the potential energy of the weights on the arms of the lever. Thinking about the ideal gas law carefully, for the first time in my life, I realized that it is also a special case of the law of conservation of energy!

The gas molecules are zipping around with various energies, and this kinetic energy manifests on the macro scale as as pressure (when they bump into the walls of the container) and as volume (when they bump into other molecules, forcing the other particles away.)

The pressure is measured in units of dimension !!\frac{\rm force}{\rm area}!!, say newtons per square meter. The product !!PV!! of pressure and volume is $$ \frac{\rm force}{\rm area}\cdot{\rm volume} = \frac{\rm force}{{\rm distance}^2}\cdot{\rm distance}^3 = {\rm force}\cdot{\rm distance} = {\rm energy}. $$ So the equation is equating two ways to measure the same total energy of the gas.

Over on the right-hand side, we also have energy. The absolute temperature !!T!! is the average energy per molecule and the !!n!! counts the number of molecules; multiply them and you get the total energy in a different way.

The !!R!! is nothing mysterious; it's just a proportionality constant required to get the units to match up when we measure temperature in kelvins and count molecules in moles. It's analogous to the mysterious Cookie Constant that relates energy you have to expend on the treadmill with energy you gain from eating cookies. The Cookie Constant is !!1043 \frac{\rm sec}{\rm cookie}!!. !!R!! happens to be around 8.3 joules per mole per kelvin.

(Actually I think there might be a bit more to !!R!! than I said, something about the Boltzmann distribution in there.)

Somehow this got me and Katara thinking about what a mole of chocolate chips would look like. “Better use those mini chips,” said Katara.

[Other articles in category /physics] permanent link

Mon, 15 Feb 2021

Mystery twitter language

Today someone tweeted about an earlier blog article of mine, saying

10° bir kvadratda ən böyük şəhərləri görə biləcəyiniz bir xəritə olan bir sayt.

I looked at that and frowned, and said “What language is that? … is it Azerbaijani?” And it is Azerbaijani! Last time I encountered Azerbaijani I did not recognize it. So I not only learned something last April, I remembered it the following February when it came up again. Yay me!

[Other articles in category /lang] permanent link

Sat, 13 Feb 2021

Paul L. Smith as Bluto

Yesterday I wondered who Robert Altman had cast as Bluto in his 1980 live-action film Popeye. The answer turned out to be Paul L. Smith, who seemingly was born to play the part:

Paul L. Smith
is a heavyset, slightly overwight man with a thick, curly black beard
and mustache.  In this (grayscale) picture his shirt, which appears to
be velour, is open at the neck, dispolaying a necklace with a large
star resting among a profusion of curly black chest hair.  He is
wearing a battered leather hat with a wide brim, and is looking
sidelong at the camera, with a smile of amusement.

I have thought for years about how Shelley Duval was seemingly born to play the part of Olive Oyl. (I remember the Mad magazine parody making this observation at the time, and it wasn't funny because it was so obvious.) I have somtimes wondered if Altman got the idea to make a Popeye movie specifically so that he could cast Duval as Olive Oyl.

Anyway, Paul L. Smith, who already looked like Bluto. He was in a fair number of TV productions in the 70s and 80s, and I think it's possible that I saw him in one or another one. But the only other role of his that I remember clearly is from David Lynch's 1984 Dune. He plays Glossu “the Beast” Rabban. Who in many ways is not that different from Bluto: Large, violent, dangerous for his brutality but not his cunning.

Obviously the Baron wanted to cast Feyd-Rautha as Popeye, but events got away from him and Paul became Popeye instead. In a Dune-Popeye crossover I can see Alia as Swee'Pea. That means that Chani has to be Olive, which I can live with.

The correspondence isn't perfect, of course. There is nobody in Popeye like Lady Jessica or Stilgar. (Leto is obviously Poopdeck Pappy.) On the other side, where is J. Wellington Wimpy? It's been a while since I read the book, but I don't remember hom appearing. Reverend Mother Gaius Helen Mohiam is clearly the Sea Hag.

Me spinach musk flow! If ya controlsk the spinach, ya controlsk the uni-voice! Ag-ag-ag-ag-ag!

[Other articles in category /misc] permanent link

Mon, 08 Feb 2021

Down in the dumps

I was reading The Life and Prankes of Long Meg of Westminster (1655), which opens with the story of how Long Meg first came to London with a posse of three or four girlfriends. After long travel they came within sight of London, “which joyed their hearts greatly.” But as they got closer, Meg's friends became less cheerful, and she said to them:

What Lasses in a dumpe, and we so nigh London?

If someone had asked me to guess when “in a dump” or “in the dumps” had been coined, I think I would have guessed sometime in the early 20th century. Nope! The Big Dictionary has cites back to 1535, which is when Long Meg takes place. It also cites a 1785 dictionary for “down in the dumps” specifically. The phrase is not connected with the dump where you dump a load of trash, which is of much later coinage.

It transpires that the lasses are in a dumpe because they realize that time has come to pay the carrier who has helped transport them to London, and believe he is likely to try to cheat them and take everything they have. Meg says she will reason sweetly with the carrier, and if that doesn't work, she will beat the crap out of him.

The carrier does try to take everything they have, but becomes much more helpful after Meg has beaten him with a cudgel.

Here it is if you would like to read it yourself.

[Other articles in category /lang] permanent link

Sun, 07 Feb 2021

More things that changed in later editions of Snow White

As you know, I've recently been looking into the original version of Snow White from 1812. ([1] [2]) I knew that the 1812 version of the Grimm stories was a lot rougher and more gruesome than the later editions, but I missed many of the details. For example, in the later versions, the evil queen orders her hunter to bring back Snow White's liver and lungs as proof that he has murdered her. In the first edition, she wants the liver and lungs so that she can eat them.

After Snow White is poisoned with the apple, the dwarfs put her in a glass coffin. A prince happens by and begs them to give it to him, which they do. In the later versions, the servants carrying away the coffin stumble, the apple is dislodged from Snow White's throat, and she returns to life.

In the original version, they get the coffin back to the prince's palace without mishap. There the prince has the servants carry it from room to room so that he can gaze at it always. (Ugh.)

Finally, the servants are so fed up with this that one of them takes Snow White out of the coffin, stands her up, and, saying

We are plagued the whole day long, just because of such a dead girl

he clouts her in the back from pure spite.

The apple is dislodged, and Snow White marries the prince.

[Other articles in category /book] permanent link

Sat, 06 Feb 2021

Hacking the git shell prompt

Git comes with a very complicated shell function,, called __git_ps1, for interpolating Git information into your shell prompt. A typical use would be:

    PS1='>>> $(__git_ps1) :) '

PS1 is the variable that contains the shell's main prompt. Before printing the prompt, the shell does variable and command interpolation on this string. This means that if PS1 contains something like $(command args...), the shell replaces that string with the output from running command args…. Here, it runs __git_ps1 and inserts the output into the prompt. In the simplest case, __git_ps1 emits the name of the currently-checked-out branch, so that the shell will actually print this prompt:

    >>> the-branch :) 

But __git_ps1 has many other features besides. If you are in the middle of a rebase or cherry-pick operation, it will emit something like

    the-branch|REBASE-i 1/5



instead. If HEAD is detached, it can still display the head location in several formats. There are options to have the emitted string indicate when the working tree is dirty and other things. My own PS1 looks like this:

    PS1='[$(_path) $(__git_ps1 "(%s)" )]> '

The _path command is something I wrote to emit the path of the current working directory, abbreviated in a contextually dependent way. It makes my prompt look like this:

    [lib/app (the-branch)]> 

Here lib/app is the path relative to the root of the repository.

The %s thing is an additional formatting instruction to __git_ps1. After it computes the description string, __git_ps1 inserts it into "(%s)" in place of the %s, and emits the result of that replacement. If you don't give __git_ps1 an argument, it uses "(%s) " as a default, which has an extra space compared with what I have.

Lately I have been experimenting with appending .mjd.yyyymmdd to my public branch names, to help me remember to delete my old dead branches from the shared repository. This makes the branch names annoyingly long:


and these annoyingly long names appear in the output of __git_ps1 that is inserted into my shell prompts.

One way to deal with this is to have the local branch names be abbreviated and configure their upstream names to the long versions. And that does work: I now have a little program called new-branch that creates a new branch with the local short name, pushes it to the long remote name, and sets the upstream. But I also wanted a generic mechanism for abbreviating or transforming the branch name in the prompt.

The supplied __git_ps1 function didn't seem to have an option for that, or a callback for modifying the branch name before inserting it into the prompt. I could have copied the function, modified the parts I wanted, and used the modified version in place of the supplied version, but it is 243 lines long, so I preferred not to do that.

But __git_ps1 does have one hook. Under the right circumstances, it will attempt to colorize the prompt by inserting terminal escape codes. To do this it invokes __git_ps_colorize_gitstring to insert the escape codes into the various prompt components before it assembles them. I can work with that!

The goal is now:

  • Figure out how to tell __git_ps1 to call __git_ps_colorize_gitstring
  • Figure out how __git_ps1 and __git_ps_colorize_gitstring communicate prompt components
  • Write my own __git_ps_colorize_gitstring to do something else

How to tell __git_ps1 to call __git_ps_colorize_gitstring

You have to do two things to get __git_ps1 to call the hook:

  1. Set GIT_PS1_SHOWCOLORHINTS to some nonempty string. I set it to true, which is a little deceptive, because false would have worked as well.

  2. Invoke __git_ps1 with two or more arguments.

Unfortunately, invoking the __git_ps1 with two or more arguments changes its behavior in another way. It still computes a string, but it no longer prints the string. Instead, it computes the string and assigns it to PS1. This means that

  PS1="$(__git_ps arg arg….)"

won't work properly: the next time the shell wants to prompt, it will evaluate PS1, which will call __git_ps arg arg…, which will set PS1 to some string like (the-branch). Then the next time the shell wants to print the prompt, it will evaluate PS1, which will be just some dead string like (the-branch), with nothing in it to call __git_ps1 again.

So we need to use a different shell feature. Instead of setting PS1 directly, we set PROMPT_COMMAND. This command is run before the prompt is printed. Although this doesn't have anything to do directly with the prompt, the command can change the prompt. If we set PROMPT_COMMAND to invoke __git_ps1, and if __git_ps1 modifies PS1, the prompt will change.

Formerly I had had this:

    PS1='[$(_path) $(__git_ps1 "(%s)")]> '

but instead I needed to use:

    PROMPT_COMMAND='__git_ps1 "[$(_path) " " ] "' "(%s)"

Here __git_ps1 is getting three arguments:

  1. "[$(_path) "
  2. " ] "
  3. "(%s)"

__git_ps1 computes its description of the Git state and inserts it into the third argument in place of the %s. Then it takes the result of this replacement, appends the first argument on the front and the second on the back, and sets the prompt to the result. The shell will still invoke _path in the course of evaluating the first string, before passing it to __git_ps1 as an argument. Whew.

How __git_ps1 communicates prompt components to __git_ps_colorize_gitstring

The end result of all this rigamarole is that __git_ps1 is now being called before every prompt, as before, but now it will also invoke __git_ps_colorize_gitstring along the way. What does that actually get us?

The internals of __git_ps_colorize_gitstring aren't documented because I don't think this is a planned use case, and __git_ps_colorize_gitstring isn't an advertised part of the interface. __git_ps1 does something to construct the prompt, possibly colorizing it in the process, but how it does the colorizing is forbidden knowledge. From looking at the code I can see that the colorizing is done by __git_ps_colorize_gitstring, and I needed to know what was going in inside.

The (current) interface is that __git_ps1 puts the various components of the prompts into a family of single-letter variables, which __git_ps_colorize_gitstring modifies. Here's what these variables do, as best as I have been able to ascertain:

b contains a description of the current HEAD, either the current branch name or some other description

c indicates if you are in a bare repository

i indicates if changes have been recorded to the index

p contains information about whether the current head is behind or ahead of its upstream branch

r describes the rebase / merge / cherry-pick state

s indicates if there is something in the stash

u indicates whether there are untracked files

w indicates whether the working tree is dirty

z is the separator between the branch name and the other indicators

Oddly, the one thing I wanted to change is the only one that __git_ps_colorize_gitstring doesn't modify: the b variable that contains the name or description of the current branch. Fortunately, it does exist and there's nothing stopping me from writing a replacement __git_ps_colorize_gitstring that does modify it.

Write a replacement for __git_ps_colorize_gitstring to do something else

So in the end all I needed was:

    PROMPT_COMMAND='__git_ps1 "[$(_path) " " ] "' "(%s)"

    __git_ps1_colorize_gitstring () {

The ${b%%PAT} thing produces the value of the variable b, except that if the value ends with something matching the pattern PAT, that part is removed. So the first assignment trims a trailing .20210206 from the branch name, if there is one, and the second trims off a trailing .mjd. If I wanted to trim off the leading gh also I could use b=${b##gh}.

There's probably some way to use this in addition to the standard __git_ps_colorize_gitstring, rather than in place of it. But I don't know how.

In conclusion

This was way harder to figure out than it should have been.

[Other articles in category /prog] permanent link

Wed, 03 Feb 2021

We visit the town of Gap

Katara and I went to visit the town of Gap, PA. In Gap there are so many eagles that they have these special bins for getting rid of the extras.

[Other articles in category /misc] permanent link

Tue, 02 Feb 2021

Hildebert and the mouse

This is the famous self-portrait of Hildebert, a 12th century scribe in what is now the Czech Republic. In this picture, Hildebert is shaking his fist at a mouse, which is eating his lunch.

A pen drawing,
in black and red ink, or some sort of neutral-colored medium.  The
rest of this article describes the drawing in detail.

There is quite a lot going on here! First off, Hildebert is carrying one of his quill pens behind his ear. This seems to me like a good way to get ink in your hair, and I wonder if medieval scribes often had smudges on their forheads.

I think the thing in his hand is a piece of bread. But what is on the table? I think the mouse is eating Hildebert's cheese (we can see the already-cut piece under the mouse's butt) and there seems to have been a small roast bird of some type, which the mouse has upset but which has not yet hit the floor. The table with the mouse is labeled Mensa hildeberti, “Hildebert's table”, in case it was unclear just whose lunch was being stolen.

Hildebert seems to be wearing a long garment with fancy matching sleeves and collar, and over that what looks like a chiton. I wonder if Hildebert really wore a chiton?

On the left of the picture is a really interesting piece of equipment. Until I saw this picture, it had never occurred to me that the lap desk had been invented before I was born. But here it is, almost nine hundred years ago. And it certainly is a lap desk, having no legs. In this picture the lap desk is supported by a backward-headed lion, but in actual practice such luxuries are probably hard to come by, so Hildebert would have put the desk on his lap.

The two long curvy things on the left edge of the lap desk are not legs. They are inkhorns: sawn-off animal horns, filled with ink. When you need to get more ink on your quill, you dip the end in the inkhorn. I had heard of inkhorns but until I saw this picture I had never understood how you used them: they won't stand up, and if you lay them down the ink will spill. But Hildebert's picture makes it perfectly clear: the lap desk has a couple of round holes in it, and you slide the inkhorns into the holes until they stop. Very nice! Next to the inkhorns are two extra quills, and along the bottom edge of the lap desk there is a ridge to keep the paper or parchment from sliding into your lap. I am pretty sure that the lion is holding the desk by the bottom edge, so that it is presented to Hildebert sideways. Hildebert is too enraged by the mouse to care about this.

Also on the desk is a booklet, in which (according to Wikipedia) Hildebert has written:

Pessime mus, saepius me provocas ad iram. Ut te deus perdat

I think I can make this out. (Medieval scribes used a great many abbreviations. For example, iram is written as “irã”. Similarly, the hildeberti above the table is abbreviated to “hildebti”. If you are interested, I discussed scribal abbreviations a couple of years ago.)

Wikipedia's translation of this is:

Most wicked mouse, you incite me to anger once too often. May God destroy you.

I think the phrasing and the fist-shaking, directed at a mouse, are meant by Hildebert to be a humorous overreaction.

Underneath Hildebert is a drawing of his colleague Everwin (EVERWINVS). Everwin seems to be painting some sort of decoration with a brush. Check out his fancy sleeves and matching socks!

I am not sure what Hildebert is holding in his left hand or whether it intersects the lion's arm. My best guess is that it is Hildebert's table knife, and that the picture means to show it passing in front of the lion, not intersecting the lion.

Many thanks to Marnanel Thurman for bringing this to my attention.

[Other articles in category /art] permanent link

Mon, 01 Feb 2021

The magic mirror in Snow White

A few weeks ago I was thinking about Snow White and in the course of doing that I looked up the original German version of 1812. (Snow White herself is story #53, on page 238.)

The magic mirror is introduced this way:

Die Königin … hatte auch einen Spiegel, vor trat sie alle Morgen und fragte: …

(“The queen… also had a mirror, before which she stood every morning and asked…”)

The mirror is simply einen Spiegel, a mirror, not a specifically magic mirror. That seems to have been a later interpolation. In the 1857 edition, it says Sie hatte einen wunderbaren Spiegel…. There is no wunderbaren in the original.

I prefer the original. The mirror recites poetry; to say it is a magic mirror is superfluous.

But on second thought, is it? There is another explanation: in the original version, perhaps the mirror is an ordinary one, and the queen is psychotic.

Certainly nobody else hears the mirror speaking. And the queen tells the hunter not only to kill Snow White in the forest, but to bring back Snow White's lungs and liver, so that the she may eat them. With salt! (die will ich mit Salz kochen und essen.) Now I prefer the original even more. The later version, which unequivocally states that the mirror is magic, is much less terrifying.

I suppose the argument against this reading is that the mirror also provides the queen with real information: Snow White is still alive, and living with the seven dwarfs. I think the original text does imply that the queen was aware of the seven dwarfs, but how might she have known that Snow White was still alive? Well, she did eat the lungs and liver, which had actually come from a young wild boar (junger Frischling). Perhaps she was satisfied at first, but then there was something about the taste, or the texture, not quite what she expected… it gnawed at her for hours, and then in a flash of rage she realized what she had actually eaten…

[ Addendum 20210202: In case you wanted to see it,
Screenshot of the original 1812 text of _Kinder und Hausmärchen_, which reads as I quoted above.
 Note, by the way, that in 1812 the umlaut marks in Königin etc. still looked like small letter ‘e’; they had not yet been reduced to diareses. ]

[ Addendum 20210207: another startling detail that was revised in the later editions. ]

[ Addendum 20210321: The more I think about the queen's psychosis, the more obvious it seems that this is the correct explanation. ]

[Other articles in category /book] permanent link

Sun, 31 Jan 2021

Early warning signs of shitty software

Here's a screenshot of menu on the documentation page of a package I'm using. You can see right away that the software is going to be crappy:

screenshot of part of a menu, with links for the following API
functions: notFound, methodNotAllowed, notAcceptable,
proxyAuthRequired, clientTimeout, conflict, resourceGone,
lengthRequired, preconditionFailed, entityTooLarge, uriTooLong,
unsupportedMediaType, rangeNotSatisfiable, expectationFailed, teapot,
badData, locked

Major warning sign: The items are not in alphabetical order. (They are in numeric order, but the numbers are not displayed.)

  • Was alphabetization too hard for these people?
  • Or did they simply not think for one second about who would want to use this menu and how?

    If you are looking up a particular function to find out what it does, you have to do linear search on the list to find the one you want.

    Yes, you could do full-text search on the whole page, but then what is the menu for?

Minor warning sign: But at least they included an API function to generate the frequently-used HTTP 418 I'm a teapot status.

<sarcasm>Clearly a lot of thought here about what really matters.</sarcasm>

[Other articles in category /prog] permanent link

Sun, 03 Jan 2021

Snow White in German

Tonight I was thinking of

Mirror, mirror, on the wall
Who is the fairest of them all?

I remembered that the original was in German and wondered whether it had always rhymed. It turns out that it had:

Spieglein, Spieglein an der Wand,
Wer ist die Schönste im ganzen Land?

The English is a pretty literal translation.

When the wunderbare Spiegel gives the Queen the bad news, it says:

Frau Königin, Ihr seid die Schönste hier,
Aber Schneewittchen ist tausendmal schöner als Ihr.

(“Queen, you are the fairest one here, but Little Snow White is a thousand times as fair as you.”)

When the dwarfs see Snow White in one of their beds, they cry

Ei, du mein Gott!

which is German for “zOMG”.

Later the Queen returns to the mirror, expecting a better answer, but she gets this:

Frau Königin, Ihr seid die Schönste hier,
Aber Schneewittchen über den Bergen
Bei den sieben Zwergen
Ist noch tausendmal schöner als Ihr.

(“Queen, you are the fairest here, but Little Snow White up on the mountain with the seven dwarfs is still a thousand times as fair as you.”)

I like the way this poem here interpolates the earlier version, turning the A-A rhyme into A-B-B-A. The English version I have has “in the glen / little men” in place of “über den Bergen / sieben Zwergen”. The original is much better, but I am not sure English has any good rhymes for “dwarfs”. Except “wharfs”, but putting the dwarfs by the wharfs is much worse than putting them in the glen.

[ Thanks to Gaal Yahas for correcting my translation of noch and to Mario Lang for correcting my German grammar. ]

[ Addendum 20200115: Was the mirror magical? ]

[Other articles in category /lang] permanent link

Fri, 01 Jan 2021

My big mistake about dense sets

I made a big mistake in a Math Stack Exchange answer this week. It turned out that I believed something that was completely wrong.

Here's the question, are terminating decimals dense in the reals?. It asks if the terminating decimals (that is, the rational numbers of the form !!\frac m{10^n}!!) are dense in the reals. “Dense in the reals” means that if an adversary names a real number !!r!! and a small distance !!d!!, and challenges us to find a terminating decimal !!t!! that is closer than !!d!! to point !!r!!, we can always do it. For example, is there a terminating decimal !!t!! that is within !!0.0000001!! of !!\sqrt 2!!? There is: !!\frac{14142135}{10^7} = 1.4142135!! is closer than that; the difference is less than !!0.00000007!!.

The answer to the question is ‘yes’ and the example shows why: every real number has a decimal expansion, and if you truncate that expansion far enough out, you get a terminating decimal that is as close as you like to the original number. This is the obvious and straightforward way to prove it, and it's just what the top-scoring answer did.

I thought I'd go another way, though. I said that it's enough to show that for any two terminating decimals, !!a!! and !!b!!, there is another one that lies between them. I remember my grandfather telling me long ago that this was a sufficient condition for a set to be dense in the reals, and I believed him. But it isn't sufficient, as Noah Schweber kindly pointed out.

(It is, of course, necessary, since if !!S!! is a subset of !!\Bbb R!!, and !!a,b\in S!! but no element of !!S!! between these, then there is no element of !!S!! that is less than distance !!\frac{b-a}2!! of !!\frac{a+b}2!!. Both !!a!! and !!b!! are at that distance, and no other point of !!S!! is closer.)

The counterexample that M. Schweber pointed out can be explained quickly if you know what the Cantor middle-thirds set is: construct the Cantor set, and consider the set of midpoints of the deleted intervals; this set of midpoints has the property that between any two there is another, but it is not dense in the reals. I was going to do a whole thing with diagrams for people who don't know the Cantor set, but I think what follows will be simpler.

Consider the set of real numbers between 0 and 1. These can of course be represented as decimals, some terminating and some not. Our counterexample will consist of all the terminating decimals that end with !!5!!, and before that final !!5!! have nothing but zeroes and nines. So, for example, !!0.5!!. To the left and right of !!0.5!!, respectively, are !!0.05!! and !!0.95!!.

In between (and around) these three are: $$\begin{array}{l} \color{darkblue}{ 0.005 }\\ 0.05 \\ \color{darkblue}{ 0.095 }\\ 0.5 \\ \color{darkblue}{ 0.905 }\\ 0.95 \\ \color{darkblue}{ 0.995 }\\ \end{array}$$

(Dark blue are the new ones we added.)

And in between and around these are:

$$\begin{array}{l} \color{darkblue}{ 0.0005 }\\ 0.005 \\ \color{darkblue}{ 0.0095 }\\ 0.05 \\ \color{darkblue}{ 0.0905 }\\ 0.095 \\ \color{darkblue}{ 0.0995 }\\ 0.5 \\ \color{darkblue}{ 0.9005 }\\ 0.905 \\ \color{darkblue}{ 0.9095 }\\ 0.95 \\ \color{darkblue}{ 0.9905 }\\ 0.995 \\ \color{darkblue}{ 0.9995 }\\ \end{array}$$

Clearly, between any two of these there is another one, because around !!0.????5!! we've added !!0.????05!! before and !!0.????95!! after, which will lie between !!0.????5!! and any decimal with fewer !!?!! digits before it terminates. So this set does have the between-each-two-is-another property that I was depending on.

But it should also be clear that this set is not dense in the reals, because, for example, there is obviously no number of this type that is near !!0.7!!.

(This isn't the midpoints of the middle-thirds set, it's the midpoints of the middle-four-fifths set, but the idea is exactly the same.)

Happy New Year, everyone!

[Other articles in category /math] permanent link