[: g h
The anomaly is not [: but the train [: g h . You cannot understand sentences using it without the part of the Dictionary that treats it specially (which is not the case for, say, +/ % #). That part of the Dictionary is Section F., and it says when J sees [: g h it will interpret it to mean g@:(h). Think of that as an idiom in the language J. Dig me?
Because the special handling is of the verb train [: g h and not the primitive [: itself, it first must be possible for that train to exist. According to the lexing rules of J (Section E., one step up in the interpretation hierarchy), f g h is a verb train if and only if all 3 tokens are verbs.
Thus, the nameclass of [: needs to be verb. If it were not, the lexer could not recognize [: f g as a verb train, whence pass it to the execution engine (where the special case resides).
However, because [: needs to be a verb in f g h it must be a verb everywhere. Primitives cannot change their nameclass in J. But, since its only real use is to fill a syntactic need (some people don't like @:()), it has been given no definition. That is: no noun or nouns exist which it can take as arguments to produce a result. Put another way: its monadic domain is empty, and its dyadic domain is empty.
A good model of its verb invocation would be Cap =: E. : ~. . To wit: Cap's monadic definition is Interval's monadic definition, and its dyadic definition is Nub's dyadic definition. Members of those domains are also valid inputs to Cap (see longer example).
This explains the behavior of ([: h): the Dictionary says x (g h) y is x g (h y) for verbs g h and nouns x y . Ok, so in x ([: h) y (with nouns x y and verbs [: h), J dutifully calculates hy=. h y and then executes x [: hy, which predictably fails with a domain error (the domain of [: is empty: it has no valid inputs).
But, the point is, that's moot: once we know [: is a verb, we can proceed with [: g h. The interpretation of [: g h is, in the hierarchy of J, a step above the actual definition of [: (the specification mapping its inputs to its outputs).
Section F. could also define [: h to mean something useful (say identically h), but it doesn't. Outside of [: g h, Cap is just a sad verb with an empty domain. The Dictionary could fix that, too: it could extend Cap's domain (say, give it a definition equivalent to [), and __still__ maintain the semantics of [: f g.
So the question boils down to: why is [: g h different from f g h where f is not [:? The answer is simply: because the Dictionary says it is.
The Dictionary says what J is, and it can say whatever it likes. The Dictionary could define i.3 to be 1 2 3 and not 0 1 2, which you could never deduce without reading the definition of the semantics (of i. ). The Dictionary could define the result of +/ % # to always be 42 , which you could never deduce without reading the definition of the syntax. The Dictionary could define HELLO-THERE to be a single token, which you could never deduce without reading the definition of the rhematics.
The conclusion: You have to read the Dictionary to know what the Dictionary says. :)
\Id"i*om\ ([i^]d"[i^]*[u^]m), n. ... 3. A combination of words having a meaning peculiar to itself and not predictable as a combination of the meanings of the individual words, but sanctioned by usage; as, an idiomatic expression; less commonly, a single word used in a peculiar sense. [1913 Webster +PJC]
A. A germane comment once made (from comp.lang.apl):
The one remaining reason for assigning a meaning to (f g), is so that a sequence of functions of any length would be interpreted. But that property can be satisfied by assigning _any_ meaning to (f g). With hindsight, I now wish we'd gone ahead and moved hook to h., because if (f g) is interpreted as f@:g, then (f g) <-> ([: f g) and (f g h i) <-> ([: f g h i), etc., and that would remove the main reason for having [: .
A. A longer example of empty domains:
monadic =: : (3 : '') dyadic =: (4 : '') : plus =: + dyadic 1 plus 2 3 plus 1 2 3 |domain error: plus | plus 1 2 3 sum =: +/ monadic 1 sum 2 |domain error: sum | 1 sum 2 sum 1 2 3 6 cap =: [ dyadic monadic 1 cap 2 |domain error: cap | 1 cap 2 cap 1 2 3 |domain error: cap | cap 1 2 3 cap 4 : '' :(3 : '')