Well, that was a waste of time. I spent a good five minutes searching the J wiki and couldn't find a simple overview of what J is or why I should care. I discovered that J is a general-purpose programming language, but it's different. No real explanation of how it's different, or why that difference is good. Oh, and I was cautioned that I could spend years working with J and still consider myself a beginner. Very reassuring.
I seriously got the impression that J is some kind of private club, so unless you're introduced by a member, they don't want you. Too bad, I'm always interested in learning new languages, but I think I'll give J a bye.
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.
Oh shit, I just read the second thing and understood it. Maybe I'm not that hopeless (tried to learn J for 1-2 years in the background, abandoned after being unable to code something like graph shortest path in it for projecteuler.net)
kinda random.. but this drawing was made after I figured out a J one-liner that solved project euler #108... the code is there sorta hidden at the bottom. its the same as what is more visible at the top, but you can only see the bottom half of the characters...
this comment is probably as weird/confusing as the one-liner itself..
All those links assume that you already know what J is and what it's good for. I was looking for a simple one-paragraph description that could explain where J fit in the "big picture". Is it a scripting language, like Lua or JavaScript? Is it a new JVM-based language like Scala or Groovy? Is it a logic language like Prolog? Highly-concurrent like Erlang? Continuation-based like ML? A functional language like Haskell or Scheme? Is it object-oriented or imperative? Compiled or interpreted? I didn't see the answers to any of these fundamental questions after a casual glance at the wiki, and frankly that's the kind of information (IMHO) that I shouldn't have to trawl through dozens of pages to find out.
J is a modern dialect of APL. It doesn't run on the JVM. Its paradigm is primarily purely functional, but rather than focusing on trees like Haskell and Lisps, it focuses on multidimensional arrays full of numbers. Trees arise naturally in basically linguistic contexts like writing compilers. Multidimensional arrays arise naturally in images, sounds, and scientific data. It's not object-oriented or imperative. It's interpreted, but because the atomic values of the language are arrays, your inner loops are often inside of some primitive, not in your interpreted code, so J programs often run very fast despite being interpreted.
Similar languages include Octave/MATLAB, R/S-PLUS/S, A+, K, PV-WAVE IDL, and Lush. Similar libraries include PDL for Perl and Numeric, Numarray, and NumPy for Python.
It helps me, today, but what about the next person who wants to know about J? My point was, there should be some kind of quick explanation of what J is all about on the wiki or web site. Look at the Python site for an example.
Well, that was a waste of time. I spent a good five minutes searching the J wiki and couldn't find a simple overview of what J is or why I should care. I discovered that J is a general-purpose programming language, but it's different. No real explanation of how it's different, or why that difference is good. Oh, and I was cautioned that I could spend years working with J and still consider myself a beginner. Very reassuring.
I seriously got the impression that J is some kind of private club, so unless you're introduced by a member, they don't want you. Too bad, I'm always interested in learning new languages, but I think I'll give J a bye.
oddthink [OP] 11 points · Mar 2011
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] 4 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.
pja 5 points · Mar 2011
It's an APL derivative. Used a lot in finance for analysis of large quantities of data IIRC.
Like APL, it's very, very terse. A single line of code can do a huge amount of data processing.
eschulte 5 points · Mar 2011
e.g., Conways game of life as an APL one-liner http://catpad.net/michael/apl/ http://www.youtube.com/watch?v=a9xAKttWgP4
muyuu 4 points · Mar 2011
Wikipedia link
http://www.jsoftware.com/help/primer/contents.htm
From the examples in Wikipedia:
* Quicksort simple version
* Quicksort using tacit programming
bboomslang 2 points · Mar 2011
=:O
[deleted] 1 points · Mar 2011
Oh shit, I just read the second thing and understood it. Maybe I'm not that hopeless (tried to learn J for 1-2 years in the background, abandoned after being unable to code something like graph shortest path in it for projecteuler.net)
basscadet 1 points · Mar 2011
kinda random.. but this drawing was made after I figured out a J one-liner that solved project euler #108... the code is there sorta hidden at the bottom. its the same as what is more visible at the top, but you can only see the bottom half of the characters...
this comment is probably as weird/confusing as the one-liner itself..
DailyFail 1 points · Mar 2011
Someone forgot to terminate the string with zero.
chneukirchen 3 points · Mar 2011
I dunno, is it that hard? I think J has excellent documentation:
j-random 6 points · Mar 2011
All those links assume that you already know what J is and what it's good for. I was looking for a simple one-paragraph description that could explain where J fit in the "big picture". Is it a scripting language, like Lua or JavaScript? Is it a new JVM-based language like Scala or Groovy? Is it a logic language like Prolog? Highly-concurrent like Erlang? Continuation-based like ML? A functional language like Haskell or Scheme? Is it object-oriented or imperative? Compiled or interpreted? I didn't see the answers to any of these fundamental questions after a casual glance at the wiki, and frankly that's the kind of information (IMHO) that I shouldn't have to trawl through dozens of pages to find out.
kragensitaker 6 points · Mar 2011
That's a very good set of questions to ask.
J is a modern dialect of APL. It doesn't run on the JVM. Its paradigm is primarily purely functional, but rather than focusing on trees like Haskell and Lisps, it focuses on multidimensional arrays full of numbers. Trees arise naturally in basically linguistic contexts like writing compilers. Multidimensional arrays arise naturally in images, sounds, and scientific data. It's not object-oriented or imperative. It's interpreted, but because the atomic values of the language are arrays, your inner loops are often inside of some primitive, not in your interpreted code, so J programs often run very fast despite being interpreted.
Similar languages include Octave/MATLAB, R/S-PLUS/S, A+, K, PV-WAVE IDL, and Lush. Similar libraries include PDL for Perl and Numeric, Numarray, and NumPy for Python.
Does that help?
j-random 2 points · Mar 2011
It helps me, today, but what about the next person who wants to know about J? My point was, there should be some kind of quick explanation of what J is all about on the wiki or web site. Look at the Python site for an example.
kragensitaker 1 points · Mar 2011
Well, Reddit threads are somewhat googlable. But yeah, maybe you should see if you can improve the introduction to http://en.wikipedia.org/wiki/J_(programming_language) or something.
Barney21 1 points · Mar 2011
The idea is the language operates on matrices instead of using program control. So everything is expressions.