APL Data Structure Defaults in METSIM

APL Defaults - Hidden Complexity?

We have used the comma to catenate (join) and ravel (break apart and re-arrange as a simple list). It can be used with axis (providing more options to control how it joins things, or re-arranges the individual elements after stripping away the structure).

We have seen that you only need to say what isn't already implied (by a default behaviour). So how do we remember what the default action will be?  How do I know that the default axis for extension by catenation is to increase the number of columns (or the axis direction is to the right)?

APL is not a language, like some, that:

  • Started with coded thought bubbles, or the spare parts bin of another earlier language
  • Grew by adding patches and work arounds,
  • Had functionality stripped away that couldn't be made to work properly (safely),
  • Was gracefully retired with accolades (the bugs count had stabilised at an unacceptably high count and code management had become impossible) to replaced by a "new and better" language. Ref. Tanenbaum and Woodhull, Brooks.

We are seeing an explosion of "new" and "better" languages with friendlier looking animal mascots. At the moment I am getting interested in the Minix 3 operating system. It uses Racoons as the mascot.

The explosion of new best languages may tell us there is an explosion of problems found with the "last new best" language. OK, enough of the rant - why is APL different?

APL was not developed as a short sighted vision (prediction, especially about the future, is difficult) with new ideas added - it started as a complete mathematical notation that was proven to express mathematical concepts that could not be expressed with conventional notation. It became a programming language (a compiler was developed by users, not the inventor of the notation) after it had been proven as completely functional.

So back to the point.

Is the default behaviour of catenate intuitive - or is it a hidden level of complexity that only APL nuts can remember? Well to be a default it has to be always predictable. It has to be solid, unambiguous, and require nothing more than a glancing thought and a recognition that it is obvious. So to increase the length of a dimension by catenation, with no mention of which dimension that will be - there is only one possible interpretation that you can be absolutely sure of the result - and that is to extend the lowest dimension (the rightmost axis in the shape vector), and that is in the direction of increasing the number of columns (to the right). And so it is the default. No remembering - just common sense (understanding data structure) is required.

Cheers, Jim