Stem-and-leaf plot: Difference between revisions
m
syntax highlighting fixup automation
(Added solution for Action!) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 16:
{{trans|Kotlin}}
<
x.sort()
V i = x[0] I/ 10 - 1
Line 39:
]
leaf_plot(&data)</
{{out}}
Line 61:
=={{header|ACL2}}==
<
(cond ((endp xs) (list x))
((> x (first xs))
Line 101:
(reverse (stem-and-leaf-bins (reverse (isort xs))
0
nil))))</
=={{header|Action!}}==
{{libheader|Action! Tool Kit}}
<
PROC Main()
Line 137:
PutE()
OD
RETURN</
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Stem-and-leaf_plot.png Screenshot from Atari 8-bit computer]
Line 161:
[[GNAT]] used for sorting, could use any other sorting method.
Does not handle negative stems properly.
<syntaxhighlight lang="ada">
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
Line 202:
end loop;
end stemleaf;
</syntaxhighlight>
Output:
<pre>
Line 223:
=={{header|AutoHotkey}}==
<
#NoEnv
Data := "12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58 114 126 53 114 96 25 109 7 31 141 46 13 27 43 117 116 27 7 68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30 127 31 116 146"
Line 262:
Return ToReturn
}
</syntaxhighlight>
Output:
<pre>
Line 282:
=={{header|AWK}}==
<syntaxhighlight lang="awk">
# syntax: GAWK -f STEM-AND-LEAF_PLOT.AWK
#
Line 330:
function max(x,y) { return((x > y) ? x : y) }
function min(x,y) { return((x < y) ? x : y) }
</syntaxhighlight>
<p>output:</p>
<pre>
Line 352:
=={{header|BBC BASIC}}==
{{works with|BBC BASIC for Windows}}
<
Sort% = FN_sortinit(0, 0)
Line 388:
NEXT
PRINT
ENDPROC</
Output:
<pre>
Line 409:
=={{header|C}}==
<
#include <stdlib.h>
Line 447:
return 0;
}</
1 | 2 3 8 8
2 | 3 5 7 7 7 7 7 7 8 8 9 9
Line 461:
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</
=={{header|C sharp|C#}}==
<
using System.Collections.Generic;
using System.Linq;
Line 510:
}
}
}</
<pre> 0 | 7 7
1 | 2 3 8 8
Line 528:
=={{header|C++}}==
<
#include <iomanip>
#include <iostream>
Line 571:
std::cout << std::endl;
}
}</
Output:
<pre> 0 | 7 7
Line 590:
=={{header|Ceylon}}==
<
shared void run() {
Line 613:
print("``formatInteger(i).padLeading(2)``| ``" ".join(stemsToLeaves[i] else [])``");
}
}</
=={{header|Clojure}}==
<
[12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31 125
139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 23 105 63 27
Line 658:
(stem-and-leaf data)
</syntaxhighlight>
{{out}}
Line 680:
=={{header|D}}==
<
void main() {
Line 697:
foreach (i; loHi[0]/10 .. loHi[1]/10 + 1)
writefln("%2d | %(%d %) ", i, histo.get(i, []).sort());
}</
Output:
<pre> 0 | 7 7
Line 718:
{{trans|Ruby}}
{{works with|Elixir|1.3}}
<
def plot(data, leaf_digits\\1) do
multiplier = Enum.reduce(1..leaf_digits, 1, fn _,acc -> acc*10 end)
Line 741:
data = ~w(12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58 114 126 53 114 96 25 109 7 31 141 46 13 27 43 117 116 27 7 68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30 127 31 116 146)
|> Enum.map(&String.to_integer(&1))
Stem_and_leaf.plot(data)</
{{out}}
Line 763:
=={{header|Euphoria}}==
<
procedure leaf_plot(sequence s)
Line 790:
114, 34, 133, 45, 120, 30, 127, 31, 116, 146 }
leaf_plot(data)</
Output:
Line 811:
=={{header|F Sharp|F#}}==
<
let data =
Line 837:
printfn "")
plotStemAndLeafs data</
Output:
<pre>
Line 857:
=={{header|Factor}}==
<
prettyprint sequences sorting ;
Line 874:
120 43 27 27 18 28 48 125 107 114 34 133 45 120 30 127 31
116
} leaf-plot</
{{out}}
<pre>
Line 895:
=={{header|Forth}}==
<
12 , 127 , 28 , 42 , 39 , 113 , 42 , 18 , 44 , 118 , 44 ,
37 , 113 , 124 , 37 , 48 , 127 , 36 , 29 , 31 , 125 , 139 ,
Line 929:
drop ;
plot</
Output:
<pre>
Line 956:
Note that the MOD function can produce unexpected values for negative numbers, and, different computer/compiler/language combinations may produce different surprises. In this case, negative values produce negative remainder values, but the ABS function suppresses the surprise.
<syntaxhighlight lang="fortran">
SUBROUTINE COMBSORT(A,N)
INTEGER A(*) !The array.
Line 1,017:
CALL TOPIARY(VALUES,121)
END
</syntaxhighlight>
Output: (If additional spacing is desired, I2 format could be used, etc.)
Line 1,039:
=={{header|FreeBASIC}}==
<
' compile with: fbc -s console
' for boundry checks on array's compile with: fbc -s console -exx
Line 1,117:
Print : Print "hit any key to end program"
Sleep
End</
{{out}}
<pre> 0 | 7 7
Line 1,136:
=={{header|Go}}==
<
import (
Line 1,176:
}
}
}</
Output:
<pre>
Line 1,197:
=={{header|Haskell}}==
<
import Control.Arrow
import Control.Monad
Line 1,219:
stems = map (flip(,)[]) $ uncurry enumFromTo $ minimum &&& maximum $ fst $ unzip stemLeaf
showStemLeaves f w (a,b) = f w (show a) ++ " |" ++ concatMap (f w. show) b
fb = length $ show $ maximum $ map abs ds</
Output:
<pre>*Main> task nls
Line 1,240:
Or alternatively – aiming more for legibility than for economy or concision:
<
import Data.Ord (comparing)
import Data.Function (on)
Line 1,312:
main :: IO ()
main = putStrLn $ unlines plotLines
</syntaxhighlight>
{{Out}}
<pre> 0 | 7 7
Line 1,332:
=={{header|HicEst}}==
The dialog prompts for bitmap or a text image, and for the stem base. Data are read in from clipboard.
<
DLG(CHeckbox=bitmap, NameEdit=base, DNum, MIn=1, MAx=16) ! 1 <= stem base <= 16
Line 1,359:
WRITE(Format="i3, ':'") stem
ENDIF
ENDDO</
Shown is the given example for bitmap=0 and base 16
<pre> 0 : 7 7 C D
Line 1,373:
=={{header|Icon}} and {{header|Unicon}}==
<
prune := integer(\A[1]) | 10 # Boundary between leaf and stem
every put(data := [], integer(!&input))
Line 1,384:
}
write()
end</
Sample output from data.
<pre>->stem <stem.data
Line 1,411:
=={{header|J}}==
'''Solution: (Tacit)'''
<
leaf =: 10&|
stemleaf =: (stem@{. ; leaf)/.~ stem
Line 1,417:
expandLeaves=: (expandStems e. ])@[ #inv ]
showStemLeaf=: (":@,.@expandStems@[ ; ":&>@expandLeaves)&>/@(>@{. ; <@{:)@|:@stemleaf@/:~</
'''Solution: (Explicit)'''
<
leaves=. 10 | y
stems=. y <.@:% 10
Line 1,432:
xleaves=. (xstems e. stems) #inv leaves NB. expand leaves to match xstems
(": ,.xstems) ; ":&> xleaves
)</
'''Example:'''
<
12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31 125
139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 23 105 63 27 44 105
Line 1,473:
(showStemLeaf -: showStemLeafX) nls NB. both solutions give same result
1</
=={{header|Java}}==
{{works with|Java|1.5+}}
<
import java.util.LinkedList;
import java.util.List;
Line 1,533:
printPlot(plot);
}
}</
{{works with|Java|1.8+}}
<
import java.util.Collection;
import java.util.Collections;
Line 1,619:
;
}
}</
Output:
<pre>0 | [7, 7]
Line 1,641:
It turns out that HTML+CSS renders the plot quite attractively.
<
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" >
Line 1,717:
</body>
</html></
The output looks like:
Line 1,724:
===JavaScript ES6===
<
// main :: IO String
const main = () => {
Line 1,934:
// MAIN ------------------------------------------------------------------
return main();
})();</
{{Out}}
<pre> 0 | 7 7
Line 1,953:
=={{header|jq}}==
<
# align-right:
Line 1,970:
else [ $stem + 1, (.[1] + "\n\($stem+1|right) | \($d % 10)" )]
end )
| .[1] ;</
'''Example''':
<
[ 12,127,28,42,39,113, 42,18,44,118,44,37,113,124,37,48,127,36,29,31,
125,139,131,115,105,132,104,123,35,113,122,42,117,119,58,109,23,105,
Line 1,983:
data | stem_and_leaf
</syntaxhighlight>
{{Out}}
<syntaxhighlight lang="sh">
$ jq -n -r -f stem-and-leaf_plot.jq
0 | 77
Line 2,001:
12 | 00112234445556777788
13 | 1239
14 | 16</
=={{header|Julia}}==
Line 2,007:
This is a rather elaborate function that creates a string depicting a stem and leaf plot. Much of the elaboration is to handle the case of negative numbers that have a stem of 0. There is also a bit of work to allow for leaf sizes other than 1 (some power of 10).
<syntaxhighlight lang="julia">
function stemleaf{T<:Real}(a::Array{T,1}, leafsize=1)
ls = 10^int(log10(leafsize))
Line 2,033:
return slp
end
</syntaxhighlight>
'''Main'''
<syntaxhighlight lang="julia">
println("Using the Task's Test Data")
test = """12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29
Line 2,056:
println("Using: ", test)
println(stemleaf(test, 10))
</syntaxhighlight>
{{out}}
Line 2,116:
=={{header|Kotlin}}==
{{trans|C}}
<
fun leafPlot(x: IntArray) {
Line 2,142:
)
leafPlot(data)
}</
{{out}}
Line 2,164:
=={{header|Lua}}==
<
125,139,131,115,105,132,104,123,35,113,122,42,117,119,58,109,23,105,
63,27,44,105,99,41,128,121,116,125,32,61,37,127,29,113,121,58,114,126,
Line 2,187:
print ""
end</
Output:
<pre> 0 | 7 7
Line 2,206:
=={{header|Maple}}==
<
local i, j, k, tf, LeafStemTable, LeafStemIndices;
k:=0;
Line 2,254:
Y := [ 12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, 37, 48, 127, 36, 29, 31, 125, 139, 131, 115, 105, 132, 104, 123, 35, 113, 122, 42, 117, 119, 58, 109, 23, 105, 63, 27, 44, 105, 99, 41, 128, 121, 116, 125, 32, 61, 37, 127, 29, 113, 121, 58, 114, 126, 53, 114, 96, 25, 109, 7, 31, 141, 46, 13, 27, 43, 117, 116, 27, 7, 68, 40, 31, 115, 124, 42, 128, 52, 71, 118, 117, 38, 27, 106, 33, 117, 116, 111, 40, 119, 47, 105, 57, 122, 109, 124, 115, 43, 120, 43, 27, 27, 18, 28, 48, 125, 107, 114, 34, 133, 45, 120, 30, 127, 31, 116, 146];
StemPlot(Y);</
<pre>0 | 7 7
Line 2,273:
=={{header|Mathematica}}/{{header|Wolfram Language}}==
<
For[i = Min@ Quotient[inputdata, 10],i <= Max@ Quotient[inputdata, 10], i++,
(Print[i, If[(padding - len[i]) > 0, (padding - len[i])*" " <> " |", " |"] ,
StringJoin[(" " <> #) & /@ Map[ToString, #]]])&@
Select[{Quotient[#, 10], Mod[#, 10]} & /@ Sort[inputdata],Part[#, 1] == i &][[;; , 2]]]</
{{out}}
<pre>0 | 7 7
Line 2,297:
=={{header|MATLAB}} / {{header|Octave}}==
<
if nargin < 2, stem_unit = 10; end;
if nargin < 3,
Line 2,319:
x = [12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58 114 126 53 114 96 25 109 7 31 141 46 13 27 43 117 116 27 7 68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30 127 31 116 146];
stem_and_leaf_plot(x); </
Output:
<pre>
Line 2,342:
=={{header|Maxima}}==
<
data: [12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, 37, 48, 127,
Line 2,366:
12|00112234445556777788
13|1239
14|16</
=={{header|Nim}}==
<
import math
import strutils
Line 2,431:
var negativePlot = StemLeafPlot()
negativePlot.init(1, negativeData)
echo negativePlot</
{{out}}
Line 2,465:
The definition of the function <code>unique</code> below can be omited if one uses the [http://code.google.com/p/ocaml-extlib/ extlib].
<
let rec aux acc = function
| [] -> (List.rev acc)
Line 2,473:
else aux (x::acc) xs
in
aux [] li</
<
[ 12; 127; 28; 42; 39; 113; 42; 18; 44; 118; 44; 37; 113; 124; 37; 48;
127; 36; 29; 31; 125; 139; 131; 115; 105; 132; 104; 123; 35; 113; 122;
Line 2,498:
List.iter (Printf.printf " %d") vs;
print_newline()
) keys</
we can output the same latex code than the Perl example replacing the main function as follow:
<
print_endline "\
\\documentclass{report}
Line 2,519:
print_endline "\
\\end{tabular}
\\end{document}"</
=={{header|Perl}}==
<
37 113 124 37 48 127 36 29 31 125 139 131 115 105 132 104 123 35 113
122 42 117 119 58 109 23 105 63 27 44 105 99 41 128 121 116 125 32
Line 2,547:
print " $leaf";
}
</syntaxhighlight>
{{out}}
<pre> 0 | 7 7
Line 2,567:
=== LaTeX output ===
generating {{header|LaTeX}}
<
my @data = sort {$a <=> $b} qw( 12 127 28 42 39 113 42 18 44 118 44
Line 2,609:
\end{tabular}
\end{document}
EOT</
LaTeX output of the Perl program:
<
\usepackage{fullpage}
\begin{document}
Line 2,624:
14 & 1
\end{tabular}
\end{document}</
The parameter to the <code>tabular</code> environment defines the columns of the table. “r” and “c” are right- and center-aligned columns, “|” is a vertical rule, and “<code>*{''count''}{''cols''}”</code> repeats a column definition ''count'' times.
Line 2,636:
=={{header|Phix}}==
{{trans|Euphoria}}
<!--<
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
<span style="color: #008080;">procedure</span> <span style="color: #000000;">leaf_plot</span><span style="color: #0000FF;">(</span><span style="color: #004080;">sequence</span> <span style="color: #000000;">s</span><span style="color: #0000FF;">)</span>
Line 2,664:
<span style="color: #000000;">leaf_plot</span><span style="color: #0000FF;">(</span><span style="color: #000000;">data</span><span style="color: #0000FF;">)</span>
<!--</
{{out}}
<pre style="font-size: 8px">
Line 2,685:
=={{header|PicoLisp}}==
<
12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36
29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119
Line 2,703:
(sort *Data) ) )
(for I (range (caar L) (car (last L)))
(prinl (align 3 I) " | " (glue " " (cdr (assoc I L)))) ) )</
Output:
<pre> 0 | 7 7
Line 2,722:
=={{header|PowerShell}}==
<
$Set = -split '12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31 125 139 131 115 105 132 104 123 35 113 122 42 117 119 58 109 23 105 63 27 44 105 99 41 128 121 116 125 32 61 37 127 29 113 121 58 114 126 53 114 96 25 109 7 31 141 46 13 27 43 117 116 27 7 68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116 111 40 119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34 133 45 120 30 127 31 116 146'
Line 2,733:
@( $Stem.ToString().PadLeft( 2, " " ), '|' ) + ( ( $Data | Where Stem -eq $Stem ).Leaf | Sort ) -join " "
}
</syntaxhighlight>
{{out}}
<pre>
Line 2,757:
'''PureBasic Code'''
<
Dim MyList(120)
Define i, j, StemMax, StemMin
Line 2,799:
Data.i 27, 7, 68, 40, 31,115,124, 42,128, 52, 71,118,117, 38, 27,106, 33,117,116,111, 40,119, 47,105
Data.i 57,122,109,124,115, 43,120, 43, 27, 27, 18, 28, 48,125,107,114, 34,133, 45,120, 30,127, 31,116,146
EndDataSection</
'''Output'''
Line 2,821:
Adjusting <code>Stem.leafdigits</code> allows you to modify how many digits of a value are used in the leaf, with the stem intervals adjusted accordingly.
<
from pprint import pprint as pp
from math import floor
Line 2,859:
if __name__ == '__main__':
print( stemplot(data0) )</
'''Sample Output'''
Line 2,884:
Here is an another example using an OrderedDict and Counter
<
x= [12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, 37, 48,
Line 2,903:
stemleaf(x)
</syntaxhighlight>
Output :
Line 2,926:
Or, generalising a little to write a purely declarative function (in terms of '''groupby''' and '''reduce''') which takes stem and leaf accessor functions as its first arguments:
<
from functools import (reduce)
Line 2,962:
main()</
<pre> 0 | 7 7
1 | 2 3 8 8
Line 2,980:
=={{header|R}}==
<syntaxhighlight lang="r">
x <- c(12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124, 37, 48, 127, 36,
29, 31, 125, 139, 131, 115, 105, 132, 104, 123, 35, 113, 122, 42, 117, 119, 58, 109,
Line 2,990:
stem(x)
</syntaxhighlight>
Output :
Line 3,013:
=={{header|Racket}}==
<syntaxhighlight lang="racket">
#lang racket
(define (show-stem+leaf data)
Line 3,024:
(newline)))
(show-stem+leaf (sequence->list (in-producer read eof)))
</syntaxhighlight>
Sample run:
Line 3,051:
Handles negative stems properly.
<syntaxhighlight lang="raku"
12 127 28 42 39 113 42 18 44 118 44
37 113 124 37 48 127 36 29 31 125 139
Line 3,074:
my $leafs = %h{$stem} // [];
say $stem.fmt($stem_format), ' | ', ~$leafs.map: * % $stem_unit;
}</
Output:<pre> 0 | 7 7
Line 3,099:
Also, all numbers that are processed are normalized. Using a ''sparse array'' bypasses the need for sorting.
<
parse arg @ /* [↓] Not specified? Then use default*/
if @='' then @=12 127 28 42 39 113 42 18 44 118 44 37 113 124 37 48 127 36 29 31 125 139,
Line 3,124:
end /*m*/
say right(k, w) '║' space($) /*display a line of stem─and─leaf plot.*/
end /*k*/ /*stick a fork in it, we're all done. */</
'''output''' when using the (internal) defaults as input:
<pre>
Line 3,146:
===negative, zero, and positive numbers===
This REXX version also handles negative numbers.
<
parse arg @ /*obtain optional arguments from the CL*/
if @='' then @='15 14 3 2 1 0 -1 -2 -3 -14 -15' /*Not specified? Then use the default.*/
Line 3,176:
end /*m*/
say right(k, w) '║' space($) /*display a line of stem─and─leaf plot.*/
end /*k*/ /*stick a fork in it, we're all done. */</
'''output''' when using the (internal) defaults as input:
<pre>
Line 3,186:
=={{header|Ring}}==
<
# Project : Stem-and-leaf plot
Line 3,218:
next
see nl
</syntaxhighlight>
Output:
<pre>
Line 3,241:
=={{header|Ruby}}==
This implementation will handle negative values.
<
def initialize(data, options = {})
opts = {:leaf_digits => 1}.merge(options)
Line 3,354:
27 43 117 116 27 7 68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116
111 40 119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34
133 45 120 30 127 31 116 146</
{{out}}
Line 3,378:
'''Simple version'''
<
def initialize(data, leaf_digits=1)
@leaf_digits = leaf_digits
Line 3,406:
27 43 117 116 27 7 68 40 31 115 124 42 128 52 71 118 117 38 27 106 33 117 116
111 40 119 47 105 57 122 109 124 115 43 120 43 27 27 18 28 48 125 107 114 34
133 45 120 30 127 31 116 146</
{{out}}
<pre>
Line 3,428:
=={{header|Scala}}==
{{works with|Scala|2.8}}
<
val lineFormat = "%" + (numbers map (_.toString.length) max) + "d | %s"
val map = numbers groupBy (_ / 10)
Line 3,434:
println(lineFormat format (stem, map.getOrElse(stem, Nil) map (_ % 10) sortBy identity mkString " "))
}
}</
Example:
Line 3,470:
=={{header|Seed7}}==
<
const proc: leafPlot (in var array integer: x) is func
Line 3,506:
begin
leafPlot(data);
end func;</
Output:
Line 3,529:
=={{header|Sidef}}==
{{trans|Raku}}
<
12 127 28 42 39 113 42 18 44 118 44
37 113 124 37 48 127 36 29 31 125 139
Line 3,552:
var leafs = (h{stem} \\ [])
say(stem_format % stem, ' | ', leafs.map { _ % stem_unit }.join(' '))
}</
{{out}}
<pre>
Line 3,574:
=={{header|Stata}}==
<
. input x
12
Line 3,603:
12* | 00112234445556777788
13* | 1239
14* | 16</
=={{header|Tcl}}==
{{works with|Tcl|8.5}}
<
# How to process a single value, adding it to the table mapping stems to
Line 3,666:
48 125 107 114 34 133 45 120 30 127 31 116 146
}
printStemLeaf $data</
Output:
<pre>
Line 3,687:
=={{header|TUSCRIPT}}==
<
$$ MODE TUSCRIPT
digits=*
Line 3,717:
ENDLOOP
DO format
</syntaxhighlight>
Output:
<pre style='height:30ex;overflow:scroll'>
Line 3,738:
=={{header|uBasic/4tH}}==
<syntaxhighlight lang="text">Push 12, 127, 28, 42, 39, 113, 42, 18, 44, 118, 44, 37, 113, 124
Push 0, 13 : Gosub _Read ' read 1st line of data
Line 3,801:
@(x) = Pop() ' get element from stack
Next
Return</
Output:
<pre> 0 |7 7
Line 3,823:
=={{header|Ursala}}==
<
#import nat
Line 3,844:
#show+
main = stemleaf_plot data</
Reading from right to left on the bottom line of the <code>stemleaf_plot</code> function, we
obtain the quotient and remainder of every datum divided by ten, partition by
Line 3,880:
{{trans|Kotlin}}
{{libheader|Wren-fmt}}
<
var leafPlot = Fn.new { |x|
Line 3,907:
34, 133, 45, 120, 30, 127, 31, 116, 146
]
leafPlot.call(data)</
{{out}}
Line 3,930:
=={{header|zkl}}==
{{trans|C}}
<
xs=xs.sort();
i := xs[0] / 10 - 1;
Line 3,952:
34, 133, 45, 120, 30, 127, 31, 116, 146 );
leaf_plot(data);</
{{out}}
<pre>
|