"Henry Rich" <[EMAIL PROTECTED]> wrote:

> Here's a session log:
>
>    nz =.  0 % _1  NB. negative zero
>    3!:3 nz
> e1000000
> 08000000
> 01000000
> 00000000
> 00000000
> 00000080
>    ''&mysteryprimitive nz
> 0
>    3!:3 nz
> e1000000
> 08000000
> 01000000
> 00000000
> 00000000
> 00000000
>
>
> Look! the dyad mysteryprimitive cleaned up the negative zero
> to make it a nice shiny positive zero.  No assignments are performed.
>
> What is the mysteryprimitive?  (There are several possible answers).

mysteryprimitive =: -.
mysteryprimitive =: e.
mysteryprimitive =: i.
mysteryprimitive =: i:

> Why does it polish zeros?

I would guess it's part of the voodoo Roger uses to
reduce all of these from quadratic to linear time.

I would conjecture that the fact that 0=!.0 [0%_1
even though they have distinct binary representations
might throw a wrinkle into such code, so 'cleaning up'
the parameters (especially when doing so has no
'discernable effect' (other than perhaps 3!:3 here))
would be considered an acceptible relaxation of the
'functions must not alter their arguments' rule.

-- Mark D. Niemiec <[EMAIL PROTECTED]>

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to