It's Not Magic
Writings of a techie wizard
 
Archive: 2011‑Jun
Wed, 29 Jun 2011

The answer can be summed up in one sentence:

Not every data structure is a list.

Don't get me wrong: Lisp is a powerful engine for manipulating data structures. In fact, in one sense Python (like every other programming language) is just "syntactic sugar" for Lisp expressions; as Paul Graham put it, in Lisp "you express programs directly in the parse trees that get built behind the scenes when other languages are parsed." That ability gives you extra control and flexibility, but it comes at a price: since you're explicitly writing parse trees, you have to express all your data structures explicitly in terms of parse trees. Python may be just a layer of syntactic sugar over that, but syntactic sugar has uses.

In fact, ironic as it may seem, my reason for using Python instead of Lisp is really the same as one of the reasons for using Python instead of C: namely, that you don't have to build your data structures "by hand"! This will seem daft to those who believe that Lisp is a more powerful language, but consider the following code snippets in Lisp and Python:

Lisp:

(setf mydict (init-hash-table ("a" 1) ("b" 2)))

Python:

mydict = {"a": 1, "b": 2}

Obviously the Python version is shorter and easier to read (in fact, in the Lisps I'm somewhat familiar with, Common Lisp and GNU Scheme, there isn't even a way to initialize a hash table in one statement, so I'm actually assuming that someone has written an init-hash-table function to enable the above code to work, otherwise the Lisp version would be even longer and more complex). But the Python version also provides a valuable layer of abstraction that the Lisp version does not: it makes a dictionary, a mapping of keys to values, a built-in data structure, rather than one that I have to build "by hand". That may not seem like much for a single mapping with just two entries, but my Python code uses dicts all over the place, simply because it's such an easy and useful data structure. If I had to write init-hash-table and all those parentheses every time, I might not use them quite so much.

I know, I know: you just have to "get used" to reading Lisp and then it will seem easier, and writing all those parentheses and init-hash-table every time won't seem so bad once I've gotten enough practice. But why should I have to reprogram my brain to fit the language? The fact is that the abstraction I want is a dict, not a list that's been gerrymandered into something that can act like a dict. Programming languages are supposed to adjust to fit programmers, not the other way around.

Posted at 22:20   |   Category: rants   |   Tags: computers   |   Permalink
Sat, 25 Jun 2011

This is the first of what will no doubt be many dispatches from the "what's up with that?" department.

There was much rejoicing by many at the news yesterday that New York has passed a law permitting same sex marriage. This post is not about that issue, though I will say that I support such laws; "equal protection" is supposed to mean what it says, and if the state is going to provide special benefits to people who make life commitments to each other, it has no business saying that some couples can get them and some can't. But that's for another post someday.

While watching coverage of the event on CNN, one item struck me: it will be 30 days before any same-sex couple can actually apply for a marriage license under the new law.

Read more...

Posted at 14:51   |   Category: rants   |   Tags: politics   |   Permalink
Thu, 23 Jun 2011

CNN announced some time back that the White House had released President Obama's birth certificate. Donald Trump claims that he was the one who pushed Obama over the edge, but that's neither here nor there. I mention the story because just yesterday, while browsing around the "Unqualified Reservations" blog, I came across this post from last summer by Mencius Moldbug, in which he proposes two new terms, "sealer" and "opener", to replace the traditional "birther" and "anti-birther". A "sealer", according to Moldbug, is someone who thinks Obama's birth documents should remain sealed.

Read more...

Posted at 18:43   |   Category: opinions   |   Tags: politics   |   Permalink
Wed, 22 Jun 2011

In a recent post, Eric Raymond describes an alternate history in which the Internet and the World Wide Web never happened. In this alternate timeline, the DARPA research that led to the Internet never got out of the "research curiosity" stage, and instead of having one Internet, we have multiple "walled gardens" like Compuserve and AOL. It's not a pretty picture: imagine not being able to email, text message, or Facebook a friend just because you and they have different ISPs. Imagine also that there is no Linux, no open source software, no way for anyone except a dedicated hobbyist to have a computer that doesn't run proprietary programs that you can't see the insides of. Not to mention that censorship would be a lot easier on networks that did not have infrastructure specifically designed to make that as difficult as possible.

Read more...

Posted at 19:29   |   Category: opinions   |   Tags: computers, politics   |   Permalink
Tue, 21 Jun 2011

Quite a number of years ago now, I first read Daniel Dennett's book Darwin's Dangerous Idea. This post is not about the central topic of that book, which is evolution (I'm sure I'll get into posting about that on this blog in time, but for now you'll have to read this article on my old site if you want to see where I'm coming from). Instead, I want to talk about one particular claim Dennett makes in his book: that Stephen Jay Gould did not believe in Darwin's dangerous idea, the central premise of evolutionary theory.

Read more...

Posted at 23:47   |   Category: opinions   |   Tags: science   |   Permalink
Fri, 17 Jun 2011

It's a well-known custom for Linux users to rant about some aspect of their OS. Unlike the Mac community, which gushes about how wonderful their OS is, or the Windows community, whose writings about their OS often read like soldiers' letters home from a war zone, we Linux types view ranting as a force for change. Or at least, as an explanation of why we personally no longer use the festering pile of dung we are ranting about.

The particular festering pile under the microscope in this post is KDE 4.

Read more...

Posted at 19:38   |   Category: rants   |   Tags: computers   |   Permalink
Tue, 14 Jun 2011

A post at "Stephensplatz" describes Tolkien's Lord of the Rings (LOTR) as "A Notable Work of Children's Fiction" (that's the title of the post). As someone who first read LOTR in seventh grade, and who has re-read it many times since, this naturally got my attention. And since reading Tolkien's writing was, in large part, what made me first think of writing myself, it's fitting that a discussion of his work gets the first "real" post on this blog.

Read more...

Posted at 18:36   |   Category: opinions   |   Tags: fantasy   |   Permalink
Mon, 13 Jun 2011

I've started this blog as an easier way to get my thoughts actually posted to the web, instead of languishing in the "pending" area on my home machine waiting to be put into the form of an actual "article" that could be added to my old site. I will still post full-blown articles from time to time, but I intend for this to be a place where I can just post quick thoughts as they strike me, without having to worry so much about how they're organized. We'll see how it goes.

NOTE: Right now there are no comments here, because that takes more work to set up, and the whole point of this is to minimize work for me. If you have comments, questions, suggestions, etc., please feel free to email me. I can't promise that I'll answer, but I try to be open to interesting discussions.

Posted at 23:07   |   Category: general   |   Tags: info   |   Permalink
Wizard Projects
Site Links
Open Source Projects
simpleblog3
dev release
plib3.stdlib
dev release
plib3.io
dev release
plib3.gui
dev release
setuputils3
dev release
simpleblog
dev release
plib.stdlib
dev release
plib.io
dev release
plib.gui
dev release
setuputils
dev release
Old Open Source Projects
Python Recipes
Fun Stuff
Shameless Plugs
Copyright © 2011-2014
by Peter A. Donis
All Rights Reserved