RosettaCodeData/Task/Stem-and-leaf-plot/J/stem-and-leaf-plot-1.j

8 lines
257 B
Plaintext

stem =: <.@(%&10)
leaf =: 10&|
stemleaf =: (stem@{. ; leaf)/.~ stem
expandStems =: <./ ([ + i.@>:@-~) >./
expandLeaves=: (expandStems e. ])@[ #inv ]
showStemLeaf=: (":@,.@expandStems@[ ; ":&>@expandLeaves)&>/@(>@{. ; <@{:)@|:@stemleaf@/:~