Now we need an inverse for Raul's improved #: ("hash colon")
hc NB. Raul's improved #:
{.@#:@(,: (2 * |))
hc i: 2
1 1 0
1 1 1
0 0 0
0 0 1
0 1 0
hcinv NB. improvement sought
2&#.`(2&#.@}. - 2 ^ <:@#)@.{."1
hcinv hc i: 2
_2 _1 0 1 2
On 12/8/2011 2:41 PM, Raul Miller wrote:
...
But this would work just as well, as a model:
{.@#:@(,: 2 * |)i:2
1 1 0
1 1 1
0 0 0
0 0 1
0 1 0
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm