Tuesday, May 29, 2012

If programming religions were languages

I generally agree with this post, “If programming languages were religions”, and not just because he said nice things about Python.

However, I'd like to comment on this point:

APL: ...you've always suspected that it's a huge and elaborate prank that got out of control.

That's a pretty accurate description of Scientology, but APL's story is different.

It started with Ken Iverson's 1962 work A programming language. This book was not intended as a programming language, but as an exercise in mathematical notation. Specifically, Iverson wanted to describe certain operations in abstract terms. For example, adding two 50-element vectors was generally described in programming terms as looping over the 50 addends and producing 50 sums. Iverson proposed that the “+” operator be defined on two conformant vectors as a single operation.

An IBM researcher, Herbert Hellerman, implemented a language processor for a subset of the notation, and from there it grew by word-of-mouth. At one point IBM tried to shut it down but the user community screamed too loudly, and IBM eventually sold quite a number of big mainframes just to run APL.

The notion that you can add two arrays with a single operator is taken for granted these days, especially in contexts like MATLAB and Mathematica and the excellent NumPy package for Python. Bits of APL survive in all these languages. For example, the “reshape” operator, which can turn a 1000-element vector into a 10×10×10 array, was the ρ (rho) operator in APL.

No comments: