Try
histogram=: <: @ (#/.~) @ (i.@>:@[EMAIL PROTECTED] , I.)
10 20 histogram 11 21
0 1 1
The first interval is the implied interval starting at __ .
Henry Rich
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of June Kim
> Sent: Saturday, April 05, 2008 3:41 PM
> To: Programming forum
> Subject: [Jprogramming] histogram
>
> from http://www.jsoftware.com/jwiki/Essays/Histogram
>
> <quote>
> histogram=: <: @ (#/.~) @ ([EMAIL PROTECTED]@[ , I.)
>
> The left argument is a list of interval start points. The right
> argument is an array of data. The result is a list of counts of the
> number of data points in each interval.
> </quote>
>
> However,
>
> 10 20 histogram 11 21
> 0 1 0
>
> I expected 1 1. I think the J code and the explanation below it
> doesn't match exactly.
> ----------------------------------------------------------------------
> For information about J forums see
> http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm