The J programming language is like Forth. Both are old-school and obscure. Both have quirky syntax thanks to a dead simple parser and unorthodox choices. Both encourage point-free style. Both insist on terminology that evokes comparisons with natural languages, e.g. Forth calls functions words, while J calls them verbs.

However, several features make a J interpreter more challenging to write than a Forth interpreter.

Here’s an inexact decoding of J’s cute terminology (J monads are no relation of Haskell monads):

Monad = Noun -> Noun Dyad = Noun -> Noun -> Noun Verb = (Monad, Dyad) Adverb = Verb -> Verb Conjunction = Verb -> Verb -> Verb

For now, we’ll say a Noun is a multidimensional array of numbers. The arrays usually have 0, 1, or 2 dimensions (and are called atoms, lists, and tables).

J monads and dyads are just unary and binary operators, but they are always packaged together: every symbol representing a verb is overloaded. Depending on context, a verb is interpreted as a unary or a binary operator, which may be completely unrelated.

For example:

* 42 NB. Unary * is signum. 1 42 * 42 NB. Binary * is multiplication. 1764

Adverbs and conjunctions are higher-order unary and binary operators. They operate on verbs, though some accept nouns (not shown above), and output verbs, though some produce nouns (also not shown). Adverbs are written postfix, and conjunctions are written infix.

Thankfully the designers refrained from naming them, say, monadic and dyadic adverbs [monadverbs and dyadverbs?], and decided against overloading for adverbs and conjunctions. Since verbs possess 2 meanings, a single symbol for adverb/conjunction would have at least 4 meanings! Was this how it was with APL?

Haskell has only one J-style verb, that is, only one overloaded operator: the unary minus. Code is easier to read for a reasonable price.

J pays a higher price, as every operator is overloaded. Moreover, not only does J possess the unary minus verb, but J also employs the underscore as the unary minus in numeric literals: