

On being startled by a programming language - sbierwagen
http://bbot.org/blog/archives/2011/03/17/on_being_surprised_by_a_programming_language/

======
sofuture
J is awesome. GPL'd J is even better!

Some of us are trying to organize our efforts here:
<https://github.com/openj/core>

We don't intend on mucking with the code much at this point, just patching
together a better build system, etc.

~~~
jameskilton
I think I'm more amazed at the C code. Is that obfuscated or a decompiled
dump? Or is that how the core of J is really written?

~~~
sofuture
Hah! That is how the code is really written. It's... a unique style, shared
amongst the APL languages.

I'm pretty sure there are about two people that can read and write that
fluently: Roger Hui and Arthur Whitney.

~~~
jfager
As a wholly unaffiliated, self-selected, and entirely unofficial spokesperson,
I'm happy to bestow this lifetime achievement award on behalf of the IOCCC.

~~~
narrator
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.

~~~
silentbicycle
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>)

------
forkandwait
I would like to coin a phrase: "seduced by syntax".

I think humans LOVE syntax; and syntax is often loveable, crystallizing a new
viewpoint into a linguist pattern that allows this viewpoint to be diffused by
our amazing hardwired capabilities for language. J does that.

That being said, sometimes being seduced, while REALLY FUN for a little while,
turns out to REALLY MESSED UP in the long run. I think J and APL are like that
too -- just break up with him, really....

For another metaphorical take: I think Python and C are like English --
boring, with a lot of fun syntax stripped out, but very, very useful. C++ is
like Mandarin -- completely complicated, but so much literature and history is
written in it that you have to take it seriously. Shell is like the pidgin
languages. And J/APL ... they are like Quileute (the language spoken by Jacob-
the-Werewolf's tribe): completely difficult, arcane, counter intuitive, and
only spoken by like six other weirdos (ie don't bother).

All these languages are seductive, though.

J programmers love to exchange emails like "I found a way to calculate pi to
the 80th decimal with only 4 characters" ... as if that is remotely useful. We
have J code in use in our office -- its fun, if you like speaking Klingon, but
it is a complete waste of time and sweat for any pragmatic applications. If
you want to do complex weird matrix stuff in a few lines, learn linear algebra
and tensor operations for chrissake, which actually have some utility in the
real world. And don't be fooled by APL/J types telling you their language is
mathematical -- it isn't, in the sense that you can't actually derive new
results with it; it is just difficult (good math makes thing _easier_ ).

Sorry for the rant. I wish the damn language would disappear, and we could
remember it wistfully like SNOBOL, Ada, SAS, and other bad experiments in
seductive syntax.

~~~
gruseom
Syntax to me is superficial. What APL/J/K are doing is much deeper: programs
are short sequences of composable operators.

~~~
ldh
I get your point, but syntax ceases to be superficial if it prevents you from
expressing what you want to say cleanly. As a daytime Java programmer,
discovering the freedom _from_ syntax that Lisps allow you has been
revelatory.

~~~
gruseom
I quite agree. It was revelatory for me in the same way.

------
dfan
I'm trying to figure out what is so startling about this, actually. The {
function just seems to return the element at the given index, or if you pass
in a collection of indices, maps that operation onto the collection. That is
convenient operator overloading but not mind-blowing.

~~~
sofuture
True, that is what's happening. The cool thing is that dimensional (in J
terms, it's 'rank') overloading is inherent to the language.

Most operators have implicit dimensional looping or respond different to
differently ranked inputs.

Take for example _integers (i.)_ :

    
    
           i.3
        0 1 2
           i.3 3
        0 1 2
        3 4 5
        6 7 8
    

(That's kind of a dumb example, but I think it at least hints at the
expressive power of rank.)

------
raymondh
Other than using an operator for a function name, there's no real rocket
surgery in this post:

    
    
      >>> def index(x, y):
            'Dyadic function indexes y by x'
            return [y[i] for i in x]
    
      >>> p = list(range(22))
      >>> shuffle(p)
      >>> p
      [1, 20, 19, 15, 9, 14, 6, 8, 2, 4, 16, 18, 10, 3, 0, 13, 12, 11, 7, 17, 5, 21]
      >>> index(p, p)
      [20, 5, 17, 13, 4, 0, 6, 2, 19, 9, 12, 7, 16, 15, 1, 3, 10, 18, 8, 11, 14, 21]
      >>> index([1]*22, p)
      [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20]
      >>> index(p, [1]*22)
      [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]

------
3pt14159
Yesterday I was testing something in ruby. Basically the return value was a
constant * rand. Yeah, 0.6360787621690106 and 0.6360787023690106 were the two
results. I was like what's going on? until I noticed the middle of the answer
was different. Felt like nearly winning the lottery.

~~~
swah
I'd FUUUUUU on that.

------
rbanffy
I remember APL from my college years. APL is _the archetypal write-only
programming language_.

Even with 20-to-1 comment-to-code ratio, it was easy to get confused with code
written the previous morning. By you.

From what I see, the most important development is using plain ASCII. Too bad
it's still unpronounceable. Dictating APL code to another student was endless
fun. We even invented our own names for some of the symbols...

Having said that, APL was exquisitely powerful and concise. Yet, I have to
wonder if there is space for an exquisitely concise _write-only_ computer
language today.

------
cousin_it
Haha, I remember feeling the same way about K many years ago.

------
dcolgan
I've been taken aback by some of the concepts of Haskell recently as well.
Hooray for obscure but insanely powerful languages!

------
billrobertson42
Intentional pun in the blog? "This shit is crazy! Let me show you a log."

~~~
sbierwagen
:>

------
numeromancer
OMG! Zoinks!

