News for hackers. Stuff that matters.
Re:On being startled by a programming language by jfager on Thursday March 17, 2011 @02:14PM (#2337262)
As a wholly unaffiliated, self-selected, and entirely unofficial spokesperson, I'm happy to bestow this lifetime achievement award on behalf of the IOCCC.
Re:On being startled by a programming language by narrator on Thursday March 17, 2011 @02:50PM (#2337459)
People who like APL do not often code with readability as their number 1 priority. In fact, to code in APL one must have an outright disdain for the idea that someone else could easily understand their code.
Re:On being startled by a programming language by silentbicycle on Thursday March 17, 2011 @05:03PM (#2338078)
No, we just have a different idea of what's readable. APL was created to have a mathematical notation that made problem solving easier. Don't believe me? See Iverson's Turing Award lecture,"Notation as a Tool of Thought" (http://www.jsoftware.com/papers/tot.htm).

"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." - "A Conversation with Arthur Whitney" (http://queue.acm.org/detail.cfm?id=1531242)

Re:On being startled by a programming language by gchpaco on Thursday March 17, 2011 @06:41PM (#2338470)
APL is actually not inherently so bad, because at least the operators have some vague relationship to what they're doing and are all distinct. I can't read J at all because in attempting to embed the APL operator space in ASCII they went in for multiple token operators that can be modified (so =, =., and =: are all different, and actually quite different IIRC).

A better way of doing this is Fortress, which tries to use mathematical notation when possible but doesn't try to compress it as small as possible.

Re:On being startled by a programming language by gnosis on Thursday March 17, 2011 @04:10PM (#2337836)
With that kind of attitude, they might enjoy programming in Brainfuck or Malbolge even more.
Re:On being startled by a programming language by gruseom on Thursday March 17, 2011 @02:59PM (#2337492)
Begging your pardon, you're doing so out of ignorance. An entire programming ecosystem -- a brilliant one, one of the very most impressive -- has been built on top of what you are denigrating. Scour through searchyc looking for past threads on APL/K/J and you'll find the arguments all repeated on multiple occasions, including many instances of the same but-this-isn't-what-I'm-used-to rush to judgment that always, unfortunately, comes up in droves.
Re:On being startled by a programming language by scott_s on Thursday March 17, 2011 @03:19PM (#2337587)
You're conflating the implementation of an environment with the value of the environment itself. Did you read the C code? It is terribly difficult to follow, does not follow C formatting idioms, and makes frequent use of macros that further obfuscate what is going on. Example:

  #define DECLG  V*sv=VAV(self);A gs=sv->g;  \
                 AF g1=gs?VAV(gs)->f1:0,g2=gs?VAV(gs)->f2:0
Judging the quality of this code says nothing about the language and environment that this code provides.
Re:On being startled by a programming language by silentbicycle on Thursday March 17, 2011 @03:56PM (#2337783)
From the coding conventions for Kona (http://github.com/kevinlawler/kona/wiki/Coding-Guidelines), an open-source implementation of K 3.2 that I've been contributing to lately:

    This is a very unusual style of C
"The unusual appearance is a side effect of writing C as concisely as possible. There are great benefits to writing code as concisely as possible. Someone familiar with the style can read and comprehend the code much faster than they would be able to with traditional code. It also creates a discipline that reduces bugs. Some of the benefits will not be apparent until you try it. Some of the downsides of the style are inaccessibility and a steep learning curve."

You get used to code like that, and often, doing it that way makes sense. I first encountered it learning to read this short prototype interpreter (http://nsl.com/papers/origins.htm) by Arthur Whitney, which very strongly influenced the programming style in the J codebase.

As gruesom notes, this discussion has already happened numerous times in the HN archives. Your reaction is the APL equivalent of going, "OMG! Parens!!!!1!" when introduced to Lisp code.

Re:On being startled by a programming language by scott_s on Thursday March 17, 2011 @04:07PM (#2337824)
Fair enough, although I've read many threads on APL-derived languages over the years on HN, but I somehow missed the discussion of the C runtime implementation.
Re:On being startled by a programming language by silentbicycle on Thursday March 17, 2011 @04:15PM (#2337853)
AFAICT, the implementations have usually been closed-source (with the exception of A+ (http://www.aplusdev.org/), which is GPL'd; Arthur wrote it before K), and most research on APL implementation is locked behind the ACM paywall.

I suspect part of the style comes from APLers typically being mathematicians as well as programmers, and drawing more from mathematics than typical "software engineering best practices" style.

Re:On being startled by a programming language by scott_s on Thursday March 17, 2011 @04:22PM (#2337889)
Then, forgive me for harping on this, how could this discussion have already happened numerous times on HN? And by "this discussion" I mean the C style used to implement APL-derived languages, not the style one uses to write programs in APL-derived languages.
Re:On being startled by a programming language by silentbicycle on Thursday March 17, 2011 @04:27PM (#2337912)
They've mostly involved the "J Incunabulum" prototype and A+. See e.g. http://news.ycombinator.com/item?id=2178177 .
Re:On being startled by a programming language by gruseom on Thursday March 17, 2011 @11:52PM (#2339245)
Hi Scott. I don't exactly agree, because the terseness and lexical density of the C code are the same qualities as cause people to recoil from APL/J/K programs as well (http://www.nsl.com/k/s/s.k). The implementation and language are cut from the same cloth. This of course is not always true (i.e. your point holds much better in the general case) - but it is true in this world, where program brevity and regularity are so highly prized.

Let's note that the payoff for departing from the mainstream in this way is not small: these languages achieve abstractive (compositional) power and elegance without sacrificing efficiency. Those two things are incompatible in nearly every other programming context -- so much so that it's a truism that higher-level code is shorter but slower, lower-level code is faster but more verbose. Yet here they happily co-exist.

Re:On being startled by a programming language by scott_s on Friday March 18, 2011 @10:21AM (#2340456)
silentbicycle's examples and points have actually made me come around somewhat.

But there is a key difference between the terseness and density of APL-derived languages and the C implementation of the runtime: in the actual languages, the semantics of the language are well defined and enforced by the compiler. C is a free-for-all. So while there is discipline behind the C code - and I can see that it mimics the language it implements - it must be self discipline. That makes it more dangerous, and objecting to that is not the same as objecting to the APL family of languages themselves.

Re:On being startled by a programming language by jfager on Thursday March 17, 2011 @03:34PM (#2337660)
Forgive me, I think we've had a misunderstanding. To my mind, the IOCCC is a contest where very smart people work very hard to bend C as far as it will go to come up with very clever programs. The fact that something as impressive as J is implemented like this blows me away, and while I would never want to (nor ever could) work in the codebase myself, I think it's wonderful.
Re:On being startled by a programming language by gruseom on Thursday March 17, 2011 @11:48PM (#2339239)
Forgive me back. I was writing more hastily than I usually try to do and being kind of a grouch about it.
Re:On being startled by a programming language by akkartik on Thursday March 17, 2011 @03:13PM (#2337558)
I've seen some threads on APL, but I've never seen other languages used with APL-level compression. Are there really other threads about this? I'm not sure what to search for on searchyc.
Re:On being startled by a programming language by silentbicycle on Thursday March 17, 2011 @04:05PM (#2337811)
Try any of these: apl iverson k kona whitney j hui incunabulum

(That one-page J interpreter is sometimes called the "J Incunabulum".)

See e.g. http://news.ycombinator.com/item?id=1458016 http://news.ycombinator.com/item?id=266982 http://news.ycombinator.com/item?id=697501 http://news.ycombinator.com/item?id=2176980