histogram=: <: @ (#/.~) @ (i...@#@[ , I.)
0 : 0
n-line COMMENT
i...@#@[, put in an ordered list at the start of the
I. interval list to guarantee that key
will order its index collections in
an order that makes sense to a histogram
/.~ make our collection groups
# and then count the number of elements in each
i...@#@[, the key 'collection' order guarantee technique
puts our count out by one.
<: bump it down one with the decrement
but, is <: in its monadic or dyadic form?
Does this come from the @ symbol or the [?
what makes _(#/.~)_ monadic?
(/.~) 0 1 2 0 1 3 3 3 3
0 0 0 0
1 1 0 0
2 0 0 0
3 3 3 3
#(/.~) 0 1 2 0 1 3 3 3 3
2 2 1 4
How does it work out there are two zeros from this output? Ahh, because J
pads it with
zeros to match the longest entry in the array, but the evaluation is prior
to the padding.
How does that sound?
I wish I could improve my J diagnostic skills.
I didn't make much sense of tree view
+ couldn't seem to work out definitively when left and right operands are
used.
My "technique" consists of reading and rereading definitions carefully.
I'm still not 100% sure. I don't want to guess.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm