I just now learned about stem and leave.
For me, the J-way of presenting is enough

   ({.<@~./."1 ])&.|: 0 10 #: /:~ 54 59 35 41 46 25 47 60 54 46 49 46 41 34
22 111 112 
+--+-------+
|2 |2 5    |
+--+-------+
|3 |4 5    |
+--+-------+
|4 |1 6 7 9|
+--+-------+
|5 |4 9    |
+--+-------+
|6 |0      |
+--+-------+
|11|1 2    |
+--+-------+


R.E. Boss

(Add your info to http://www.jsoftware.com/jwiki/Community/Demographics )



> -----Original Message-----
> From: [email protected] [mailto:programming-
> [email protected]] On Behalf Of 'Pascal Jasmin' via
> Programming
> Sent: zaterdag 3 mei 2014 17:47
> To: [email protected]
> Subject: Re: [Jprogramming] Stemplot
> 
> the spec was to have just the last digit show up on right of |
> 
>    (~.@[ (,'|',])&":"_1 ":@/:~/.)/|:0 10 #: /:~ 54 59 35 41 46 25 47 60 54
46 49 46
> 41 34 22 111 112
> 2|2 5
> 3|4 5
> 4|1 1 6 6 6 7 9
> 5|4 4 9
> 6|0
> 11|1 2
> 
> 
> 
> ----- Original Message -----
> From: Raul Miller <[email protected]>
> To: Programming forum <[email protected]>
> Cc:
> Sent: Saturday, May 3, 2014 11:42:44 AM
> Subject: Re: [Jprogramming] Stemplot
> 
> I'm not actually sure if the specification makes sense for numbers
> which are not two digit numbers.
> 
> Roger's advice is probably worth noting.
> 
> Thanks,
> 
> --
> Raul
> 
> On Sat, May 3, 2014 at 11:36 AM, 'Pascal Jasmin' via Programming
> <[email protected]> wrote:
> > Not really as good as your version, but using 0 10 #:
> >
> >    > , each (( [: ":@:~. {."1)  , '|',  ":@{:"1) each  (] <@#~ [: =
{."1) ] 0 10 #: /:~
> 54 59 35 41 46 25 47 60 54 46 49 46 41 34 22
> > 2|25
> > 3|45
> > 4|1166679
> > 5|449
> > 6|0
> >
> > works with minor display quirks for mixed length digit numbers
> >
> >
> >
> >
> > ----- Original Message -----
> > From: Raul Miller <[email protected]>
> > To: Programming forum <[email protected]>
> > Cc:
> > Sent: Saturday, May 3, 2014 10:44:46 AM
> > Subject: Re: [Jprogramming] Stemplot
> >
> > 1. the concept of stem looks like 0 10 #:
> > Here's the dictionary page on antibase:
> > http://www.jsoftware.com/help/dictionary/d402.htm
> >
> > 2. sorting by stem could be put off, for later.
> >
> > 3. leafs look like ":@/:~ gathered using /. using the stem as key.
> > Here's the dictionary page on key:
> > http://www.jsoftware.com/help/dictionary/d421.htm
> >
> > In other words,
> >    |:0 10 #: ruth
> > 5 5 3 4 4 2 4 6 5 4 4 4 4 3 2
> > 4 9 5 1 6 5 7 0 4 6 9 6 1 4 2
> >
> >    ":@/:~/./|:0 10 #: ruth
> > 4 4 9
> > 4 5
> > 1 1 6 6 6 7 9
> > 2 5
> > 0
> >
> >    (~.@[   (,'|',])&":"_1   ":@/:~/.)/|:0 10 #: ruth
> > 5|4 4 9
> > 3|4 5
> > 4|1 1 6 6 6 7 9
> > 2|2 5
> > 6|0
> >
> >    /:~ (~.@[ (,'|',])&":"_1 ":@/:~/.)/|:0 10 #: ruth
> > 2|2 5
> > 3|4 5
> > 4|1 1 6 6 6 7 9
> > 5|4 4 9
> > 6|0
> >
> > Not surprisingly, the most complicated part of this specification is
> > drawing in that vertical bar in the middle of the numbers. It's not a
> > number, so you have to convert the numbers to text (using ":) and you
> > have to do this twice, once for the numbers on the left of '|' and
> > again for the numbers on the right of '|', and also there's the glue
> > needed to make everything stick together properly.
> >
> > In the grand scheme of things, converting characters to numbers isn't
> > really all that complicated, and it's only a small fraction of a line
> > of code here, that we need to do the conversion. Still, viewed
> > objectively, I can easily imagine some people getting frustrated by
> > the mental effort needed to deal with the ugliness of formatting.
> >
> > The solution, of course, for most people, is to wait for someone else
> > deal with it, and then to ask for it to be different.
> >
> > That said, I often wish for a variation on /. which behaves like this:
> >    key=: 1 :'<"_1@~.@[ u&> </.'
> >
> > In other words, modifying a dyad instead of a monad, and giving it a
> > left argument representing the value being keyed on.
> >
> > Then the expression would have looked like this:
> >    /:~((,'|',])&": /:~)key/|:0 10 #: ruth
> >
> > Thanks,
> >
> > --
> > Raul
> >
> > On Thu, May 1, 2014 at 7:35 PM, km <[email protected]> wrote:
> >> Noun  ruth  below shows the numbers of home runs of Babe Ruth in each
> of his 15 years with the New York Yankees, 1920 to 1934.  Noun  stemplot 
is a
> "stemplot" (defined below) of this data.  I have a clumsy way of producing
> noun stemplot.  How would you do it?
> >>
> >>     ruth
> >>  54 59 35 41 46 25 47 60 54 46 49 46 41 34 22
> >>     stemplot
> >>  2|2 5
> >>  3|4 5
> >>  4|1 1 6 6 6 7 9
> >>  5|4 4 9
> >>  6|0
> >>
> >> From Moore and McCabe, Introduction to the Practice of Statistics,
Fourth
> Edition, page 20 --
> >>
> >> To make a "stemplot":
> >>
> >> 1. Separate each observation into a "stem" consisting of all but the
final
> (rightmost) digit and a "leaf", the final digit.  Stems may have as many
digits
> as needed, but each leaf contains only a single digit.
> >>
> >> 2. Write the stems in a vertical column with the smallest at the top,
and
> draw a vertical line at the right of this column.
> >>
> >> 3. Write each leaf in the row to the right of its stem, in increasing
order
> out from the stem.
> >>
> >> --Kip Murray
> >>
> >> Sent from my iPad
> >> ----------------------------------------------------------------------
> >> For information about J forums see
> http://www.jsoftware.com/forums.htm
> >
> > ----------------------------------------------------------------------
> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> 
> >
> > ----------------------------------------------------------------------
> > For information about J forums see
> http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to