Hacker News new | past | comments | ask | show | jobs | submit login

'xx/' is a single thing -- in the sense that 'xx' is a thing, and '/' is a thing that modifies other things. By applying '/' to 'xx', you get a new, standalone thing.

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

    5 myverb \ n
...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).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: