The same arguments but +/b instead of +/"1 b is even more amusing.
----- Original Message ----- From: Roger Hui <[email protected]> Date: Tuesday, September 7, 2010 8:29 Subject: Re: [Jprogramming] Splitting an integer into its digits To: Programming forum <[email protected]> > > Any others? > > To repeat myself: LOTS of juicy tricky clever code. > > None of the functions should be any slower for bit booleans > than for byte booleans, but to achieve it ... > > > Sounds like +/b should not be much of a problem > > How about +/"1 b where b=:(m,8*n) ?...@$ 2 is a bit boolean? > b=: (m, 5+8*n) ?...@$ 2 > b=: (m, 2+8*n) ?...@$ 2 > > Just the tip of the iceberg. > > > > > ----- Original Message ----- > From: Don Guinn <[email protected]> > Date: Tuesday, September 7, 2010 6:05 > Subject: Re: [Jprogramming] Splitting an integer into its digits > To: Programming forum <[email protected]> > > > Sounds like +/b should not be much of a problem. What about > the other > > primitives? It seems that the primary consideration is that > the > > speed can > > not be much, if any, slower than byte booleans to be practical. > > > > Self-Classify (=) - A shoe in. > > > > Conversion from bit to other numeric types - Probably about > the > > same speed > > as now. > > > > Creating booleans from comparisons - The packing might require > > additionalcode, but should be about the same speed as now. How > > could this relate to > > Copy? (see next) > > > > Copy (#) - Probably about the same speed as now; however, it > is > > used a lot > > so it can't be slower. > > > > Append (,) - A bit slower for small arrays but should be > > considerably faster > > for large arrays. > > > > Grades and sorts (/:) (\:) - Monadic may be difficult as the > > indices have to > > be built. Dyadic? > > > > Prefix and Infix (\) - Not pretty. +\/b would probably have to > > be converted > > to numeric first. > > > > > > Any others? > > > > > > On Tue, Sep 7, 2010 at 1:47 AM, Robert P. Rumble > > <[email protected]>wrote: > > > At 08:29 PM 9/6/2010, you wrote: > > > >Bytes are directly addressable in the most popular CPUs; > > > >bits are not. > > > > > > > >However, with an additional 20 years of C programming under > > > >my belt, I am now confident enough to tackle bit booleans, > > > >if I should become interested enough. Bit booleans offer > > > >lots of room for lots of juicy tricky clever code. For > > example,> >how do you compute +/b where b is a bit-boolean vector? > > > > > > This may have already been done for you in hardware. > > > > > > See opcode called popcount or popcnt, aka "the NSA > > instruction" for > > > x86 architectures. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
