It's always hard to figure out how much context to provide.
J is a descendant of APL, the language notorious for inscrutable one-liners and funny symbols. The wikipedia article gives a good overview.
It's very good at math, perhaps not the best at other things. You can find a lot of examples on rosetta code. I find it makes a good calculator to have open when working, since you can get a lot done quickly, once you get the hang of it.
Wow, what a shame, I really liked APL. I even went so far as to port an APL interpreter from PL/I to C (yeah, I'm old). I also bought a Commodore SuperPET (yeah, I'm real old) just because it had the Waterloo APL interpreter and supported the full APL symbol set. Very cool language, even if I never did use it for anything "real". I guess J is different enough from APL that they don't mention it?
Well, you might like J, then. It was designed by Ken Iverson and Roger Hui, building on the experience of APL.
The web site's a bit confusing at times, but it's the product of a small group of mathy programmers, not a web design team. The people involved have been involved for a long time, which makes it hard to see what it looks like from an outsider's point of view.
If you start from the front page of the wiki, there is a "APL and J" article under Articles and some APL examples under Essays, which may help.
I've not used J for anything real, myself, but I've found it fun to learn. Or, rather, to start learning.
Well, I don't know K proper, and I've been unable to find a good definition of its details. I know "q", which is built on top of it. Similarly, I don't know A+ well enough to compare it; I've debugged some code that was exchanging data via A+ objects, but I never developed in it. It was a bit before my time.
So, I can compare q to J. J is much cleaner. q has all kinds of werid syntactic and semantic corners; it's been a while since I used it, but I remember there being a difference in the way missing data was handled in sums between float vectors and int vectors, for one. For another, it was always dangerous to pass around lists of dictionaries because they would be occasionally interpreted as tables. Similarly, the auto-conversion of lists to, e.g., float arrays would sometimes happen at odd times.
I've not found any of those issues in J. It's explicit about when values are boxed and when they're not, which leads to fewer surprises.
On the other hand, q has easy-to-use dicts, nice tables, and a very convenient table-manipulation sub-language. It seems much easier for me to do R-like data manipulations in q, because it has dicts and tables, as well as easy built-in parsing of delimited text files.
q also has easy definition of anonymous functions, such as {x+2*y}, easy creation of functions with more than two arguments, and partial application. In turn, J has its whole point-free ("tacit") support, which is very elegant for simple operations, but which I still find very confusing for long trains of verbs. Also, J lets you use your own functions as binary operators.
q has "normal" indexing of matrices, such as m[;1] to get the second column; J uses a less-convenient, but perhaps more generally powerful, notation for this, '(<a:;1){m', although in this simple case I could use '1{"1 m'.
J's idea of verb rank is quite elegant, but I can get most of the effects of it by using each/each-left/each-right in q.
In short, q seems more useful for my kinds of work (data-munging, statistics, etc), while J seems more elegant, and probably more useful for more pure-math explorations. Now, I don't know J that well; it may be that I've just not figured out the right tricks yet.
It's always hard to figure out how much context to provide.
J is a descendant of APL, the language notorious for inscrutable one-liners and funny symbols. The wikipedia article gives a good overview.
It's very good at math, perhaps not the best at other things. You can find a lot of examples on rosetta code. I find it makes a good calculator to have open when working, since you can get a lot done quickly, once you get the hang of it.
j-random 1 points · Mar 2011
Wow, what a shame, I really liked APL. I even went so far as to port an APL interpreter from PL/I to C (yeah, I'm old). I also bought a Commodore SuperPET (yeah, I'm real old) just because it had the Waterloo APL interpreter and supported the full APL symbol set. Very cool language, even if I never did use it for anything "real". I guess J is different enough from APL that they don't mention it?
oddthink [OP] 5 points · Mar 2011
Well, you might like J, then. It was designed by Ken Iverson and Roger Hui, building on the experience of APL.
The web site's a bit confusing at times, but it's the product of a small group of mathy programmers, not a web design team. The people involved have been involved for a long time, which makes it hard to see what it looks like from an outsider's point of view.
If you start from the front page of the wiki, there is a "APL and J" article under Articles and some APL examples under Essays, which may help.
I've not used J for anything real, myself, but I've found it fun to learn. Or, rather, to start learning.
kragensitaker 1 points · Mar 2011
How does it compare to K and A+ from your point of view?
oddthink [OP] 5 points · Mar 2011
Well, I don't know K proper, and I've been unable to find a good definition of its details. I know "q", which is built on top of it. Similarly, I don't know A+ well enough to compare it; I've debugged some code that was exchanging data via A+ objects, but I never developed in it. It was a bit before my time.
So, I can compare q to J. J is much cleaner. q has all kinds of werid syntactic and semantic corners; it's been a while since I used it, but I remember there being a difference in the way missing data was handled in sums between float vectors and int vectors, for one. For another, it was always dangerous to pass around lists of dictionaries because they would be occasionally interpreted as tables. Similarly, the auto-conversion of lists to, e.g., float arrays would sometimes happen at odd times.
I've not found any of those issues in J. It's explicit about when values are boxed and when they're not, which leads to fewer surprises.
On the other hand, q has easy-to-use dicts, nice tables, and a very convenient table-manipulation sub-language. It seems much easier for me to do R-like data manipulations in q, because it has dicts and tables, as well as easy built-in parsing of delimited text files.
q also has easy definition of anonymous functions, such as {x+2*y}, easy creation of functions with more than two arguments, and partial application. In turn, J has its whole point-free ("tacit") support, which is very elegant for simple operations, but which I still find very confusing for long trains of verbs. Also, J lets you use your own functions as binary operators.
q has "normal" indexing of matrices, such as m[;1] to get the second column; J uses a less-convenient, but perhaps more generally powerful, notation for this, '(<a:;1){m', although in this simple case I could use '1{"1 m'.
J's idea of verb rank is quite elegant, but I can get most of the effects of it by using each/each-left/each-right in q.
In short, q seems more useful for my kinds of work (data-munging, statistics, etc), while J seems more elegant, and probably more useful for more pure-math explorations. Now, I don't know J that well; it may be that I've just not figured out the right tricks yet.