|log (2001/03/09 to 2001/03/15)|
Thursday, March 15, 2001
There are lots of links and reader feedbacks and poll results and Nomic moves queued up, but I'm going to ignore them all today, and natter on about Elea (my ancient functional programming language) just because I feel like it. Ah, luxury!
There are three kinds of things in Elea. There are simple things, "atoms" if you will, like numbers and names:
Then there are lists of zero or more things:
(Actually in the original Elea lists were in pointy brackets; but to avoid conceptual or typographic confusion now that X/HTML has taken over the world I'll use square brackets today.)
And then there are applications of one thing to another thing:
So that defines the valid strings of the language, more or less. One more concept makes things happen: given a thing, you can evaluate it, and sometimes when you do that you get a different thing. If I ever get around to porting the language to Perl and putting up a Web page about it, I'll write down the full semantics of evaluation, but in the meantime here are a few examples. For all things a, b, c, d, and so on:
If you evaluate "(id:a)" you get "a".
There are a few more, but these will do for the cute example I want to cover today. Note that all of the above are oversimplifications; if you evaluate "(id:a)", you actually get whatever it is that you get when you evaluate "a". So if for instance you evaluate "(id:(id:a))", you end up with "a". And if you evaluate a list you end up with a list consisting of what you get when you evaluate each of its elements.
Is that all clear? *8)
Now consider the thing
If we apply that to a thing "a", and evaluate the result, we get "[a,a]". If you can follow why that is, you're understanding all this very well!
While the language has no variables, the interpreter does have some syntactic sugaring, sort of like the C preprocessor. Let's take advantage of that now, and use "DUP" as shorthand for the thing above. Now we can say that for all things "x", "(DUP:x)" evaluates to (whatever you get when you evaluate) "[x,x]".
What happens when we apply this to something, and evaluate the result? First we make a list containing two of the sometihng, and then we apply "apply" to that and evaluate the result. And of course "(apply:[x,x])" evaluates to "(x:x)". So our thing above, when applied to another thing and evaluated, results in (whatever you get when you evaluate) that other thing applied to itself.
Let's call the thing "APPLYTOSELF", although of course it's really
So "(APPLYTOSELF:id)" evaluates to whatever "(id:id)" evaluates to, which is just "id". And "(APPLYTOSELF:isatom)" evaluates to whatever "(isatom:isatom)" evaluates to, which is "true".
What this is all leading up to, of course, is this: what does
evaluate to? Well, it evaluates to whatever "(APPLYTOSELF:APPLYTOSELF)" evaluates to! Isn't that lovely? Or alternately, isn't that a funny joke?
(Maybe you had to be there.)
This causes a quick stack overflow in the Pascal version of the interpreter. I suppose if I port it to Perl I should put in a recursion limit of some kind.
It may have occurred to you that Elea is not a terribly practical programming language! I wouldn't recommend it for writing, say, a Linux device driver, or even a GUI version of rock paper scissors. Elea is fun because it makes you (makes me) think about problems and algorithms and programming in new ways. New bizarre twisted impractical mind-warping ways, it's true; but everybody needs to do that now and then. (I can't believe it was fifteen years ago that I thought up all this; it's still so familiar.)
Maybe later I'll subject you to how Elea does if/then and (pseudo)recursion and stuff. Or maybe not!
Feedback on how Elea is or isn't just like some other functional langauge, or how it isn't really functional at all, or whatever, is most welcome. (I suspect that Elea's "constant" is analogous to Unlambda's "k", for instance.)
And I do promise to talk about something else tomorrow... *8)
Meme Patrol: a kindly reader points us to the very wonderful amiallyourbaseornot.com.
It was as tall as six tall men, and wider than a house. It was covered with spires and pipes and gantries and smokestacks, and it moved on innumerable wheels. It rolled up to the assembled host, ignoring equally our spears and our frightened shouts.
So now Legolas and Gimli are holed up in Helm's Deep, fighting orcs. I'm happy to find that I don't remember exactly how this scene plays out; it really was a long time ago I last read the trilogy.
Something that I find really striking this time that I don't remember noticing last time is how empty the world of the Lord of the Rings is. Our heros pass through enormous stretches of vast empty country, and they never encounter a soul not directly involved with the plot. There are no traders, no travellers, no towns or farmsteads (abandoned or occupied) beside the road. They come to Rohan, which is apparently a major force in the world, and its capital (and only city?) is a small town; the main royal fighting force is a thousand troops.
Where is everybody?
The new voice of HAL will be done by Catherine Zeta-Jones.
Finally, to start our program, we apply to
Shades of Intercal! Which classic language is listed in the very useful Links section of the Unlambda page.
I wrote a functional programming language awhile back, and seeing Unlambda reminded me of it. Turns out I wasn't being quite as pure as I thought (unlike Unlambda, my language knew about numbers and lists, not just functions and their application). I called my language "Elea" (after Parmenides and those guys), and I wrote an interpreter for it in Pascal (remember Pascal?).
I thought I'd dig around in my archives a bit and find the actual Elea code. It took a little more digging than I expected! Turns out "awhile back" in this case was sixteen years; the Elea interpreter was last compiled on 29 July 1985. Boy, am I old!
In Elea, you could for instance define a function "inc" to add one to a number with the simple and concise:
= inc ; (compose:<apply,(construct: <(constant:plus),(construct: <(constant:1),id>)>)>) ;
And then if you said to the interpreter "(inc:8)", it would reply "9". Isn't that lovely? *8)
Napster Blocking Creates Dan Quayle Effect (or perhaps "when correctly spelled song-names are outlawed, only outlaws will have correctly spelled songs").
Over the weekend I happened to wander into the local Babbages, and they had a bunch of copies of "Zork: Grand Inquisitor" in the way-cheap bin, for US$9.99. So I picked one up, and now I'm wandering around with the traditional sword and lamp and stuff, being amused by the traditional ironic in-jokes, and frustrated by the usual annoying puzzles. I'm not sure that I've ever finished a Zork-family game, but I've enjoyed poking around in many of them and grokking the premise.
The kids are having fun watching over my shoulder as I play and making suggestions (I'm now officially not allowed to play, or at least to make any significant progress, if they're not watching); but I'm guessing they'll get frustrated and lose interest even faster than I will. Of course these days I could just download a hint-sheet or walkthrough from the Web, and use it when we get too stuck...
Turns out that the three original Zork games are available for download for free (and apparently for legal) from places like this Infocom fan page. Neat-o!
Employment wanted: Former Marijuana Smuggler. References available from friends, family, the U.S. District Attorney, etc.
So what the heck? I dropped off the little daughter at school for orchestra at 07:45 this morning, did aerobic things at the Club for 45 minutes, drove the 15 or so minutes to work, and got in at 10:00. Yow! I mean, I did take a shower in there, and fill the car with gas, and it really takes a bit over 15 minutes to drive to work, but I cannot for the life of me account for more than about half of the missing 75 minutes. Probably I zoned out in the shower for half an hour thinking about who knows what. Or maybe the CIA borrowed my consciousness for one of those "half petunia" things again.
Don't you hate it when they do that?
The idea of term limits never really made much sense to me: I mean, if you think that no one should be Dog Catcher for more than six years, then when Manfred Ongst is running for his seventh year as Dog Catcher, you just vote for someone else. Simple! No reason to forbid that eighth year with a separate law, eh?
But in a sudden flash of insight the other day, it occurred to me that in some situations term limits can be the solution to a Prisoners' Dilemma problem. (If you haven't thought about the Prisoners' Dilemma much, here's a little interactive introduction.)
Picture the game like this. If everyone keeps electing the same people over and over again, you get career politicians, entrenched power structures, patterns of corruption, and all that messy stuff. If everyone observes term limits, new blood flows, the government is run by real people with lives outside of the statehouse, and things are better. But if some people keep electing the same people over and over and some don't, then the former have an advantage, because the politicians representing them over and over have all the usual incumbency advantages, they know the ropes, they have their ducks in place, they know where the wheels are greased, and so on.
So if it's legal to keep electing the same people over and over, everyone will do that, because they don't want to be the only people not doing it (or, less charitably, because they want to benefit by being among the people who are doing it). So we end up in a comparatively bad state. If everyone could be kept from doing it, we'd be better off.
If and when that's an accurate model of what's actually going on, term limits make some rational sense.
This explains why people might benefit from term limits for all the members of a particular body (where different members represent different people). To get it to explain something like a term limit for the mayor of a city takes a little more work, but I think it's possible. The effect is the same, but it's across time instead of across geographic or otherwise synchronic constituencies.
Obviously I'd like it if mayors that I like could be elected over and over, but mayors that I don't like were limited to a single term. That's unlikely to happen! The choices, then, are that all mayoral terms are limited, or none are. I might well want all mayoral terms to be limited, for all the same reasons above involving distrust of career politicians and so on. So that works, too.
Other people have had similar thoughts. One interesting paper I ran across (but didn't actually read in detail!) is Term-Limit Legislation as Response to Incumbency Advantage. It talks about other reasons you might want to limit how many times you're allowed to elect the same person, but it mentions some other research on Prisoners' Dilemma sorts of reasons. So does the catchier-titled The Law & Economics of Survivor (yep, it's about the TV show).
Boy, am I miffed! Google apparently hasn't spidered by the Log here since January sometime. Hmph! Devoted readers, of course, can search the site using our own search. But just think what the rest of the world is missing!
So when I hear about another Blue-Ribbon Commission investigating this or that, I wonder to myself: does every member of the Commission have to have a blue ribbon? And does it have to be a real "Best in Show" blue ribbon? Or can it be another kind of ribbon that happens to be blue, like "Best Groomed" or "Most Obedient"?
Cruel but funny: Britney's Spheres.
Various things today that are worth logging just for the titles and/or first lines.
How to think about architectures for
and other agents
How to Turn Philosophers of Mind
Over the past several months, the National Infrastructure Protection Center (NIPC) has been coordinating investigations into a series of organized hacker activities specifically targeting U.S. computer systems associated with e-commerce or e-banking.
Once the hackers gain access, they download proprietary information, customer databases, and credit card information. The hackers subsequently contact the victim company through facsimile, email, or telephone. After notifying the company of the intrusion and theft of information, the hackers make a veiled extortion threat by offering Internet security services to patch the system against other hackers. They tell the victim that without their services, they cannot guarantee that other hackers will not access the network and post the credit card information and details about the compromise on the Internet.
From the guy in the locker room who thought my "Green Turtle" T-shirt said "Green Tortoise": Green Tortoise, adventure vacations for those who regret missing the sixties. (You're either on the bus, or you're off the bus.)
Hm, this is looking like an extremely random day here in the log.
Thanks to all for the advice on medicating cats! Burying the pill in a ball of the kind of food that the cat loves best of all (smelly fish) has been working reasonably well so far. We have not yet tried following these instructions, but we thank the kind reader who pointed them out. Sounds sort of dangerous.
Other readers wrote:
We put pills in tuna fish (canned).
So the consensus seems to be that hiding the pill in the food works well (ground up first if your pet is a great European writer), while the "stick it down the animal's throat" method is probably one of those things that veterinarians do just for a laugh. ("Ha, that's nothing! Last week I told this guy to give his cat the pills by sticking them down its throat!! Ha ha ha ha ha ha! Pass the vermouth.")
There's something fun and refreshing and exciting about setting up a new machine, choosing a hostname, fiddling with the personalizations, turning off the silly animated desktop effects, trying to remember what you absolutely must install on it at once and what can wait until later on.
Doesn't leave much time for weblog writing, though.
Three Rings for the Elven-kings under the sky,
Hillary: The Op-Ed. Quite funny (I think I may have voted for her, but it's still quite funny).
Finally let me say that I was as surprised as anyone when I was informed that I have a brother named Hugh Rodham. He does not bear much resemblance to me. While I did grow up in a household with numerous other people, I was never informed that I had brothers. It was never discussed. If it was, I was not present.
And on a related note New President Gives Speech: Clinton successor near quake-ravaged Seattle.
More seriously but still adhereing to the theme, Pardon the Reminder: What About G.H. Bush?
The following year, Mr. Bush allowed exiled terrorist Orlando Bosch to leave prison and reside in Miami, even though the C.I.A. and F.B.I. held Mr. Bosch responsible for such atrocities as the bombing of a Cuban civilian airliner in 1976. (That crime occurred when Mr. Bush himself headed the C.I.A.) The alleged mass murderer profited from intense lobbying by Presidential son Jeb Bush, then a rising Florida politician whose wealthy local business partners happened to include Mr. Bosch's leading advocates in the Cuban-American community.
And turning from politics to consumer culture, or perhaps contemplating what happens when the merge: Watch or Go To Jail: Students locked up after refusing to watch Channel One:
When the government sends children to a juvenile detention center because they don't want to watch advertising, that is both Orwellian and more than a little sick.
And finally let's see, Michael Travers sends along a couple of pointers rife with grist for the conspiracy mills: More Six Degrees of Adnan Khashoggi, which is a follow up Six Degrees of Adnan Khashoggi. Why is this Mysterious Arms Dealer somehow associated with so many of the major scandals of the last few decades? And what about New Coke?