Here is strength of materials data taken from a textbook.

    data =:       33190 32320 23040 24050
    data =: data, 31860 33020 30930 30170
    data =: data, 32590 32030 32720 31300
    data =: data, 26520 30460 33650 28730
    data =: data, 33280 32700 32340 31920

And here is a "stemplot" of the data

    2 stemplot data
 23 0
 24 0
 25
 26 5
 27
 28 7
 29
 30 1 4 9
 31 3 8 9
 32 0 3 3 5 7 7
 33 0 1 2 6

This is a "histogram" in which the first two data digits are labels and third digits form the bars of the histogram. The last line, beginning 33, means there are data values beginning with 330 , 331, 332, and 336. The plot was originally called "stem and leaf" -- "stem" is the two-digit column and "leaves" are the individual third digits.

Your mission, should you decide to accept it, is to write verb stemplot. Above, 2 stemplot data means trim two digits from the data (that's what the 2 is for), then produce the character array shown. Assume non-negative integer data. What does your verb do with

    _1 stemplot 2 1 4 2 6

?

--Kip Murray
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to