[Jprogramming] tacit definition (was: Using # item by item ...)
Dan Bron
j at bron.us
Sat Aug 8 08:49:17 HKT 2009
I wrote:
> Tacit code is expressed in terms of function composition, and
> doesn't mention its arguments. Explicit code is expressed in
> terms of operations on values (arguments, nouns, variables,
> whatever) and definitionally mentions its arguments.
I'm trying to find a way to define tacit programming a way that matches our (my) intuition. Bear with me for a while.
Because the majority of J programming consists of defining verbs, one (imperfect) way to make the distinction might be: an
explicit clause is one which produces a noun. A tacit clause is one which doesn't. A clause is a valid grammar production (and,
by implication, tacit clauses may be embedded within arguments to : ).
The distinction still isn't perfect because e.g. +`- is a valid grammar production which produces a noun, and yet is tacit, and
a. + a: is a valid grammer production which doesn't [produce a noun], and yet isn't [tacit].
But the scheme does help us classify e.g. (+/%#) y . Within that sentence, the clause (grammar production) +/%# is tacit --
it produces a verb. Yet the sentence produces a noun, and so as a whole is explicit. Which matches our intuition: it mentions a
variable. Similarly, within (+/%#) the clause +/ produces a verb, and so is tacit, which is true. And, by that logic, since
+ produces a verb, it too must be tacit [1]. And I doubt anyone would disagree that plus=:+ is a (trivially) tacit verb.
However, the waters get murkier after this. For example, how shall we classify 3 : '(+/y) % #y' ? The sentence produces a
verb, and so, as a whole, must be tacit. Recall that anonymous explicit verbs can be embedded in tacit verbs, e.g. (- 3 : '(+/y)
% #y') . Yet we balk: isn't mean =: 3 : '(+/y) % #y' an explicit verb?
Perhaps we can evade this problem by saying that "is an explicit verb" is a shorthand, and what we really mean is the clause
(+/y)%#y produces a noun, and so is explicit, and this explicit clause has "tainted" its container.
But we cannot escape for long. Consider +1 :'u/ % #' . Here, no nouns are produced, or even mentioned. I suppose one could
reasonably call it tacit, with a twinge of conscience. That twinge is: we've mentioned an argument (u). The truly tacit way to
express this would be + (/ (`%) (`#) (`:6)) .
But, as I said, since the majority of J programming consists of defining verbs, we rarely encounter such cases. So, in broad
strokes, we can divide explicit from tacit in terms or parse table productions: 0 1 2 are explicit, 3 4 are tacit, and 5 6 7 8
are explicit when they produce nouns, and tacit otherwise [2].
-Dan
[1] Which quickly has us conclude that any subclause of a tacit clause is tacit, and all tacit clauses is composed entirely of
tacit subclauses. Which also matches our intuition.
[2] Can someone show me where the Dictionary promises the grammar productions verb noun and noun verb noun are guarunteed to
produce nouns? I must be tired, but I can't see it.
More information about the Programming
mailing list