Here's an odd behavior.  Why doesn't  le2  behave the same as  le3?

S=:2 2 2 3 4
   
L=:3 4 8 3 7
   
   NB.   x u/.y ↔ (=x) u@# y
   
   le3=: 13 :'(=x) ":@ # y'
   ]LE3=: S le3 L
3 4 8
3    
7    
   
   le2=: 13 :'(=x) ([: ": #) y'
   ]LE2=: S le2 L
3 4 8
3 0 0
7 0 0
   
   le=: 13 :'x ": /. y'
   ]LE=:S le L
3 4 8
3    
7    
   
5!:4 <'le3'
   5!:4 <'le3'
  ┌─ ]             
  │           ┌─ ":
  ├─ ~ ─── @ ─┴─ # 
──┤                
  │     ┌─ [:      
  └─────┼─ =       
        └─ [       
   
   5!:4 <'le2'
  ┌─ ]            
  │          ┌─ [:
  ├─ ~ ──────┼─ ":
──┤          └─ # 
  │     ┌─ [:     
  └─────┼─ =      
        └─ [      
  
   5!:4 <'le'
── /. ─── ":

Linda
   



-----Original Message-----
From: [email protected] [mailto:programming-
[email protected]] On Behalf Of Linda Alvord
Sent: Tuesday, May 13, 2014 4:14 AM
To: [email protected]
Subject: Re: [Jprogramming] Stemplot

Here's the first 4 lines with a line feed.  Linda

D=:/:~ 17 133 151 47 12 19 52 80 32 87 24 14 20 90 9 47 72 7 36 64 
NB.D=:/:~50 83 95 107 113 113 116 116 118 123
NB.D=:11 11 31 73 74 92 104 114 129 133
NB.D=:/:~ (>:?15)+?10#140

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Monday, May 12, 2014 11:29 PM
To: [email protected]
Subject: Re: [Jprogramming] Stemplot

Here's where this belongs.

ip, I enjoyed this problem.  I created the following script to randomly
generate lists and then create the stemplot.  Save in a new jijx.  Then run
it.  Remove the  NB. in the second line to see another example. Do the same
for the third line.  Removing the NB. from the fourth line will generate new
data.  Hopefully it won't fail.  Id appreciate inprovements within simple J
from anyone.

D=:/:~ 17 133 151 47 12 19 52 80 32 87 24 14 20 90 9 47 72 7 36 64
NB.D=:/:~50 83 95 107 113 113 116 116 118 123
NB.D=:11 11 31 73 74 92 104 114 129 133
NB.D=:/:~ (>:?15)+?10#140

sl=: 13 :'''S L''=:|:0 10#:y'
sl D
S
L

]DO=:(<./S)+i.>:(>./S)-<./S

]WL=:":,.(DO e. S)#DO

]WOL=:":,.(-.DO e. S)#DO

]SS=:(|."1(|."1 WL),|."1 WOL),.'|'

]LS=:S ":/. L

]NLS=:((0{$WOL),1{$LS)$' '

]SP=: SS,. LS, NLS

]OS=: (".0 1{"1 SS)-0{DO

]G=: OS i. i.$DO

]GOOD=:G {"2 SP

]D 

In these days I guess you could call it a stem plot "app".  In any case,
when you understand any steps you can remove  ]  from a given line and it
will no longer provide that result.  Eventually, if you remove them all, you
can make a stem plot of two digit numbers. I would have able to develop this
and then use it in a high school Probability and Statistics class.

Linda



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Kip Murray
Sent: Wednesday, May 07, 2014 9:47 AM
To: [email protected]
Subject: Re: [Jprogramming] Stemplot

You somehow lost the leaf 1 from data item 151 (an "off by 1" error?).
 Last row of answer should be 15 1 _ _ _  Sorry about line wrap.  --Kip

   NB. Actually... this isn't any shorter, but it feels cleaner:

   2-~(+1%*)/:~(~.@[,./:~@}:/.)/|:>:0 10#:data,10*i.>./<.data%10
 0 7 9 _ _
 1 2 4 7 9
 2 0 4 _ _
 3 2 6 _ _
 4 7 7 _ _
 5 2 _ _ _
 6 4 _ _ _
 7 2 _ _ _
 8 0 7 _ _
 9 0 _ _ _
10 _ _ _ _
11 _ _ _ _
12 _ _ _ _
13 3 _ _ _
14 _ _ _ _
15 _ _ _ _

   NB. Thanks,

   stemplot data
 0|7 9
 1|2 4 7 9
 2|0 4
 3|2 6
 4|7 7
 5|2
 6|4
 7|2
 8|0 7
 9|0
10|
11|
12|
13|3
14|
15|1

   data
17 133 151 47 12 19 52 80 32 87 24 14 20 90 9 47 72 7 36 64


On Wednesday, May 7, 2014, Raul Miller <[email protected]> wrote:

> Actually... this isn't any shorter, but it feels cleaner:
>    2-~(+1%*)/:~(~.@[,./:~@}:/.)/|:>:0 10#:data,10*i.>./<.data%10
>
> Thanks,
>
> --
> Raul
>
>
> On Wed, May 7, 2014 at 4:11 AM, Raul Miller
<[email protected]<javascript:;>>
> wrote:
> > On Wed, May 7, 2014 at 3:59 AM, Kip Murray
<[email protected]<javascript:;>>
> wrote:
> >> Can you add in the "empty stems" 10 11 12 14 ?
> >
> > Like this?
> >    2-~(+1%*)/:~(~.@[,./:~@}:/.)/|:(,0,.~1+0 i.@{>./)>:0 10#:data
> >
> > Thanks,
> >
> > --
> > Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


-- 
Sent from Gmail Mobile
----------------------------------------------------------------------
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