Stem-and-leaf plot: Difference between revisions

Line 2,176:
multiplier: int
plot: TableRef[int, seq[int]]
 
proc `$`(s: seq[int]): string =
result = ""
for item in s:
result &= $item & " "
 
proc `$`(self: StemLeafPlot): string =
Line 2,220 ⟶ 2,225:
echo $taskPlot
 
echo "Test with Reals and Negative Zero Stem"
var negativePlot = StemLeafPlot()
negativePlot.init(1, negativeData)
Line 2,227 ⟶ 2,232:
{{out}}
<pre>Using the Task's Test Data
0 | @[7, 7]
1 | @[2, 3, 8, 8]
2 | @[3, 5, 7, 7, 7, 7, 7, 7, 8, 8, 9, 9]
3 | @[0, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 7, 7, 8, 9]
4 | @[0, 0, 1, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 6, 7, 8, 8]
5 | @[2, 3, 7, 8, 8]
6 | @[1, 3, 8]
7 | @[1]
8 |
9 | @[6, 9]
10 | @[4, 5, 5, 5, 5, 6, 7, 9, 9, 9]
11 | @[1, 3, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9]
12 | @[0, 0, 1, 1, 2, 2, 3, 4, 4, 4, 5, 5, 5, 6, 7, 7, 7, 7, 8, 8]
13 | @[1, 2, 3, 9]
14 | @[1, 6]
 
Test with Reals and Negative Zero Stem
-2 | @[4]
-1 | @[2]
0 | @[3, 4, 6, 6]
1 | @[7]
2 | @[5]
3 |
4 |
5 | @[7]</pre>
 
=={{header|OCaml}}==
Anonymous user