The actual results for the example in the vocabulary page for b. were
slightly different than what was shown:
g =: +&2@(*&3@*:)
y =: g 5
y
77
g b. _1
%:@(0.33333333333333331&*)@(_2&+)
When I simplified the expression for g , I finally figured out what b. was
all about.
h =: 2 + 3 * *:
h 5
77
h b. _1
[: %: 0.33333333333333331 * _2 + ]
Maybe this will be helpful to some others. Now I'll keep working on
"bitwise_not"
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Henry Rich
Sent: Saturday, September 24, 2011 9:34 PM
To: Programming forum
Subject: Re: [Jprogramming] bitwise not
According to the table in the Dictionary, you would want the bitwise
version of -. y, which is (26 b.)
Your 25 b. (or 24 b. or 27 b.) would also work as a monad, since x is
taken to be 0.
Henry Rich
On 9/24/2011 9:06 PM, David Ward Lambert wrote:
> Please what is the j notation for bitwise not?
>
> Adverb b. is ingenious---I haven't figured out why negative m is useful.
> On last-ditch effort I've reinvented the j notation:
>
> bitwise_not=: (16 + #. 1 0 0 1)b. NB.(#.1 1 0 0 1)b.
>
> The definition is non-obvious and should be considered for the
> beginner's dictionary. There's a good chance I've overlooked
> documentation.
>
> These definitions are fun:
>
> bnot0=: -.@x:&.#:
>
> bnot1=: -.&.((8$2)&#:)
>
> bnot0^:40 41]2324244 NB.removes most significant bits
> 0 1
>
> bnot1^:40 41]2324244 NB.chose to retain a standard byte
> 20 235
>
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm