Monday, April 28, 2008

Forth Extension Language For Emacs

Stevey has a rant about Emacs. It's not the usual Emacs vs. Vi. or even Vim. It's about variants of Emacs. Emacs and the xemacs fork. There are hundreds of other emacsen filling various ecological niches out there.

And it got me to post a rant in the comments. Big enough to drive away some more readers from this blog had i posted it here. But it got me to thinking about TECO. Raise you're hand if you remeber TECO. That many? Wow.

Well, there are a couple versions of TECO around now. I've installed one on my desktop, and also on my shirt pocket computer. I found that though i remembered enough to do simple editing - insert, delete, copy, paste, change all of this to that, i'd forgotten lots of the stuff that made it such a powerful editor. Well, a quarter of a century of disuse will do that.

You see, TECO isn't just a Text Editor and COrector, it's a Turing complete language. It would be natural to represent the Turing tape with characters in the edit buffer. On today's gigabyte machines, the tape really is essentially infinitely long. And, for the most part, TECO was really fast. And, mind you, the machines it ran on were really, really slow by today's standards. Imagine if it took Windows 100,000 times longer to boot. TECO was fast on such machines.

But today's Emacs uses Lisp as an extension language. And it seems pretty fast, except that my benchmarks show it to be 500 times slower than C on various machines. It's only really fast compared to how it used to run on smaller, slower boxes. Why is that?

Well, for some reason, Lisp is compiled to a byte code langauge. There's a 3x to 5x performance penalty for byte code interpretation. And, unlike Java, the byte code is not usually written to disk. So, it's write once, compile everywhere. It could be compiled to native code. But 5x is not 500x. Where does that come in? My guess is memory management. But it's just a guess.

TECO isn't compiled to byte code. The commands are one or two bytes long. The commands themselves are interpreted. There aren't very many of them, and interpretation is very fast. And, for some reason, there is no garbage collection. At least none that you'd notice.

TECO is a stack language. So it should be comparible to Forth. Where TECO has a small fixed number of variables, beyond which you can't go, Forth allows the creation of an arbitrarily large number of new objects. Neither language has garbage collection, as near as i can tell. Yet stack languages are reverse polish notation, and Lisp (and friends) are polish notation. The one can be converted to the other mechanically. So, it's a mystery why Lisp has garbage collection and Forth does not.

Now, i doubt that anyone wants to go back to TECO as the extension language for Emacs. I've found Forth a much lower barrier to entry language than Lisp. So, perhaps Forth is a reasonable choice.

Sunday, April 27, 2008

Which House?

What Hogwarts House Would the Sorting Hat Choose for You?

Congratulations! You're a Gryffindor! You can make your way to the Gryffindor table in the Great Hall and sit with Harry, Hermione, Ron, and the rest of the Weasleys, among others. The Sorting Hat has found within you the potential for great bravery in the face of opposition. Your courage may remain hidden, like that of Neville Longbottom, but it will strengthen you in need. But don't rely on your membership in Gryffindor as a guarantee of steadfastness - remember, Peter Pettigrew was Gryffindor, too.



"You might belong in Gryffindor, where dwell the brave at heart, their daring, nerve and chivalry set Gryffindors apart."

Take the quiz: What Hogwarts House Would the Sorting Hat Choose for You?

More Quizzes from FamilyEducation.com

Friday, April 25, 2008

Fun Fiction

Stumbled upon a new site with really short (mostly science) fiction stories called Burst Fiction. Stories are about 1000 characters. Not 1000 words. These are really short.

I thought, "hey, i could do that. How long could it take to write 1000 characters?". I wrote a little diddy, and it's up! Woot! Can't wait to see where this micro story series i've started goes...

Friday, April 18, 2008

Expelled

It's not a surprise that Scientific American has run articles with negative reviews of the Ben Stein movie: Expelled. It's anti-science.

I've not seen the movie. But i've heard the arguments before. It does not surprise me that the movie is chock full of misleading statements. That's what happened in the Kitzmiller trial in Dover. It does not surprise me that people interviewed for the movie were mislead about what they were interviewing for. There's nothing new here. But Intelligent Design is increasingly irritating.

It's probably because i'm christian. The whole creationism, and therefore Intelligent Design thing isn't just bad science or anti science. It's also really poor theology. It seems to be based on the idea that most Christians haven't read the bible. They don't remember half of the 468 passages that come up in the standard liturgical cycle that get read to them in church on Sunday. They've no idea what the central and important messages in the bible are. So when smacked over the head with cherry picked verses in ancient translations, they seem to buy it. Well, at least some do.

Let's start with Genesis. There's the Creation story. It says 'days', but the original words could just as easily be translated as 'eras', or 'eons', or 'vaguely defined time periods'. It makes no sense to take the King James English version literally word for word. Moses had no knowledge of this translation, and better sources are available. With the gist of the original translations, the creation story matches modern cosmology extraordinarily well. And, it isn't at odds with Evolution. The animals and plants really did come before humans. But, the creation story itself is not one of the main points. Ignoring it will not imperil your immortal soul.

Make no mistake. The Intelligent Design people are not just against Evolution. Cosmology, and indeed, all of modern science is under attack. Why does it matter? Well, for example, Evolution is the basis for modern medicine. Without antibiotics, i'd be dead. Literally. Recently, my gaul bladder became gangrenous. It had died and was infected. Doctors removed it, but the infection remained. Now infectious bacteria mutate and adapt. Unlike humans where 20 years goes by between generations, bacteria spawn new generations in 20 minutes. If you don't kill them all, the remaining ones are highly likely to be drug resistant by the end of a week. So not only do you need to know Evolution to create antibiotics, you need to know it to administrate them.

Back to theology. The idea that modern apes and humans evolved from a common animal seems to make some people squirm. Yet, the late Pope John Paul II has said that evolution is compatible with Roman Catholicism as an explanation for mankind's physical origins. That's not because it's an idea that has been tested. It's because it's an idea that is compatible with the bible. That Pope John Paul II was a devout christian is, one hopes, beyond question. That he and other theologians really thought about the question is also a pretty good bet. They had time to work it out. Time you and i probably don't have. And, they're really smart people.

One enticement of a literal interpretation of the Bible is that it can seem to lead to a very simple absolute morality. In my opinion, it's wishful thinking. For example, Psalm 105 reads like a moral justification of the murder infants and small children. Where is the Love of God there? Without a reasoned interpretation, nearly anything can be justified from biblical sources. It's highly dangerous. For example, the Intelligent Design leaders can then say pretty much anything they want. And since the justification is biblical, they can convince people to commit the most outrageous acts. Christianity is not alone here. Fundamentalism in essentially all religions leads down this path.

And, it matters. The Bible says "Many are called, but few are chosen.", and "The road to salvation is narrow, like the razor's edge." Your immortal soul is at stake. The time is now to study, and really think. Spiritual growth has to be a lifestyle, not just a buzzword. Did you want to be expelled from the kingdom of God?

Pope John Paul II has also said that truth is truth. There isn't theological truth and scientific truth. There is only truth.

So, if you feel that Evolution is evil, feel free to refuse antibiotics the next time you're in the Doctor's office or the hospital. If you happen to be well adapted to warding off your infection, you live. If not, well, natural selection will remove you from the gene pool. My plan is to swim as long as possible.

Another stance is to support basic science education and research, to keep America strong and Americans healthy.

From my perspective, those spouting Intelligent Design are heretics, and should be burned at the stake.