>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary

19. Tacit Equivalents

Verbs may be defined either explicitly or tacitly. In the case of a one-sentence explicit definition, of either a monadic or dyadic case, the corresponding tacit definition may be obtained by using the adverb 13 : as illustrated below. First enter 9!:3 ] 2 5 so as to obtain both the boxed and linear displays of verbs:
   s=: 0 : 0
(+/y.) % (#y.)
)

   mean=: 3 : s
   MEAN=: 13 : s

   mean                           MEAN
+-+-+--------------+           +-----+-+-+
|3|:|(+/y.) % (#y.)|           |+-+-+|%|#|
+-+-+--------------+           ||+|/|| | |
3 : '(+/y.) % (#y.)'           |+-+-+| | |
                               +-----+-+-+
                               +/ % #
The explicit form of definition is likely to be more familiar to computer programmers than the tacit form. Translations provided by the adverb 13 : may therefore be helpful in learning tacit programming. An explicit definition of a conjunction may be translated similarly by the adverb 12 : . For example:
   t=: 0 : 0
y.^:_1 @ x.&y.
)

   under=: 2 : t
   times=: + under ^.
   3 times 4
12

   3 + (u=: 12 : t) ^. 4
12

   u
+-----------------+-+--+
|+----------+-+--+|&|].|
||+--+--+--+|@|[.|| |  |
|||].|^:|_1|| |  || |  |
||+--+--+--+| |  || |  |
|+----------+-+--+| |  |
+-----------------+-+--+
((]. ^: _1) @ [.) & ].

Exercises

19.1   Use the display of the tacit definition of MEAN to define an equivalent function called M .

Answer: M=: +/ % #




>>  <<  Ndx  Usr  Pri  Phr  Dic  Rel  Voc  !:  wd  Help  Dictionary