Thanks for your help but I do want the items to be adjacent. I was
struggling to make use of amend but I hadn't succeeded.

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Monday, August 13, 2012 10:03 AM
To: [email protected]
Subject: Re: [Jprogramming] Amend adjacent columns

On Mon, Aug 13, 2012 at 5:13 AM, Linda Alvord <[email protected]>
wrote:
> How can I amend adjacent columns to remove duplicates?
>
>     2 10$'ABCDEEEFGH'
> ABCDEEEFGH
> ABCDEEEFGH
>
>    2 7$'ABCDEFG'
> ABCDEFG
> ABCDEFG

Note that "amend" is a J primitive which preserves the shape of its right
argument, so I am going to presume that you are only hinting at what you
want done here.

If you can relax the "adjacent" part, it's simple:

   ~.&.|: 2 10$'ABCDEEEFGH'
ABCDEFGH
ABCDEFGH

If you really need to preserve duplicate columns which are not a part of an
adjacent sequence, the complications that Henry spelled out will accomplish
that task.

FYI,

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

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

Reply via email to