]&.#: does not reconstitute negative integers

   i:2
_2 _1 0 1 2
   ]&.#: i: 2
2 3 0 1 2

However, with a little work, an invertible operation
can be achieved:
   #.@(#:,.~0<.*)i:2
_2 _1 0 1 2

This becomes important when investigating operations
on binary numbers.  For example, shift right:
   (,. #.@(}:"1)@(#:,.~0<.*))i:3
_3 _2
_2 _1
_1 _1
 0  0
 1  0
 2  1
 3  1

FYI,

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

Reply via email to