|
|
|
|
|
by yummyfajitas
3655 days ago
|
|
Having played a bit with J, and also used Haskell extensively, I'd say they aren't that close. Probably the closest contemporary language to J is Python+Numpy+Pandas. I've gone about 1/3 of the way through Notation as a Tool of Thought (http://www.jsoftware.com/papers/tot.htm ) and translated most of it to idiomatic numpy. E.g. their first example is: +/l5
(read this as generate an array 1,2,3,4,5, then apply + as a reducer to it.)In numpy this is: add.reduce(arange(1,6))
It may just be familiarity, but I do find the Python to be far more readable. (Hardly surprising since brevity is the core value of k/j/Q, but readability is the core value of python.) |
|
In APL, you can change indexing from 0-based to 1-based. In J it is 0-based, so the need to increment the sequence with the increment verb '>:' as follows:
1 3 6 10 15You could also rename or group and rename functions for readability if working with others not familiar with J:
1 2 3 4 5 1 3 6 10 15 15I am playing with Idris, and do not know Haskell much, but I still find it more like mathematics when composing functions in J as opposed to Idris/Haskell. I see Idris/Haskell as more easy to express the proofs in a style to a proofs textbook, but I see J as more representative of the actual mathematical formulas. They are short, and can be easily manipulated without so much typing.
People sometimes criticize J/K/Q/APL the way they do when they write about Forth or Lisp, but it doesn't take away from them. The Rosetta lander had a lot of mission-critical code in Forth, but there are not many who like the syntax or way of composing programs.
J's learning materials have greatly improved from when I first looked at it [2].
kdb+/q beats the pants off of Spark, and Jd is the J programming language's answer to kdb+/q.
Array processing with a language that has arrays as its fundamental unit makes sense, and that is where it is all headed. Whether it is one of the existing array languages or a hybrid is the question. All those high salaries programming in Q is not a myth, and companies don't pay for no return on salary.
FYI - The creator of Pandas, Wes Mckinney, was studying or looking over J for his next venture. The link seems to have disappeared, so perhaps it is not in development, or it is being developed in secret!;)
[1] http://inform7.com/
[2] http://code.jsoftware.com/wiki/Guides/GettingStartedSerious