A Little Hook for Understanding
Vector 14:2, page 15
Transcribed from the printed issue; not yet reviewed. Read it in the PDF of the issue, page 15
We all know how appropriate names or phrases can help us to grasp elements of APL. When starting out, the meaning of f/ can be learned and remembered more easily by focusing on ‘insert’ or ‘reduce’, each of which conveys much about that basic construct.
In J, @ is described in ISI literature as ‘atop’, but I find it easier to think of it as either ‘applied to’ or ‘after’, which I think I learned from the writings of Eugene McDonnell and Ken Smillie, respectively.
A common remark in learning J is that forks require a big mental effort and hooks a bigger one — after which you see them everywhere. In grappling with monadic hooks I find help from tiny phrases: mentally insert ‘their own’ or ‘its own’ between the verbs of the hook.
The monadic hook (f g) acting on y is equivalent to (y f g y).
pr =. % +/gives proportions.
pr 1 2 3 4gives 0.1 0.2 0.3 0.4
Think of this as ‘divide by their own sum’, or if you are truly thinking arrays and seeing the vector 1 2 3 4 as a whole, ‘divide by its own sum’.
- +/ % # is a hook, consisting of minus - and the average or mean +/ % #, which seems to be everybody’s first example of a fork.
Think of this as ‘minus its own mean’. That is then a short step from the statistician’s jargon ‘deviation from the mean’.