On Mon, Feb 3, 2014 at 1:26 PM, Dan Bron <[email protected]> wrote:
> So, the question still stands: are there "reduction" or "moving window" or
> "running" analogs to the bitwise functions provided by b. ? Given the
> direction this thread has taken, I'm guessing not, but I'd be happy to be
> proven wrong.
I am not aware of any good ones.
But of course it's possible to implement #: (or b.) in J using other primitives.
Now, if we had a compiler for a subset of J (ideally using an ML type
system, or something along that line) we could get into more
complexity in that context.
So with that in mind, here's "bitwise and" implemented using #:
Bitwise=: /(@,:)(&.|.)(&.#:)("0)
band=: *. Bitwise NB. 17 b. without the constraint on integer size
band/~ i. 4
0 0 0 0
0 1 0 1
0 0 2 2
0 1 2 3
Thanks,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm