Miaou = Cat!
Vector 12:3, page 131
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 131
Teachers have known for years that from earliest youth one must learn the right word. One calls a cat, a cat.
It ought to be the same with languages in information technology, but it isn’t always so. I want to give a simple example drawn from Vector Vol 12 No 1 page 88.
The vector Q is formed of three numbers:
In the setting of my example I’m not debating the choice of assignation but what follows:
This is the difference between two scalars. Basic, Fortran, C and other languages are capable of doing this sum.
On the other hand APL can do better: the difference between two items from the same vector:
or, to be complete,
APL2 from IBM (and other APLs) can do these two sums with a simple operator:
THINK. It takes hardly any effort to think of Q as a set of values as distinct from some scalars in a variable. Even in as simple an example as presented here, the latter will never be programmed well in APL.
I deplore the logic of APL*PLUS III which introduced structure, because it makes it easy to program treating variables as scalars, as in Fortran.
P.S. I leave you the surprise of comparing execution times on your machine with your interpreter. (On my 66MHz PS2 with IBM’s APL2 the vector version takes a quarter of the time.)