Sample 8. Classification

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

8. Classification
Classification is a familiar notion. For example, the classification of letters of the alphabet as vowel, consonant, sibilant, or plosive; of colors as primary and secondary; and of numbers as odd, even, prime, and complex.
It is also very important; it provides the basis for many significant notions, such as graphs, barcharts, and sets.
A classification may be complete, (each object falling into at least one class), and it may be disjoint (each object falling into at most one class). A graph is a disjoint classification corresponding to the non-disjoint classification used to produce a barchart.

       x=: 1 2 3 4 5 6 7
       ]y=: (x-3) * (x-5)                      NB. Parabola (roots at 3 and 5)
    8 3 0 _1 0 3 8

       range=: >./ - i.@spread
       spread=: 1: + >./ - <./
       spread y
    10

       range y
    8 7 6 5 4 3 2 1 0 _1

       ((range <:/ ]);{&' *'@(range<:/])) y    NB. Barcharts of y
    +-------------+-------+
    |1 0 0 0 0 0 1|*     *|
    |1 0 0 0 0 0 1|*     *|
    |1 0 0 0 0 0 1|*     *|
    |1 0 0 0 0 0 1|*     *|
    |1 0 0 0 0 0 1|*     *|
    |1 1 0 0 0 1 1|**   **|
    |1 1 0 0 0 1 1|**   **|
    |1 1 0 0 0 1 1|**   **|
    |1 1 1 0 1 1 1|*** ***|
    |1 1 1 1 1 1 1|*******|
    +-------------+-------+

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