|
|
|
|
|
by mcguire
2210 days ago
|
|
Yes, at least for me, trying to learn it. For example, / in many examples is an "adverb", modifying the previous operator, although xx/ is frequently introduced as a single thing. (Are all built-in verbs one or two characters?) |
|
Re: one-or-two characters, there are a few exceptions, like the folds ( F.. F.: etc.) which are new to J9. Also some older ones like {:: (Map) and &.: (Under) where `x u&.:v y` means `v^:_1 (v x) u v y`. Some of these aren't verbs but conjunctions, adverbs, etc. For the most part they stick to one or two. There are parsing rules that dictate what the second and third characters can be (that's why you see so many colons and periods), and these rules are actually discussed in the JforC book.
Reading J can be tough, as a fellow learner I feel your pain. :) The one that usually gets me (in my own code, even!) is
...which runs the verb over 5-element slices of 'n' at a time, and joins up the results. The '5' is too far away from the '\', and it can be hard to see the connection right away. I understand why it's so (it's really running the modified verb 'myverb\' with arguments 5 and n) but I still find it hard to read.When writing my own code, I often leave extra spaces between the multi-character words, and anywhere else that helps legibility. J might be a terse language, but there's no point being crazy about it (unless you're golfing).