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=: +/ % # |