JayLanguage is a brilliant next step from KenIverson's AplLanguage. But while it is a mind-expanding language (in the greatest sense; even though you've programmed in C/C++/Pascal/Smalltalk/Java for many years, J will reduce you to feeling like an overwhelmed college student), it has some significant flaws as a language and implementation:
Language:
- Rank is a deep and powerful concept...but one that may be too complex to justify the benefits. There's a steep newbie hill involved in understanding rank, but once beyond that it is still a frequent mind-bender and source of errors. KayLanguage takes an alternate, simpler approach.
- So what is the difference between J and K rank???
- A: In J you deal with arrays of many dimensions. The difficulty is in how you take two differently sized multi-dimensional arrays and map the arguments to each other. It starts out simple, but then you need papers written by J authorities, like "Untying the Gordian Knot: Agreement in J." This is one of those subjects that's surprisingly deep and difficult to grasp. In return, the language is harder to understand and the interpreter is significantly slower. In K all arrays are one-dimensional. You can string one-dimensional arrays together in lists. A 3x3 matrix is a list of three elements, where each element is an array of length 3. In practice, these are much easier to manipulate and understand.
- Oh, that issue. Right, complex topic!
- The language forces parsing to be entangled with evaluation -- you can't tell whether some subexpression produces a verb or an adverb without evaluating it, but then that affects whether it associates left or right in parsing. So it's not even generally possible to pre-parse non-tacit code.
- Tacit definitions, on the other hand, are limited -- it's generally impossible to apply a non-constant expression to the argument of an adverb. Tacit adverbs can only be defined in limited ways, and tacit conjunctions are generally impossible.
Implementation:
- APL traditionally has "per operator" overhead. That is, summing an array of 20 elements is likely faster than summing two 10 element arrays, because of the initial argument checking and set-up and so on. In J, this overhead is tremendous, possibly as a result of the complex rank system.
- Non-tacit definitions are stored as raw text and are fully-parsed each time such a definition is called. If it is 50 lines, then each time that definition is called all 50 lines will be parsed first. Even if this call is inside of a loop.
Why do these array languages tend to use so many symbols instead of MeaningfulName s? What would happen if it was given a more functional syntax?
Why do these array languages tend to use so many symbols instead of MeaningfulName s? What would happen if it was given a more functional syntax?
They use symbols for the same reason simple algebra uses symbols -- it's concise, to the point, written-language independent, and once you get the hang of it, fairly easy to read. The real question is why they don't advocate proper spacing rules, which turns an infix expression into BaudBarf?. Just you try to write the quadratic formula in a functional style using MeaningfulNames. You have to impose some algebraic notation if you want to strike any kind of balance between intent, meaning, and conciseness.
{A compromise is to use very short names, say up the three letters. Or, at least allow the names as an alternative to symbols.}