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

# Hook

A train is a sequence of two or three words in a row that is given a special meaning. A train of two verbs is a hook and is evaluated as follows:

      (f g) y	evaluates as	y f g y
    x (f g) y	evaluates as	x f g y

Suppose you wanted to scale a list of numbers such that the result was each number divided by the maximum number in the list. The maximum over a list is given by the verb derived by applying the adverb `/` to the verb `>.` .

       a =. 3 5 8 2 7
       maxover =. >./
       maxover a
    8

To divide an argument by the maximum over the argument you can use:

       a % maxover a
    0.375 0.625 1 0.25 0.875

The above can be written as a hook.

       (% maxover) a
    0.375 0.625 1 0.25 0.875

You can now define scale as a hook with `% >./` .

       scale =. % >./
       scale a
    0.375 0.625 1 0.25 0.875

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