[Jprogramming] Unicode histograms
Ian Clark
earthspotty at gmail.com
Tue Jan 24 05:47:39 HKT 2012
Unicode has a set of characters for building a crude (horizontal) histogram:
u: 16b2588 NB. U+2588 (9608) 1.0
u: 16b2589 NB. U+2589 (9609) 0.875
u: 16b258a NB. U+258a (9610) 0.75
u: 16b258b NB. U+258b (9611) 0.625
u: 16b258c NB. U+258c (9612) 0.5
u: 16b258d NB. U+258d (9613) 0.375
u: 16b258e NB. U+258e (9614) 0.25
u: 16b258f NB. U+258f (9615) 0.125
They can be used to implement a progress bar, or embed little
histograms in tables of figures.
Notice a curious thing: these code points divide the basic block
(U+2588) into *eights*, not tenths! Why?
I imagine it's for ultra-efficient ASM to pick the part-block from the
(base-2) mantissa of a floating-point number. But how do you do it
ultra-efficiently in J?
See my solution at: http://www.jsoftware.com/jwiki/Essays/Unicode%20Histogram
This uses the verb: fh to pick the code-point for the final
part-block. But I don't believe for a moment it's the best solution.
Anyone got a quicker/slicker fh?
More information about the Programming
mailing list