Chapter 15: Tacit From Explicit

In this chapter we look at how a tacit function can be generated from an explicit function.

This chapter was written using J version 4.03a.

15.1 Generated Tacit Verbs

Suppose that e is a verb, defined explicitly as follows:

   e =: 3 : '(+/ y.) % # y.'

The right argument of the colon conjunction we can call the "body". Then a tacit verb, t say, equivalent to e, can be produced by writing 13 : instead of 3 : with the same body.

   t =: 13 : '(+/ y.) % # y.'

e t e 1 2 3 t 1 2 3
3 : '(+/ y.) % # y.'
+/ % #
2
2

Here now is an example of an explicit dyad.

   ed =:  4 : 'y. % x.'

The equivalent tacit dyad can be generated by writing 13 : rather than 4 : with the same body.

   td =: 13 : 'y. % x.'

ed td 2 ed 6 2 td 6
4 : 'y. % x.'
] % [
3
3

We can conclude that if we write 13 : body, and body contains y. (but not x.) then the result is a tacit verb of which the monadic case is equivalent to 3 : body. On the other hand, if body contains both x. and y. then the result is a tacit verb of which the dyadic case is equivalent to 4 : body.

For the purpose of generating tacit functions, the body is restricted to being a single string or one line.

Recall that with 3 : body, the body is not evaluated when the definition is entered. However, with 13 : body, then in effect the body is evaluated. For example:

k =: 99 p =: 3 : 'y.+k' q =: 13 : 'y.+k' p 6 q 6
99
3 : 'y.+k'
] + 99"_
105
105

We see that p is defined in terms of k while q is not. While p and q are at present equivalent, any subsequent change in the value of k will render them no longer equivalent.

k =: 0 p 6 q 6
0
6
105

A name with no assigned value is assumed to denote a verb. In the following example, note that f is unassigned, C is a predefined conjunction and g is a predefined verb.

   C =: @:
   g =: %:

foo =: 13 : '(f C f y.) , g y.' f =: *: foo 4
f@:f , [: g ]
*:
256 2

15.2 Generated Tacit Operators

Recall from Chapter 12 that an adverb may be defined explicitly with an expression of the form 1 : body. Here is an example, an adverb R which applies its argument-verb separately to each row of a table.

R =: 1 : 'x. " 1' < R
1 : 'x. " 1'
<"1

A tacit adverb, T say, equivalent to R can be generated by writing 11 : rather than 1 : with the same body.

T =: 11 : 'x. " 1' < T
"1
<"1

Recall from Chapter 14 the problem of writing a conjunction to generate a hook in the form ((x C y) V). Here C and V are to be fixed in advance, and x and y are to be verbs given as arguments to the conjunction.

An explicit version of such a conjunction, EC say, could be:

EC =: 2 : 'x. @: y. +' f EC g
2 : 'x. @: y.  +'
f@:g +

An equivalent tacit version could be produced by writing 12 : instead of 2 :, thus:

TC =: 12 : 'x. @: y. +' f TC g
@: (`+) (`:6)
f@:g +

The tacit conjunction TC is of the form: conjunction, adverb, adverb, that is, a trident of the pattern CAA. What 12 : has done for us is to generate an instance of trident CAA..

This brings us to the end of Chapter 15.


NEXT
Table of Contents


Copyright © Roger Stokes 2000. This material may be freely reproduced, provided that this copyright notice and provision is also reproduced.

last updated 26Feb00