Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I keep wondering if it's worth learning J, if only to understand this thing:

    quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)
Anyone who does any significant amount of work in J care to comment? It seems like a super-niche language, which would take more time to come up with and mentally-parse existing code than the same operations in other languages. Of course, once you're fluent, you're fluent, but it looks like Vim to the Vim'th power...


We have a guy at work who uses J for everything, since he came of age doing data analysis in APL, when APL was the only interpreted and powerful matrix language out there. (Fortran was compiled and low level.) He loves it, but he doesn't know any other languages.

Personally, I found J a very interesting interesting exercise, and APL is historically SUPER important, but for practical uses they have been way superseded by matlab/ Octave/ R and the T/P/R* scripting languages. (At times my friend will say something like "in J you can compute the sum of a matrix IN JUST ONE LINE... and I will point to "sum(A)" in matlab, as opposed "$&$%^%$%M" in J, or whatever it is.)

K may be more brain friendly than J. But as far as I am concerned, J makes assembler and badly written Perl look easy to read.


Sum in J is +/ not, $&$%^%$%M. Is +/ really too hard to comprehend? I agree with you that APL is historically important, but J is Ken Iverson's last and greatest gift to the programming community. He used the 26 years between the release of APL and J to address many of the shortcomings of APL. Take a look at http://bit.ly/hMmGWV for some background.


It's not semantically different from sort [] = []; sort (x:xs) = sort (filter (< x) xs) ++ filter (== x) xs ++ sort (filter (> x) xs) in Haskell (modulo laziness). The parallel structure in the J code should be plainly evident even if you don't know anything about J.


It's a lot like math notations. To draw an analogy, it's hard to go back from "a*b" (i.e. k/j/apl) to "a multiplied by b" (i.e. lisp) to "start with zero, add a, add a again, ....., repeat b times (i.e. java/cobol) once you've gotten used to a concise notation. And even if you _do_ go back to verbose, you are overall much better for knowing what's a concise way to putting everything, and converging towards that with your limited tools.


It's more general than you'd think -- though it is a drastically different way of looking at problems. You have to set your sights a bit further up the scope of the problem, and that takes a lot of getting used to. Thinking in terms of the whole instead of the step is a lot different from most other programming!

(I'm only a novice J programmer, but I quite like the language.)


I know enough J to wish other languages had some of its features. Like macros in Lisp, working in J expands your mind.


As someone who is not exactly in the know about this subject: is there a cleaner way to write this stuff, or is that the usual way to do it? (I can write nasty Perl, but choose to write pretty Perl, because I like my job. What would an APL user do?)


By cleaner, do you mean more verbose? For example, the well known phrase for average in J is (average=: +/ % #). You would have no problem assigning names to the parts of the function, i.e. (sum=: +/), (divide=: %), (tally=: #) and defining the function as (average=: sum divide tally). It is tempting to learn J this way, but once you are familiar with the primitives, it makes more sense to just use them. You can pack a lot of thought into very few character, which is one of J's strengths.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: