Intro 8. Atop Conjunction

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

8. Atop Conjunction
The conjunction`@` applies to two verbs to produce a verb that is equivalent to applying the first atop the second. For example:

       TriplePowersOf2=: (3&*)@(2&^)
       TriplePowersOf2 0 1 2 3 4
    3 6 12 24 48

       CubeOfDiff=: (^&3)@-
       3 4 5 6 CubeOfDiff 6 5 4 3
    _27 _1 1 27

       f=: ^@-                    The rightmost function is first applied dyadically
                                  if possible; the second is applied monadically.
       5 f 3
    7.38906

       f 3
    0.0497871

       g=: -@^
       5 g 3
    _125

       g 3
    _20.0855

A conjunction, like an adverb, is executed before verbs; the left argument of either is the entire verb phrase that precedes it. Consequently, some (but not all) of the parentheses in the foregoing definitions can be omitted. For example:

       COD=: ^&3@-
       3 4 5 6 COD 6 5 4 3
    _27 _1 1 27

       TPO2=: 3&*@(2&^)

       TPO2 0 1 2 3 4
    3 6 12 24 48

       tpo2=: 3&*@2&^             An error because the conjunction @ is defined
    |domain error                 only for a verb right argument
    |   tpo2=:    3&*@2&^

Exercises

8.1 | Cover the comments on the right, and state the effects of the programs. Then cover the programs and rewrite them from the English statements:
    mc=: (+/%#)@|:                Means of columns of table
    f=: +/@(^&2)                  Sum of squares of list
    g=: %:@f                      Geometric length of list
    h=:{&' *'@(</)                Map of comparison (dyad)
    k=: i. h i.                   Map (monad)
    map=: {&'+-* %#$'             7-character map
    MAP=: map@(6&<.)              Extended domain of map
    add=: MAP@ (i.+/i.)           Addition table map

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