Correction:

    3 (4 : 'y{~<<<x{.I.(={.)y') 1 1 2 3 1 9 10 8 1
2 3 9 10 8 1


R.E. Boss


> -----Oorspronkelijk bericht-----
> Van: programming-boun...@forums.jsoftware.com 
> [mailto:programming-boun...@forums.jsoftware.com] Namens R.E. Boss
> Verzonden: woensdag 12 september 2012 8:34
> Aan: programm...@jsoftware.com
> Onderwerp: Re: [Jprogramming] Removing n occurences
> 
> 
>    3 (4 : '({.y) (] {~ [:<^:3 i.~)^:x y') 1 1 2 3 1 9 10 8 1
> 2 3 9 10 8 1
> 
>    3 (4 : 'y{~<<<3{.I.(={.)y') 1 1 2 3 1 9 10 8 1
> 2 3 9 10 8 1
> 
> 
> R.E. Boss
> 
> 
> > -----Oorspronkelijk bericht-----
> > Van: programming-boun...@forums.jsoftware.com 
> > [mailto:programming-boun...@forums.jsoftware.com] Namens Roger Hui
> > Verzonden: woensdag 12 september 2012 8:13
> > Aan: programm...@jsoftware.com
> > Onderwerp: Re: [Jprogramming] Removing n occurences
> >
> > If it's a general approach and (more importantly :-) it solves your
> > problem, then take the general solution and simplify it for your specific
> > problem.
> >
> >
> >
> > On Tue, Sep 11, 2012 at 10:49 PM, June Kim (김창준) <junea...@gmail.com> wrote:
> >
> > > Hi Roger,
> > >
> > > Thanks, Roger, as always. I am aware of that wiki page, but I think it's a
> > > more general approach. How could I use that to make removen simpler and
> > > more elegant?
> > >
> > > Best regards
> > >
> > > June
> > >
> > > On Tue, Sep 11, 2012 at 3:42 PM, Roger Hui <rogerhui.can...@gmail.com
> > > >wrote:
> > >
> > > > 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
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> 
> ----------------------------------------------------------------------
> 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