6 ms·
It what ways is J an abomination? APL (and to a degree J) are on my bucket list of languages to learn. I’d always read that J was a sort of spiritual successor
by sswezey 5y ago
It what ways is J an abomination? APL (and to a degree J) are on my bucket list of languages to learn. I’d always read that J was a sort of spiritual successor to APL.
- rscho 5y agoHe holds a grudge against J, but not everyone does. I write research code in J and it's a very good little language. For instance, scripting is much easier in J. (Dyalog) APL is much more like an APL machine (in the sense of the LISP machine).
- 0xdeadbeefbabe 5y agoI believe he prefers one fancy character to two ugly characters.
- mlochbaum 5y agoI think my reasons are very different from robomartin's but I share the opinion that J has some pretty serious flaws. Some are brought forward from APL, some are not. It has no context-free grammar (but neither does APL). Scoping is local or global: if a variable in a function is local, even inner functions can't access it. It has namespaces (locales), but they are not first-class and are instead referenced by numbers or strings, so they can't be garbage collected. Until this year, there was no syntax to defined a function—even though control structures had dedicated syntax! System functionality has no syntactic support, so it's provided by passing a numeric code to the "foreign" operator. To enable recursive tacit functions, functions are passed by name. Not just as arguments, anywhere. The name is just a string with no context information, so if you pass a function to an explicit modifier and the name means something different in that scope it will do something different (probably a value error, fortunately). Oh, also these names store function ranks, and if you define the function later it won't pick it up, so even the tacit recursion thing is broken. The designers of J weren't familiar with design principles that are common knowledge outside the APL world, and it really shows. J was my first programming language (well, except TI basic) and while I'm still a big fan of array programming it really held me back from learning these things as well.
- resolvent 5y agoFunctions, if you are referring to monads and dyads, can be defined using "3 : '...'" or "3 : 0\n...\n)" using "3" for monads and "4" for dyads. As for rank information, functions do carry that rank. I believe you are not defining any rank, it which case it becomes infinite rank and depending on usage, it will be applied incorrectly. For tacit recursion, there is the "$:" operator, which allows a tacit function to call itself anonymously. You may also need the agenda operator "@." to define your base case with a gerund "`". The "foreigns" table, while useful, seems like a cludgy way to introduce functions that don't or are difficult to introduce cohesively into J's notation.
- robomartin 5y agoI'll reply to all comments here. No, I don't hold a grudge against J. That's preposterous. Silly, really. These are tools. No. I don't prefer one symbol to two characters. That is also silly. You have to understand the HISTORY in order to understand my statement. APL was, at the time, brilliant. Remember that it started in the 60's. Way ahead of its time. I learned and worked with it professionally in the 80's and early 90's. Ken Iverson, the creator of APL, understood the power of notation as a tool for thought. In fact, he famously authored a paper with exactly that title [0]. I had the pleasure of being at an APL conference where Iverson himself presented and discussed this paper. I also took advantage of tutorials and sessions by Iverson and many of the early APL luminaries of the time. The power of notation might not be easy to understand without truly internalizing APL or having good command of a reasonable analog. For example, a classically trained musician appreciates the value of musical notation. While not perfect, the alternatives have failed to deliver equivalent results, power, expression, etc. The day something else is used to score and perform orchestral performances we might have something to consider. There are other examples of the power of notation and the paper covers the subject well. So, why is it I say J is an abomination? History. Why does J exist? Why did Iverson go this way after correctly noting and promoting the idea that notation was a powerful tool? He made a mistake, likely driven by a failed attempt to improve business outcomes. Here's the history part. Back in the '80's doing APL characters was not easy. On mainframe based systems we either had to use specialized IBM or Tektronix terminals and printers. When the IBM PC came out we had to physically replace the video card's character ROM (not sure most people know what this is these days) in order to get APL characters. A common hack was to install a kludgy setup with a toggle switch so you could switch between APL and standard characters. The keyboard, for the most part, got stickers glued to it on the front face of the keycaps. You could, eventually, buy new keycaps for the IBM PC standard keyboard. Printers suffered a similar fate. You had to reprogram and hack Epson and other printers in order to be able to print the characters. Incidentally, if you wanted to use a PC for, say, Japanese and English back then you had to resort to the same kinds of hacks or buy specialized video cards and software. I could go on. The point is that you had to be truly determined to do APL back then and it was a pain in the ass. Convincing an employer to hack 500 PC's so you could migrate to APL was an exercise in futility. Financials and other industries where the power of APL could be put to good use took the plunge, nobody else did. I did an APL-based DNA sequencing tool for a pharmaceutical company back in the 80's. APL wasn't going to go very far beyond academic and corner-case circles under those conditions. That's when Iverson came up with the J concept of transliterating APL characters to combinations of standard ASCII characters. It was hard to impossible to sell APL to the masses given the issues of the time. Iverson thought the transliteration would open the doors to the wider audience. Well, it did not. Among other things, notation, believe it or not, is much more practical and easier to learn than a seemingly random mish-mash of ASCII characters. From my perspective Iverson suffered from a lack of conviction based on likely business pressure. The hardware of the day was conspiring against being able to push APL out to the masses. He did not have visibility into what was coming. Shortly after he took the J trip, the IBM PC went fully graphical and universal multi language (spoken) characters could be rendered without hardware hacks. Except that now Iverson, the creator of APL, had his business interests firmly attached to J. Here we had a situation where the creator of APL pretty much abandoned the language he brilliantly developed, taught and promoted for over twenty years. The J enterprise, as a business, deviated his path and likely seriously damaged APL. And it failed. It absolutely failed. Nobody who used APL for any non-trivial application was going to consider J. Not due to some test of purity. No, it was because the power of notation is such that J was, in fact, a complete abomination. The only way anyone I knew would consider it was if by force. I can't think of any APL-ers of note of the era that truly jumped on the J bandwagon. The proof that J failed is simple. It's just as dead as APL. Corner case use, sure. Just like APL. I used APL professionally for ten years and I would not touch it at all for any real application today. Anyone doing so would be crazy to make that choice. The only exception would be in maintaining or extending an existing system. Even then, you have to very seriously consider porting it to a modern language. Notation isn't "funny characters". It's a powerful tool of both expression and thought. If notation is "funny characters" what do we say about every written human language with "funny characters" (Chinese, japanese, greek, arabic, hebrew, etc.). Do we convert every word in Chinese into ASCII transliterations of the symbols just do it doesn't look "funny" and to make Chinese more popular? No, this would be an abomination. Chinese is a rich and expressive language, complex, yes, of course. And yet the power of this language, among other things, in the notation used to put it to paper. Imagine converting every "funny character" human language to a mish-mash of ASCII just because the IBM PC could not display them in the early days. Imagine then saying that someone calls these abominations because "he prefers one fancy character to two ugly characters" or "He holds a grudge against <language>". The first thing that comes to mind is "ignorant", followed by "misplaced". Learning about and understanding history and context is very important. Can J be used for useful applications? Of course. So can COBOL, FORTH and LISP. Yet this does not mean it is a good idea. And using J to write research code (which I did with APL in school as well) is nowhere near the realities of real code in real life at scale and maintainable over time and hardware evolution. Extending this to mean that abandoning the power of APL notation due to hardware issues was a good long-term idea is, in my opinion very wrong. J has no future. Neither does APL in its current form. I still think everyone should be exposed to languages like FORTH, LISP and APL in school. There's a lot of value in this. EDIT: Imagine if Guido had abandoned Python just before it started to become popular and went in a different direction. The language would have stagnated and likely become irrelevant. That's what happened to APL. And J went nowhere as well. Iverson confused and antagonized the APL community to go after perceived business opportunities. In doing so he pretty much destroyed APL and J. [0] https://www.eecg.utoronto.ca/~jzhu/csc326/readings/iverson.pdf https://www.eecg.utoronto.ca/~jzhu/csc326/readings/iverson.p...