Hello

I'm a J newbie, still going through the introductory material. It's a great 
language and I'm having a lot of fun learning it! But I cannot help comparing 
it to other languages I know.

I find its features very interesting, especially its handling of rank, but at 
the same time I find its syntax very hard to read, compared to "ordinary" 
languages.

After thinking about it a bit, I'm quite sure the reason is because you cannot 
make out the structure of a J sentence unless you know exactly which tokens are 
verbs, adverbs, and conjunctions, and even then it takes some mental work to 
put it all together. Otherwise it remains a flat list of symbols. In this 
regard it's not dissimilar from Assembly, where the entire code is a flat list 
of opcodes, unless you know how to see the structure in jumps and calls, and 
then apply yourself to the task. Maybe I'm wrong, but this does not strike me 
as a good thing.

This, coupled with J's terse syntax (seriously… at least APL had some pretty 
symbols) made me wonder how much of its flexibility is dependent on its syntax; 
or conversely, how much of it could be ported to a different language with more 
static syntax rules, in the form of a library. I'm not thinking especially of 
Lisp, where you can build your own syntax, thus incurring in the same 
readability issues as J (as I see it.)

Has anybody tried to port J's features to other languages? How did it go?

Here is a tiny proof of concept, porting a couple of things (fork, adverb) over 
to CoffeeScript, in a very basic manner:


div = (x, y) -> x/y
add = (x, y) -> x+y
tally = (y) -> y.length
insert = (v) -> (y) -> y.reduce v
fork = (a, f, b) -> (y) -> f (a y), (b y)
integers = (y) -> [0..y-1]

console.log (fork (insert add), div, tally) integers 10         # prints 4.5


As I said, this is very basic. It lacks everything, including rank and arrays. 
It's just a few lines I put together to reason about syntax. Out of the few 
languages I know, I chose CoffeeScript for this exercise mainly for its 
un-parenthesized function application.

What are your thoughts?


PS. I know much of J's power comes from its engine and its optimized array 
operations. This post is strictly about syntax, or rather *opinions* about 
syntax :-)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to