mean=: +/ % # mean 2 3 4 5 6 4 (geomean=: # %: */) 2 3 4 5 6 3.72792Since the program mean is a new verb, we also refer to a sentence such as mean=: +/ % # as verb definition (or definition), and to the resulting verb as a defined verb or function.
MEAN=: sum % # sum=: +/ MEAN 2 3 4 5 6 4Entry of a verb alone (without an argument) displays its definition, and the foreign conjunction (!:) can be used to specify the form of the display: boxed, tree, linear, or parens. (The session can also be configured to specify the form of verb display, under the menu item Edit|Configure...|View.) Thus:
mean +/ % # 9!:3 (2 4 5) mean +-----+-+-+ |+-+-+|%|#| ||+|/|| | | |+-+-+| | | +-----+-+-+ +- / --- + --+- % +- # +/ % #
|6.1||Enter AT=: i. +/ i. and use expressions such
as AT 5 to determine the behaviour of the program AT .|
|6.2||Define and use similar function tables for other dyadic functions.|
|6.3||Define the programs:
tab=: +/ ft=: i. tab i. test1=: ft = ATThen apply test1 to various integer arguments to test the proposition that ft is equivalent to AT of Exercise 6.1, and enter ft and AT alone to display their definitions.
|6.4||Define aft=: ft f. and use test2=: aft = ft to test
their equivalence. Then display their definitions and state the effect
of the adverb f. .|
Answer: The adverb f. fixes the verb to which it applies, replacing each name used by its definition.
|6.5||Redefine tab of Exercise 6.3 by
entering tab=: */ and observe the effects on ft
and its fixed alternative aft .|
|6.6||Define mean=: +/ % # and state its behaviour when applied
to a table, as in mean t=: (i. !/ i.) 5 .|
Answer: The result is the average of, not over, the rows of a table argument.
|6.7||Write an expression for the mean of the columns
of t .|
Answer: mean |: t or mean"1 t