
What's so cool about APL - fogus
http://arcanesentiment.blogspot.com/2010/12/whats-so-cool-about-apl.html?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ArcaneSentiment+%28Arcane+Sentiment%29&utm_content=Google+Reader
======
beagle3
I'd add a few more (equally regarding APL and K and J and q)

* They make it easier (and thus idiomatic and common) to write code that is vectorizable, GPUable, parallelizable, etc.

For example (q syntax here), if you have a string x that has parentheses, and
you want to know if they are balanced, a "balance" vector would be b:sums
(x='(')-x=')' [sums is cumulative sum] this would count +1 for each open, -1
for each close. To verify the string is balanced, you have (all b>=0) and
0=last b [read: minimum of b is 0, and last of b is 0]. They can be combined
to one vectorizable expression:

(all b>=0) and 0=last b:sums (x='(')-x=')'

* The bugs in these languages tend to be almost exclusively logic bugs (wrong implementation assumptions, common to every language) or one-off bugs if your cut-and-paste vectors with mismatched indices. Others are very rare

* The terseness makes a lot of code fit on the screen at the same time. Which requires more mental effort to process but pays off hugely as you get a lot more context at the same time.

------
hvs
It's a fair argument, although I feel that most APL programmers would have
noticed that a lot of languages share those characteristics now, but if it
gets the job done, great.

I was kind of hoping for a more technical discussion (with code samples!) of
why APL was cool, though.

~~~
rednum
Exactly, you could replace APL with lisp or OCaml (well, except that OCaml
wasn't around in the 60') and all these points would still be true. I wonder
if there are any APL users on HN who could provide more detailed information
on merits of this language?

~~~
lhorie
I'm not too familiar with OCaml, but afaik one of the appealing features of
APL is that it makes it easy to work with multidimensional collections in
addition to one dimensional list-like collections (well, "easy" once you can
grok the syntax). Do lisp and OCaml have those facilities out-of-the-box too?

~~~
silentbicycle
No - neither Lisp nor OCaml makes looping over collections with an arbitrary
number of dimensions _implicit_.

------
bobsh
I wonder how many people would appreciate APL on the iPad? At least one person
would....

~~~
ctdonath
I lit up at your suggestion. I've been looking for a reason to not chuck my
APL books. Then it hit me: One with the initials SJ would not appreciate APL
on the iPad. The iOS ecosystem abhors "arbitrary code" apps.

~~~
RodgerTheGreat
Maybe you could get away with describing it as a "calculator"?

------
oddthink
I've never tried the original APL, but J and q are great interactive
calculators, due to their terseness and overall structure.

For example, if I want to convert a 4-item vector to fractions of the total, I
can write:

    
    
      x <- c(1, 3, 2, 5); x/sum(x)
      x=np.array([1, 3, 2, 5]); x/np.sum(x)
      {x%sum x} 1 3 2 5
      (%+/) 1 3 2 5
    

in R, python, q, and J respectively. In q and J, I don't have to type the
commas, and many of the parentheses and brackets go away.

I know it seems like a trivial thing. It certainly is for _code_ , i.e. stuff
that you're saving in a file and intending to use later. But for an
_interactive calculator_ , it's important.

Clearly, if you're not doing very mathy work, things like this don't come up.
But in its domain, it's very nice.

(Edit: TCL is similar in this regard: it doesn't require as many commas and
parenthesis as other languages, making it a very good, well, tool command
language.)

------
ctdonath
Anyone recall a paper depicting full emulation of an IBM 360 mainframe in APL?
A fond memory of techcool from long ago...

