| I had the same concern as you regarding the readibility of APL and J. But there is a wonderful quote in an interview with Arthur Whitney (0) of kdb+ fame in relation to this: BC To ask a slightly broader question, what is the connection between computer language and thought? To what degree does our choice of how we express software change the way we think about the problem? AW I think it does a lot. That was the point of Ken Iverson's Turing Award paper, "Notation as a Tool of Thought." I did pure mathematics in school, but later I was a teaching assistant for a graduate course in computer algorithms. I could see that the professor was getting killed by the notation. He was trying to express the idea of different kinds of matrix inner products, saying if you have a directed graph and you're looking at connections, then you write this triple nested loop in Fortran or Algol. It took him an hour to express it. What he really wanted to show was that for a connected graph it was an or-dot-and. If it's a graph of pipe capacities, then maybe it's a plus-dot-min. If he'd had APL or K as a notation, he could have covered that in a few seconds or maybe a minute, but because of the notation he couldn't do it. Obfuscation is not the goal of this style of programming, even though it looks like it's been deliberately golfed. Being able to express complex operations in terse but well-defined ways makes the intention clear. If you know the meaning of the primitives in +/ . * then there's little to debate that the combination is the matrix product. Whereas, if you have this operation expressible only with multiple explicit loops and intermediate variables, there are greater opportunities for error and a greater reading overhead. I don't think J/APL are suitable for every sort of programming, and the sort of domains where J/APL excel are array-focused. J/APL's notation are a poor fit for writing a frontend single-page application (SPA), for example, and I would never want to maintain a SPA that merged all their functions into one line. I would not write complex integrals in English, and equally I would not write a medical document in mathematical notation. But the goal of these languages is to improve the readibility of array manipulation by using composable and well-defined operations, not to obscure it. There is a large upfront cost to learning the notation, no doubt about it, and this is a necessity before you can use the language at all. But the intention is not for it to be harder to read - it's for it to be easier. (0) https://queue.acm.org/detail.cfm?id=1531242 |
a, array programming concepts
b, apl like syntax
I think the combination of these two makes J and co interesting. I am just not sure if the second is required. Not sure how much is lost if we use the following:
I totally agree with you that nested loops should not be the way to express mathematical computation over matrixes. I was just curious that we need the (for me) obfuscated syntax or we can use more of the plain English version without performance differences. After reading about J more the biggest difference between J and APL is that J is restricted to ASCII characters.