Live data from Hacker News

A deep dive into APL

curtisautery.appspot.com

81–90 of 93 posts

Re: A deep dive into APL

#81
post #76

Earlier quoted context omitted.

ColorForth is not an OS. For C. Moore, an Operating System is a non-thing.

That's splitting hairs a bit. If I boot into an programming system that lets me operate the computer, I'd call that an operating system. I don't see a significant difference between ColorForth (or other native forths) and e.g. home computer Basics, Oberon or even Lisp Machines. And more to the point, I wouldn't assume that kOS would be closer to Unix/Windows than Forth/SmallTalk/Mesa etc.

Your definition is simply not usable. By this definition, a bootloader is an OS, the BIOS is an OS, etc. All it needs is to force a little bit the interpretation of "lets me operate the computer". Just because "it" doesn't need an OS to run, it doesn't have to be itself an OS.

I think the issue is that there's no name for that kind of software which are just programs that run on bare metal. So everyone just call it an "OS" - including embedded system software vendors even though what is being sold is really just a library.

But often you have no kernel, no drivers, no resource management, no filesystem, no processes... All features one would expect from an operating system.

Furthermore, operating systems in the generally accepted definition are not supposed to include an interpreter or a compiler. They are not supposed to be interpreters or compilers.

So that's not hair-splitting at all. Those systems are really distinct from operating systems.

Re: A deep dive into APL

#82

I am blown away to see how frequently APL seems to come up on HN these days, a language I used professionally for over ten years. As much as I love it I have to say one of the issues with APL is that it was way ahead of it's time. Because of that it struggled to run on computers of that era. I was introduced to the language in 1982~ish. Like I said, I used it extensively, attended and presented at APL conferences and…

> Not sure where to go from here. For the past few years I've been telling people about the APL family of languages. The clincher for me was seeing the video of an APL version of Conway's Life mentioned in the submission. The impressive part wasn't its brevity, it was how they approached the problem. In APL you have a 'rotate' operator that shifts data in a particular direction. If you have a vector and you rotate it…

Exactly. Hence the idea of notation as as tool for thought.

APL makes you see and envision computational problem solving differently than, say C. Use it enough and your brain starts thinking in patterns, shapes, vectors and matrices being "zippered" together or apart, contorted and distorted.

Take a matrix of values and hit it with another matrix of 1's and 0's to select elements and then flip it, slice it, convert it to a vector and combine it with another vector to form a new matrix, then scale every element and apply a polyphase FIR filter across the rows using another matrix for the coefficients to then arrive at a vector containing your answer. This is made-up, of course, but that's how you start thinking, you start seeing parallel computing in your head and you can reach for it instantly with a notation that allows your hands to describe what you just imagined with a few well-selected symbols. No other language sends you on these flights.

It is truly seeing and approaching computational problems from a very different perspective. And the notation makes it comparable to composing music rather than going through the ugly mechanics of text-based programming languages.

I find it hard to explain to those who have never experienced this revelation of sorts. Watching a few videos and playing around with APL isn't enough. If I had to guess I'd say someone would have to work with it on a daily basis for about a year to achieve that mental shift.

Again, no different from musical notation. It is impossible to explain or experience how you see music once your brain can look at a page full of funny symbols and your mind starts to hear the music. The relationship with the piano, guitar or other instrument changes once that mental connection requires no thought at all.

Getting there with APL takes time. For example, you need to be able to sight read idioms like thee following much as a musician learns to read a two hand chord and instantly place their fingers exactly as required on the piano, without though.

http://docs.dyalog.com/14.0/Dyalog%20APL%20Idioms.pdf

or a large enough subset of these:

http://aplwiki.com/FinnAplIdiomLibrary

Back then, a lot of us used to walk around with a small pocket-sized FinnAPL idiom book in our pocket and had the FinnAPL idiom library book on our desk.

Re: A deep dive into APL

#83
post #16

I am blown away to see how frequently APL seems to come up on HN these days, a language I used professionally for over ten years. As much as I love it I have to say one of the issues with APL is that it was way ahead of it's time. Because of that it struggled to run on computers of that era. I was introduced to the language in 1982~ish. Like I said, I used it extensively, attended and presented at APL conferences and…

This is really interesting! What are your thoughts on the J language as an evolution of APL?

J and other variants were bad ideas and continue to be bad ideas. They abandon one of the more powerful aspects of APL: Notation.

Here's a paper by Ken Iverson about the power of APL notation:

http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pd...

Why does J exist?

Back in the mid 80's (I don't remember exactly) dealing with APL on IBM PC's was not easy. You really had to want to run APL.

For example, we had to hack the equivalent of today's graphics card to replace the character ROM with one programmed to display APL characters. The more advanced modification allowed you to throw a mechanical switch and go between APL and non-APL characters.

Printing APL characters required using very specific printers and changing the print wheel or ball (IBM printers) with versions having APL characters.

Again, you really had to want to run APL to endure this. And, that, of course, affected adoption. You couldn't run APL on any random IBM PC or clone on a desk.

So, Iverson, despite identifying notation as one of the more powerful features of APL, ends-up "going commercial" by transliterating APL symbols into combinations of ASCII characters. Now you could run something that behaved like APL on any computer. And, of course, it was a complete abomination. Terrible thing.

I think I can say the APL community rejected J almost universally. Doing this was a terrible idea. And a short-sighted one at that. It wasn't long til all computers had the ability to display expanded character sets and eventually full graphical canvases where anything was possible.

J was a commercial reaction to a hardware problem that evaporated very quickly. J was not a commercial success for reasons obvious to those of us who used APL professionally every day for years: It was a hot mess and almost diametrically opposed to what made APL so incredible to use in solving problems through computing.

I would stay far away from J. As brilliant as Iverson had to be to create APL when he did, J, as far as I am concerned, was an almost unforgivable mistake.

Re: A deep dive into APL

#84

I am blown away to see how frequently APL seems to come up on HN these days, a language I used professionally for over ten years. As much as I love it I have to say one of the issues with APL is that it was way ahead of it's time. Because of that it struggled to run on computers of that era. I was introduced to the language in 1982~ish. Like I said, I used it extensively, attended and presented at APL conferences and…

Lisp was also far ahead of its time, but many Lisp features like garbage collection and lambdas have made it in to mainstream programming languages. Has anything similar happened with APL?

Interestingly enough, I was working with APL, Lisp, Forth and C pretty much simultaneously during my ten year or so sting using APL professionally.

This was an amazing combination of languages to have in my toolbox simultaneously. The mental calisthenics alone were truly enjoyable to me.

Re: A deep dive into APL

#85

I am blown away to see how frequently APL seems to come up on HN these days, a language I used professionally for over ten years. As much as I love it I have to say one of the issues with APL is that it was way ahead of it's time. Because of that it struggled to run on computers of that era. I was introduced to the language in 1982~ish. Like I said, I used it extensively, attended and presented at APL conferences and…

You ever try the modern Dyalog offering with .NET, SQL, and R interop? Pretty cool stuff although I don't really use the language. There is a guy here writing a compiler for Dyalog APL that runs on a GPU, but is only a few pages of APL. If that isn't the future, I don't know what is.

No, I haven't sorry. I agree with the other comment in that APL, if it is to go anywhere, needs to be open sourced. I'll go beyond that and say that what we need is a new iteration of APL that addresses all the issues with a language that is now at least 30 years away from its most active and innovative period. That's a tall order. I can see getting into something like that as a retirement project. Way too much other good stuff to do now.

Re: A deep dive into APL

#86
post #20

I'm just going to leave this here: http://www.ccs.neu.edu/home/shivers/papers/rank-polymorphism...

"APL, and its successor J [...] provide a notational interface to an interesting model of computation: loop-free, recursion-free array processing." How is APL loop-free, exactly? Later they say: "Under this implicit lifting, the iteration space is the argument frame rather than a sequence of loop indices." So if I understand correctly, we have iteration, but no loop. But that doesn't seem like a really important dist…

RodgerTheGreat has given a great answer; I'd like to add that implicit iteration also lends itself to automatic GPUization, automated SIMD and multithread parallelization; the semantics of the "rank/depth" penetration come with no a-priori guarantee about order of evaluation (and it shouldn't matter anyway unless you are extremely naughty with side effects, which the languages greatly discourage).

Compare to an vectorizing/parallelizing an explicit loop, about which there have been tens if not hundreds of PhD dissertations, and it is still not a solved problem.

This is why "for x in ..." in Python/C#, and even the "map" variants, are still inferior to APL/J/K: the facts that iteration order is predefined, and that the iteration itself my terminate prematurely, make it extremely hard for the compiler to optimize, whereas in most cases, neither consideration matters.

Re: A deep dive into APL

#87
post #13

A+ a derivative of APL is still being used in a certain investment bank. 20 years of projects to deco it and replace it with something more modern haven't managed to completely kill it off yet. Main issue I had with it was the inability / cost to hire people with any experience, and the off-putting / steep learning curve. Once you get the hang of it though it's a great language for solving certain more numerically or…

Would you be able to comment about how much of it is the underlying APL (and math coded therein), and how much of it is the Electric GUI ?

Re: A deep dive into APL

#88

Earlier quoted context omitted.

You ever try the modern Dyalog offering with .NET, SQL, and R interop? Pretty cool stuff although I don't really use the language. There is a guy here writing a compiler for Dyalog APL that runs on a GPU, but is only a few pages of APL. If that isn't the future, I don't know what is.

No, I haven't sorry. I agree with the other comment in that APL, if it is to go anywhere, needs to be open sourced. I'll go beyond that and say that what we need is a new iteration of APL that addresses all the issues with a language that is now at least 30 years away from its most active and innovative period. That's a tall order. I can see getting into something like that as a retirement project. Way too much other…

That'd be a nice project. It's not APL, but I wanted to add that Perl6 has some APL features such as letting you define custom operators using any Unicode symbol you like, so you could technically write an APL language on top really easily. I wonder if more APL features will pop up in other languages in the future.

Re: A deep dive into APL

#89

Earlier quoted context omitted.

> Not sure where to go from here. For the past few years I've been telling people about the APL family of languages. The clincher for me was seeing the video of an APL version of Conway's Life mentioned in the submission. The impressive part wasn't its brevity, it was how they approached the problem. In APL you have a 'rotate' operator that shifts data in a particular direction. If you have a vector and you rotate it…

Exactly. Hence the idea of notation as as tool for thought. APL makes you see and envision computational problem solving differently than, say C. Use it enough and your brain starts thinking in patterns, shapes, vectors and matrices being "zippered" together or apart, contorted and distorted. Take a matrix of values and hit it with another matrix of 1's and 0's to select elements and then flip it, slice it, convert i…

Your comparison to musical notation is insightful. I think that I can expand upon it a bit. I can read both western notation and Byzantine notation. Byzantine notation is very different from western notation: it describes a melody using symbols indicating how many steps to take from the current pitch in a given scale. There are also rhythmic symbols added to the notes that generally require reading ahead of what you are currently singing.

For people interested in Byzantine music, the notation can seem imposing at first -- especially to people who already know western notation. Much effort has gone into translating Byzantine music into western notation, but some problems arise. First, some Byzantine scales use very different pitches compared to a western equal tempered scale. Second, the rhythms in Byzantine music can involve syncopation or other rhythms that can be difficult to notate using western rhythmic symbols. Finally, Byzantine notation is optimized for depicting melody, while western notation is focused on harmony. There is simply more unnecessary visual noise in writing Byzantine music in western notation.

That last point resonates with your talk of idioms. While Byzantine music may seem to have many neumes for a given musical phrase, there are many idiomatic combinations of pitch-changing and rhythmic neumes together. As such, what would be read in Western notation with many individual notes and rhythmic markings, becomes in Byzantine notation a single "word".

If you're interested in seeing how these systems of notation compare, look at the following hymn: http://www.cappellaromana.org/wp-content/uploads/2014/04/Che... The neumes are in red at the top, with a simple western interpretation on the first western music staff and an ornamented interpretation on the bottom staff. Comparing the neumes to ornamented western interpretation (which represents the full Byzantine ethos, or style), we can see that significantly more information is contained in the sparser Byzantine neumes.

Anyway, you've convinced me to learn APL because I now see how similar the arguments for this notation are to my own arguments for using Byzantine notation. Thank you for your insight.

Re: A deep dive into APL

#90
post #16

Earlier quoted context omitted.

This is really interesting! What are your thoughts on the J language as an evolution of APL?

J and other variants were bad ideas and continue to be bad ideas. They abandon one of the more powerful aspects of APL: Notation. Here's a paper by Ken Iverson about the power of APL notation: http://www.eecg.toronto.edu/~jzhu/csc326/readings/iverson.pd... Why does J exist? Back in the mid 80's (I don't remember exactly) dealing with APL on IBM PC's was not easy. You really had to want to run APL. For example, we had…

You mentioned in another comment that if APL is to go anywhere, that it needs to be open sourced. Unfortunately, the cost of Dyalog and the fact that it is closed source are the main reasons why I've ended up using J.

I appreciate that Dyalog is free for non-commercial use, but I think that part of what makes a programming language successful is if people can start using it in small ways to make their work better. For instance, at my previous job we started using Go for small things and it eventually took on a larger role once we saw how well it worked out in practice. Had we needed to pay to use Go for those small things, we never would have even tried it in the first place. I realize that the Dyalog company needs to actually make money somehow, but I wonder if they are aware of this problem. I did email Dyalog to see if using Dyalog for my work at a non-profit constituted commercial use, but they said that it did. :(

Edit: The reason why I haven't used GNU APL is because it seems like getting it to work under Windows will be difficult, and my work is unfortunately a Windows environment. Maybe I should give it a shot anyway.

Post reply on HN