Waggish

David Auerbach on literature, tech, film, etc.

Tag: programming

Dennis Ritchie Tribute Part 2: Obfuscated C from Brian Westley

After looking through all that Quicksort code, I was sent back to the Obfuscated C Code Contest. (Some of the highlights over the years.) Many of the entries go for obfuscation and complexity over all else, but some have a beautiful coordination of form and content.

Two favorites in that vein, both from Brian Westley. This one from 1988 approximates Pi. It approximates it better if you increase the size of the circular pattern.

#define _ F-->00 || F-OO--;
long F=00,OO=00;
main(){F_OO();printf("%1.3f\n", 4.*-F/OO/OO);}F_OO()
{
            _-_-_-_
       _-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
 _-_-_-_-_-_-_-_-_-_-_-_-_-_-_
  _-_-_-_-_-_-_-_-_-_-_-_-_-_
    _-_-_-_-_-_-_-_-_-_-_-_
       _-_-_-_-_-_-_-_-_
            _-_-_-_
}

This one, from 1990, squeezes a lot out of certain reserved keywords while avoiding the preprocessor (almost) entirely.

char*lie;

	double time, me= !0XFACE,

	not; int rested,   get, out;

	main(ly, die) char ly, **die ;{

	    signed char lotte,
dear; (char)lotte--;

	for(get= !me;; not){

	1 -  out & out ;lie;{

	char lotte, my= dear,

	**let= !!me *!not+ ++die;

	    (char*)(lie=
"The gloves are OFF this time, I detest you, snot\n\0sed GEEK!");

	do {not= *lie++ & 0xF00L* !me;

	#define love (char*)lie -

	love 1 *!(not= atoi(let

	[get -me?

	    (char)lotte-
(char)lotte: my- *love -

	'I'  -  *love -  'U' -

	'I'  -  (long)  - 4 - 'U' ])- !!

	(time  =out=  'a'));} while( my - dear

	&& 'I'-1l  -get-  'a'); break;}}

	    (char)*lie++;
(char)*lie++, (char)*lie++; hell:0, (char)*lie;

	get *out* (short)ly   -0-'R'-  get- 'a'^rested;

	do {auto*eroticism,

	that; puts(*( out

	    - 'c'

-('P'-'S') +die+ -2 ));}while(!"you're at it");
for (*((char*)&lotte)^=

	(char)lotte; (love ly) [(char)++lotte+

	!!0xBABE];){ if ('I' -lie[ 2 +(char)lotte]){ 'I'-1l ***die; }

	else{ if ('I' * get *out* ('I'-1l **die[ 2 ])) *((char*)&lotte) -=

	'4' - ('I'-1l); not; for(get=!
get; !out; (char)*lie  &  0xD0- !not) return!!

	(char)lotte;}
(char)lotte;

	do{ not* putchar(lie [out

	*!not* !!me +(char)lotte]);

	not; for(;!'a';);}while(

	    love (char*)lie);{
register this; switch( (char)lie

	[(char)lotte] -1 *!out) {

	char*les, get= 0xFF, my; case' ':

	*((char*)&lotte) += 15; !not +(char)*lie*'s';

	this +1+ not; default: 0xF +(char*)lie;}}}

	get - !out;

	if (not--)

	goto hell;

	    exit( (char)lotte);}

What the code does is pretty apt as well.

Battle Lines

Reductionistic Framework Alert!

I recently ran across an old essay by Lisp expert, venture capitalist, and general software guru Paul Graham. Graham is a very sharp person and his Lisp books are excellent, but he writes almost exclusively from a prism of an engineering-centric, Manicheistic worldview.

A good scientist, in other words, does not merely ignore conventional wisdom, but makes a special effort to break it. Scientists go looking for trouble. This should be the m.o. of any scholar, but scientists seem much more willing to look under rocks. [10]

Why? It could be that the scientists are simply smarter; most physicists could, if necessary, make it through a PhD program in French literature, but few professors of French literature could make it through a PhD program in physics. Or it could be because it’s clearer in the sciences whether theories are true or false, and this makes scientists bolder. (Or it could be that, because it’s clearer in the sciences whether theories are true or false, you have to be smart to get jobs as a scientist, rather than just a good politician.)

“What You Can’t Say”

[10] I don’t mean to suggest that scientists’ opinions are inevitably right, just that their willingness to consider unconventional ideas gives them a head start. In other respects they are sometimes at a disadvantage. Like other scholars, many scientists have never directly earned a living– never, that is, been paid in return for services rendered. Most scholars live in an anomalous microworld in which money is something doled out by committees instead of a representation for work, and it seems natural to them that national economies should be run along the same lines. As a result, many otherwise intelligent people were socialists in the middle of the twentieth century.

Some would call him a representative of “scientism,” which is the pejorative term for scientific positivism. Because I’m equally suspicious of reductionistic worldviews as well as quasi-spiritual appeals to the metaphysically irreducible, I’m not going to attack him for presenting the former and make it look like I’m appealing to the latter. I want to talk about him because I’ve been thinking about the future as the new year has come and I have been looking at depressing statistics about employment and poverty like these.

So I’ve been thinking about the future, and Graham seems to be a pure representative of one side of the two dominant power bases that appear to be duking it out for control of the US right now. The battle is between technocrats and ideologues, Whigs and Tories, libertarians and moralists. To avoid using any loaded terms, I’m just going to create two generic types of my own:

  • Type L: libertarian, technocratic, meritocratic, pro-business, anti-government, laissez faire,  pro-science, positivist, secular, elitist, progress-driven, Whiggish, optimistic.
    “The best should have the power.”
  • Type C: tradition-oriented, pro-status quo, nationalistic, protectionist, isolationist, xenophobic, social conservative, pro-business, pro-government (at least in regards to furthering other goals), pro-religion, cronyistic, chauvinistic.
    “The powerful should have the power.”

These are not types of voters, but types of people of influence, people who in some way affect the policies that are being made. It’s my own heuristic. I thought about government policies of the last 30 years, from Reagan’s tax cuts to welfare reform to the health care bill, and then excluded all those people whose viewpoints didn’t seem to be reflected in them. This is what I was left with.

(Type C clearly holds assorted beliefs reflected in my less-funny-by-the-day Taxonomy of Conservatives, while Type L has beliefs called out in the taxonomy as not actually being conservative at all.)

If, like most people reading this, you don’t fit into either of these types, congratulations! Your opinion is probably not relevant to the dominant discourse in America. You’ll notice that what is not covered in these two types is any sort of socialist attitude advocating government intervention to encourage equality and welfare. This attitude appears to have vanished amongst the influential forces in American life, possibly owing to the decline of labor unions. When you realize that Paul Krugman is several degrees to the right of John Maynard Keynes, you see exactly how little purchase any sort of genuinely socialist attitude has in the country.

These two types are darker analogues of the “conservative” and “liberal” classes described by Leszek Kolakowski in his short essay “How to Be a Conservative-Liberal-Socialist.” Here are the ideas that fall under his “socialist” type:

A Socialist Believes:

1. That societies in which the pursuit of profit is the sole regulator of the productive system are threatened with as grievous–perhaps more grievous–catastrophes as are societies in which the profit motive has been entirely eliminated from the production-regulating forces. There are good reasons why freedom of economic activity should be limited for the sake of security, and why money should not automatically produce more money. But the limitation of freedom should be called precisely that, and should not be called a higher form of freedom.

2. That it is absurd and hypocritical to conclude that, simply because a perfect, conflictless society is impossible, every existing form of inequality is inevitable and all ways of profit-making justified. The kind of conservative anthropological pessimism which led to the astonishing belief that a progressive income tax was an inhuman abomination is just as suspect as the kind of historical optimism on which the Gulag Archipelago was based.

3. That the tendency to subject the economy to important social controls should be encouraged, even though the price to be paid is an increase in bureaucracy. Such controls, however, must be exercised within representative democracy. Thus it is essential to plan institutions that counteract the menace to freedom which is produced by the growth of these very controls.

I really don’t see much evidence of any of these attitudes in any of our ruling elites. Do you? I don’t think of myself as a socialist and I don’t endorse these views over those of Kolakowski’s other two classes, but the absence of fierce advocates for these views amongst the powerful is a really bad thing.

Democrats and Republicans as well as those calling themselves “conservative” and “liberals” each consist of various proportions of these two sides, but the mix is such a mess that I suspect there will be some serious realignment in the next ten or fifteen years. However, since the disconnect between what people say they believe and what policies they actually endorse only seems to be growing, I don’t dare predict what shape this realignment will take. It is very hard to predict how those depressing statistics will affect voting patterns. (Please see Larry Bartels’ “What’s the Matter with What’s the Matter with Kansas? to understand how wrong the conventional wisdom about voter bases can be. Stick with the raw statistics.)

So obviously Paul Graham is Type L and Glenn Beck is Type C. Why divide people in the middle by these two categories? Because this is where the social fissures seem to lie. The sharp engineering Type L’s like Graham want to be left alone so that their genius can rain prosperity down on society. Though they may believe in a social safety net, they are hostile to any sort of traditional authority structure not based in purportedly objective measures of merit. They don’t want to deal with people who haven’t earned their place beside them, and they definitely don’t want to work for them. The Type C’s have no such standard. They like people who are like themselves, and would much rather work with someone who shares their hobbies than with someone smarter than them. Type L will advocate for equality of opportunity and scholarships for smart kids from disadvantaged backgrounds. Type C most certainly do not want the best and the brightest of the unwashed masses rising up. They’re still unwashed, after all.

Graham is representative of many science and engineering types, the sorts that the US so desperately cultivated during the Cold War to keep pace with Soviet technology. Now they are cultivated by tech companies. Their strong libertarian streak comes from their (frequently mistaken) belief that talent and skill will deservedly win out and help improve the world, and so the more talented are entitled to more wealth and the fruit of their labors. They are not necessarily Ayn Rand sorts, but they are generally enamored of the view that competition encourages progress and efficiency. (I agree, to a point.)

It is a major mistake to think that the CEOs and bankers of today are Type L. While many of them lack the overt social conservatism and xenophobic stances of many Type C’s, they have no love for what Joseph Schumpeter called the “creative destruction” of capitalism. They have endorsed free trade and laissez faire policies because they have been good for their own interests, but they will beg for government handouts in a second and see no problem with colluding with the government to crush their competition and enemies. Lemon socialism, crony capitalism, socialism for the rich and capitalism for the poor; whatever it’s called, Type C loves it. Type L will sometimes, when push comes to shove, concede defeat and accede to a rebalancing of the playing field in the hopes of a better tomorrow. Type C wants the playing field tilted forever in their favor.

This is, more or less, the major reason why Microsoft was sued by the government while banks, energy companies, and so many others were left untouched. Microsoft didn’t think it needed to pal around with the old boy network. They were wrong. Tech companies have learned their lesson and now employ lobbyists as aggressively as those other companies, but their tendency toward Type L put them behind the Type C executives of most corporations when it came to politicking. You can get some idea of whether a company tends toward Type C or Type L by seeing to what extent minorities and women have infiltrated their executive ranks: Type C will keep them out without even realizing they’re doing it. Another good post facto signal for identifying Type L: they sometimes admit they were wrong. Type C will go to the grave believing in their divine right to be at the top of the ladder. While JFK’s “best and the brightest” might have had some loose claim to the title, Enron’s “smartest guys in the room” were so flagrantly not that it dirties the term “intelligence” to claim it for them.

Put in such stark terms, it’s easy for me to pick a side, but it doesn’t make me any happier with the choices.

One of the major annoyances with Type L is how shallow the use of reason often runs, leading to thinks like Graham’s conclusions above. This is not even a problem of scientific positivism per se, but just cursory laziness in its application. Yes, at the top of the heap there are good, searching thinkers like Joseph Schumpeter and a number of other economists, but the majority of the Type L people in the ruling class get their rigorous intellectual precision from Thomas Friedman, Malcolm Gladwell, Steven Levitt, Kenneth Pollack, and other proof-by-anecdote writers. They often commit the fallacy of thinking that others have as rigorous standards as they do, when (a) not only are their own standards not rigorous enough, but (b) others have even sloppier standards.

Paul Graham almost certainly has more raw brainpower than I do, but the mental heuristics used to assess evidence and theories in the hard sciences are usually catastrophic when applied to the social sciences. His statement is doubly ironic because he admits that theories in the sciences are more easily assessable even as he is declaiming The Way People Are with the same certainty with which Newton laid down his physical laws.

Type L are prone to believing in simple social laws for the same reason why scientists have so often been duped by psychics: they aren’t used to being tricked. Psychologists and economists aren’t deliberately trying to trick people, but their theories are built on sand compared to those of math and science, and so what they call a “conclusion” or “evidence” is usually an insult to the history of science. This is why things like Social Darwinism, The Bell Curve, and assorted other “scientific” justifications for inequality persistently make their way into supposedly rational people’s conventional wisdom. (The price of rationality is eternal vigilance. And eternal skepticism.)

For a perfect example of this sort of slippage from quantitative to qualitative, check out the collected works of Richard Posner. True to Type L, he has recently changed his views while still maintaining faith in efficient rational markets. Admitting a failure in the current implementation of free market capitalism is within his intellectual horizon; admitting irrationality into his view of the world is not.

So those are the two sorts of rulers I see. They got along reasonably well for a while, but the continuing economic problems are going to make it harder for them to paper over their differences as frequently. Let’s hope they look out for us all. Happy new year to you all and thanks for reading.

PS: As for the people who aren’t part of the above two power structures and receive their beliefs and dictats in a bewildering variety of ideologies and forms only tenuously linked to the real motivations at work…well, I quote Yes, Prime Minister:

Hacker: Don’t tell me about the press. I know exactly who reads the papers:

  • The Daily Mirror is read by people who think they run the country;
  • The Guardian is read by people who think they ought to run the country;
  • The Times is read by the people who actually do run the country;
  • The Daily Mail is read by the wives of the people who run the country;
  • The Financial Times is read by people who own the country;
  • The Morning Star is read by people who think the country ought to be run by another country;
  • And The Daily Telegraph is read by people who think it is.

Sir Humphrey: Prime Minister, what about the people who read The Sun?
BernardSun readers don’t care who runs the country, as long as she’s got big tits.

Dwight Macdonald’s “Masscult and Midcult”

This was originally intended to be a more fleshed-out essay on the preoccupation of current highbrow culture (that which is supposedly good for you) with mass culture, and how the orientation of the critical apparatus to the patently and admittedly braindead mass culture was turning the “public intellectual” scene into a gagging ourobouros. But I lost interest. I got bored with analyses of reality television and Liz Phair’s career that read like ex post facto justifications of the author’s enjoyment of such. I got tired of analyzing them. Someone should, but it won’t be me. I’d rather go back to Musil.

I do think it’s notable that what passes for highbrow content today in Harper’s and the New York Review of Books is so persistent in proclaiming its own worthiness that its attributed value begins to stem mostly from comparison to that which is consumed by the Many. That academia has come to the same state is striking (analysis of the hegemony == watching of the pop culture == more Sopranos please!). When a Washington Post writer is promoting elitism and placing Jonathan Franzen amongst the elect…it’ll take a decade to sort out how the lines got drawn this way. And, well, I still haven’t read Augusto Roa Bastos’s I, the Supreme.

Since, however, Macdonald comes from the age of the prior intellectual aristocracy in America, full of noble but ineffective spirits like Trilling and Howe, I thought it’d be worthwhile to chart what was hot and what was not in Macdonald’s world. (Some of this is a little unfair since Macdonald charitably admits good qualities in some of the popular stuff, but the categories are still fairly well delineated.)

Highcult (hot)
Edgar Allen Poe
Charles Dickens (at his best)
Evelyn Waugh
Rudolph Serkin
D.W. Griffith
Charlie Chaplin
King James Bible
Rodgers and Hart
Picasso
Jackson Pollock
Schoenberg
Elliott Carter
John Cassavetes
Evergreen Review
Pull My Daisy
New York Review of Books

Midcult (not)
Our Town
By Love Possessed
H.G. Wells
George Orwell
John Hersey
Rodgers and Hammerstein
Atlantic Monthly
Book-of-the-Month Club
Reader’s Digest
The Old Man and the Sea
The Good Earth
Jack Kerouac
Harper’s
Saturday Review
The New Yorker
Colin Wilson

Masscult (not even moreso)
Erle Stanley Gardner
Norman Rockwell
Edna Ferber
James Michener
Norman Vincent Peale
Rock music
Charles Dickens (at his worst)
Grub Street authors
Liberace
Cecil B. DeMille
Revised Standard Bible

It’s not a bad list, though it’s utterly bewildering that the Kerouac-scripted Beatnik-a-thon Pull My Daisy made it onto the A-list given Macdonald’s criticisms of the Beats elsewhere. But it’s ominous how often he retreats to the past for counterexamples of high art. Maybe this was just prudence on his part: he’d look quite the fool had he put Alain Robbe-Grillet on the Highcult list. But it was his job to take that risk.

Instead, he’s cautious. He quotes Adorno in the essay, and like Adorno, he plays it safe by attaching himself to the contemporary establishment avant-garde. For Adorno, it was Schoenberg; for Macdonald, it’s Pollock and Elliot Carter. He’s very generous towards his critical compatriots on other small, unprofitable magazines in holding them up as cultural arbiters, but he doesn’t do a lot of arbitrating. Somehow, the brand of the magazine becomes the mark of quality rather than the individual work in it. The reason is that he is judging largely by intent rather than by result, never a smart move. But by sticking to the establishment avant-garde, he comes off all right. Even his jazz tastes (designated by Jazz on a Summer’s Day) are old-guard.

The punchline is his one concrete suggestion for the future: pay television. He suggests it would reinstate “editorial intent” in the programming rather than pure pandering, and thus restore integrity (and, he concludes, quality) to the airwaves for the select, elevated few who can appreciate it and cough up the dough.

Oulipo Tangent: John Sladek

I was always surprised that there wasn’t more overlap between the Oulipo and science fiction, since both fields were among the most ready to dispose of character and meaning in search of advances in their respective fields. Calvino had Cosmicomics and T-Zero, but those are more fantasies than anything resembling generic exercises. There have been a few sf authors over the years who have tried Oulipo experiments, and probably more recently that I don’t know about: the latest I know of is Geoff Ryman’s 253, which also happens to be one of the more successful hypertexts out there. I believe it succeeds on its own terms, but it does come off as a bit of an exercise, a left-brained excursion in assembling fragments that’s closer to computer programming than to writing a novel–which is not a criticism. It is also, of course, not science fiction. Why Ryman chose ordinary reality for his experiment is not for me to answer, but perhaps, as with Harry Mathews’ Tlooth, it’s more coherent to maintain the physical rules of common reality if you’re going to play havoc with the metaphysics of coincidence, symbolism, and structure.

(There is an old EC Comics story, I think from Weird Science, in which a man mows his double down with his car shortly before finding a time machine, and, well, you know the rest, but the best part of the story is the appendix, in which the entire loop is graphically represented and explained for teenagers who hadn’t yet read “By His Bootstraps.” This type of structure, in its simplest form in this story, requires as much contrivance as some of the Oulipo techniques, and may offer a similar form of getting-out-of-a-jam.)

I suspected that 253 was inspired by Thomas Disch’s 334, a fix-up collection of linked stories laid out in appropriately Perecesque fashion. But Disch seems to be toying with the device with less than full passion; it’s his friend, the late John Sladek, who always read as the most influenced by the Oulipo metaphysics. (If you aren’t convinced, Sladek references Mathews and people like Robert Coover and John Barth in this nice interview.)

Nearly all of Sladek’s books are set up like Rube Goldberg machines with the strings in plain sight, as he maneuvers all his pieces into place for a final conflagration. Sometimes, as with his massive 800-page Roderick, about a robot Candide, he lets the chain of events go slack to focus more on episodes of straight satire (which is always there to the degree that it’s not being steamrolled by the plot). Other times, as with The Muller-Fokker Effect, whose protagonist disappears very early on after his mind is transferred onto computer, the overwhelming drive is action, action, action towards that blowout at the end. Consequently, he doesn’t have time to develop most characters beyond caricatured monsters–corrupt professors, foolish hicks, parochial megalomaniacs–which happen to be exactly what the stories require.

The exception is Bugs. Whether it’s because of a slightly less complicated plot or a focus on one particular character, Bugs feels more rooted in several specific places and their corresponding emotions, the most striking being the dreary gray computer company. It’s working on nutty cybernetics, but in the spaces between plot points there’s a melancholy that seems more identifiable with a technical writing job in Minnesota (Sladek’s other profession) than anything else he wrote.

Fred Jones is an English writer who, possessed of little character except for literate decency, gets caught up in the usual antics, but Jones is sympathetic enough that Sladek sticks by him even more than he did with Roderick. There are scenes that don’t figure at all in the plot, as when he applies to a newspaper to write book reviews (“I’m Fred, and literate” is how he introduces himself) and is led into a backroom teeming with shelves of undifferentiated rack-sized fantasy books. “See, about ten years ago somebody made the mistake of reviewing one of these and the word got out. I mean, Christ, they print fifty of these fuckers a month!” says the editor, then the shelves collapse and bury him.

The robot soon goes berserk after Fred has it read Frankenstein and the pace picks up, but there is still a similarity between Sladek’s games of satire and the Oulipo’s reductionistic approach to character. It’s more noticeable in Bugs than it is in Sladek’s other work, or even, for example, The Day of the Locust, because the setting is intensely realistic and very contemporary. Fred remains the only real everyman character Sladek used, and his placement in the book amidst architected madness suggests an attempted escape from the specifics of his personality through a sort of super-detailed cartography of plot. Other characters get completely sucked into the machinery, but Fred remains psychologically present, and his own experiences, though carefully contrived, are more bitter.

The conclusion? That the structural, mathematical antics used by the Oulipo-ians are inspired by the same spirit that drives Sladek’s Rube Goldberg plot machines: it’s not an inherently avoidant technique, but it is one that moves away from what characters like Fred are supposed to represent. Bugs doesn’t resolve that tension, but neither does it fall apart.

(That same architectonic spirit is also what makes chapter 10 of Ulysses a diversion rather than a sequential component of the book. To me, the book holds unexplored answers to all these dilemmas.)

Sladek suggests in the article above that he was going to go further in his never-finished project Maps, where the novelistic structures would extend, Oulipo-style, into the metaphysics of the novel. It sounds like it might have been too fanciful and too arid for Sladek to manage, because his application of structure did not encourage perfect structure as much as it did satire.

© 2024 Waggish

Theme by Anders NorenUp ↑