Dfns & Dops

A dfn (dop)1 is an alternative function definition style suitable for defining small to medium sized functions. It bridges the gap between operator expressions: rank←⍴∘⍴ and full "header style" definitions such as:

    ∇ rslt←larg func rarg;local...

In its simplest form, a dfn is an APL expression enclosed in curly braces {}, possibly including the special characters and to represent the left and right arguments of the function respectively. For example:

      {(+/⍵)÷⍴⍵} 1 2 3 4    ⍝ Arithmetic Mean (Average)
      3 {⍵*÷⍺} 64           ⍝ ⍺th root

dfns can be named in the normal fashion:

      mean¨(2 3)(4 5)
 2.5  4.5

dfns can be defined and used in any context where an APL function may be found, in particular: