You may want to look at
http://www.jsoftware.com/jwiki/Essays/Progressive%20Index-Of



On Mon, Sep 10, 2012 at 11:37 PM, June Kim (김창준) <junea...@gmail.com> wrote:

> Hello
>
> If you want to remove all occurences of x in y, it's simple in J:
>
> y-.x
>
> For example,
>
>    1 2 3 1 9 10 8 1 -. 1
> 2 3 9 10 8
>
> Now, if you want to remove n occurences of x in y, how would you do that?
>
> Following is my quick and dirty solution:
>
>    removen=.13 : 'y#~-.((x>:]) *. 0&~:) (*+/\) (={.)y'
>    3 removen 'fasdffgh  flkjffif'
> asdgh  flkjffif
>    3 removen 1 1 2 3 1 9 10 8 1
> 2 3 9 10 8 1
>
> I used the first item in y as the "item to remove" -- smiliar to the cut
> verb.
>
> I believe there are simpler solutions as always(you may relax the constrain
> for keeping the order of y). Any suggestions?
>
> June
> ----------------------------------------------------------------------
> 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