On Mon, Jun 14, 2010 at 2:01 AM, David Ward Lambert
<[email protected]> wrote:
> intersect =: -.^:2 NB. I've overlooked a set intersection
> NB. primitive or phrase?
That is a nice definition for intersect.
> relocate =: 1 : '#...@[ | m"_ + ]'
or
relocate =: 1 : '#...@[ | m + ]'
> neighbors =: [: :([ {~ i...@#@[ intersect [: ~. [: , _1 1 +"0 _ ])
or
neighbors=: [ {~ i...@#@[ -.^:2 [: , _1 1 +/ ]
FYI,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm