2 4 I. i.7 0 0 0 1 1 2 2 Interval adds an extra count for bin above the last range.
still, just the count as: 2 4 #/.~@:I. i.7 3 2 2 and then with printed intervals, 2 4 ([ (] ,.~ [ {.!._~ #@]) #/.~@:I.) i.7 2 3 4 2 _ 2 2 4 9 ([ (] ,.~ [ {.!._~ #@]) #/.~@:I.) i.7 2 3 4 2 9 2 ________________________________ From: Rudolf Sykora <rudolf.syk...@gmail.com> To: programm...@jsoftware.com Sent: Thursday, June 15, 2017 7:50 AM Subject: [Jprogramming] histogram from Essays Hello, I found a code to produce a histogram at http://code.jsoftware.com/wiki/Essays/Histogram. However, both the description and the function seem odd. The code reads histogram=: <: @ (#/.~) @ (i.@#@[ , I.) 1) They say: ---The left argument is a list of interval *start* points.---, which I think is not quite right (or is at least deceptive): 2 3 histogram 1 1 0 2 3 histogram 2 1 0 (thus x are actually inclusive endpoints). 2) Furthemore and more importantly: 2 histogram 1 1 2 histogram 10 0 0 which (the 2nd case) is not nice, since the shape of the result changes depending on data *value*. I'd rather have a verb that would output 2 hist 1 1 0 2 hist 10 0 1 Does anyone have a verb like that? (I will try to design one myself, but am asking anyway.) Thanks Ruda ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm