Here's a general bitwise operator for J:
bitwise=:1 :0
assert. y-:<.y
#.u #:y
:
assert. x-:<.x
assert. y-:<.y
X=.#:x
Y=.#:y
W=.-X >.&{:&$ Y
R=.>:`_:@.(_1&=)"0 u b. 0
#. (X{.~W,~$x) u"R Y{.~W,~$y
)
For example:
2 +.bitwise 1 2 8
3 2 10
I am not very confident that my approach for rank for the dyadic
case is always appropriate, but I can't think of any good
cases where that matters.
And, unfortunately, I'm not sure this is a candidate for inclusion
in J (because the logical symbol -- b. -- already has a conflicting
meaning).
Anyways... perhaps this adverb is of interest to someone?
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm