Jach's personal blog

(Largely containing a mind-dump to myselves: past, present, and future)
Current favorite quote: "Supposedly smart people are weirdly ignorant of Bayes' Rule." William B Vogt, 2010

Short guide to Lisp (syntax)

(Update: Go watch Rich Hickey's Clojure for Java Programmers for a superior introduction to Clojure's (a Lisp) syntax.) Lisp has been around for a long time. While some of its current magic capabilities are fairly recent, the basic syntax it uses has hardly changed at all over 50 years. To me this means it's endured because it's good and because it's simple and because it's powerful. I'll talk about those last two qualities here, maybe you'll end up also believing the syntax is good.

I will start with a related topic: mathematics. Not any particular usage of math, just the notation. The symbols. One of the hardest things for me in math has been memorizing symbols, especially this little guy: $$\nabla$$. Very subtle changes in the way you write stuff on paper can drastically change the meaning of something. In elementary school you're taught that $$\times$$ means the same as $$\cdot$$. Later you find out they're very different. I could give more symbol soup examples, but take a moment and just skim down the linked Wikipedia page.

There's a similar phenomenon in most programming languages. There are symbols and syntax for all sorts of weird things. In math you might say "let x = 4", in programming you might say "$x = 4;". Wouldn't it be nice if math, and programming, had a consistent syntax?

See Full Post and Comments

Anarchy vs. Sovereign Structures

There's a curious relationship between forms of government that employ states vs. those that don't. I'll try and touch simplistically on it, and go over a few thoughts.

The main issue at hand is authority, with a corollary being power. Abstractly, systems of Anarchy claim that structures where no individual person, or node, has authority over any other, should perform better at least on average than structures with a command network, i.e. authority. In Anarchy, power is distributed equally across everyone. In other structures, different nodes have different amounts of power, with the most stable structure being one where there's a clear ordering to the power. That is, one node has the majority of the power, and the rest follow from there with no equivalent nodes of useful size. (In a Monarchy, the peasants may all be more or less equal, but the individual power amounts and the sum total of the power in the group is negligible compared to the absolute authority of the Crown.)

When people dismiss Anarchy, they are arguing that either a) authority-less networks perform worse on average and so aren't useful, or b) such a network is unstable (some say impossible) and authority will manifest itself naturally one way or another (typically through mob violence). a) is purely a technical argument that I won't get into here, though briefly I'd mention that while there may be some cases where having a command system definitely helps, such as running corporations or militaries, I think it could be shown that those do not represent the majority of interesting cases. b) is more interesting.

See Full Post and Comments

Inferential Distances Again

I briefly touched upon this previously, but some actual examples in the form of fake dialog would be more useful. Before I get to that though, let me try and frame the problem abstractly. When you master a body of knowledge with long argument chains, you'll find that trying to convince someone of your conclusions, especially the non-intuitive ones, without them going through a similarly long argument chain, is near impossible if they haven't even started on a similar road you took. In the process of trying to explain why you believe your conclusion, you inevitably have to move down to a further level on the inferential chain and create a link from that level to your conclusions. At science conferences, a presenter might do this by starting off with a general set of facts the layman wouldn't be expected to know, but most people in the presenter's field should, and create a link from that point to his presentation's conclusion. A single step such as that has an inferential distance of 1, and has two levels. Now if the same presenter is trying to explain it to a layman, there may be any number of levels below the first that he started with his colleagues, and he now has to go through those first.

But it gets even worse, because the inferential chain is really a graph. There may be some "hierarchy" to it, as in you need to accept certain ideas on the graph before you can move to a different area of the graph with its own network of ideas, so you can consider it a chain with each link being a graph, but that's only valid for strongly hierarchical models.

Now imagine the difficulty that presenter might have trying to explain his conclusions to a layman. Many ideas, or "nodes", in the graph need to be visited and agreed upon or at least understood before he can move up an inferential level. If he's uncertain where the layman's initial knowledge lies, he'll most likely start at a level too high. And so the layman asked him to explain X, suddenly the presenter is explaining Y, Z, W... None of which the layman really understands, and the presenter only realizes this once he gets to W which is reinforced by Y, so he drops down a level to start explaining A, B, C...repeat. This is understandably confusing for the layman, and if the layman is predisposed to not liking the general thrust the presenter is heading for already, he may start shutting out everything. Then he'll accuse the presenter of constantly changing the subject and being dishonest when the presenter is just trying to bring the layman up to a level where understanding X in reasonable terms is even possible.

See Full Post and Comments

Python: map or list comprehensions?

This question seems to come up a lot when doing functional programming in Python. Should you use the more classical map/filter functions, or the Pythonic and usually more readable list/generator comprehensions? Do you do:

map(lambda x: x*x, xrange(11))


[x*x for x in xrange(11)]


(Note that map in Python3 is lazy and you would use range(), if you want laziness with comprehensions use parentheses instead of brackets to use generators.)

See Full Post and Comments