,:@E. adds a leading 1 dimension to the result from E. which lets me use # to make n copies of that result (where n is the length of the left argument), which lets me rotate those rows by -i.n
Does this help? -- Raul On Sun, Aug 30, 2020 at 11:54 PM 'Pascal Jasmin' via Programming <[email protected]> wrote: > > variation on Raul's 2nd, that makes more sense to me. Still E. focused, but > don't understand ,:@E. > > 'AA'(] #~ [ (] -.@:([ +./@:,: |.~) -@<:@#@[) E.) 'abcAAAdefAA' > > abcdef > > > > > > > On Sunday, August 30, 2020, 09:04:07 p.m. EDT, Raul Miller > <[email protected]> wrote: > > > > > > Well, if you want the alternate semantics you suggested in that comment: > > 'AA' (] rplc '';~[) 'abcAAAdefAAA' > abcAdefA > > Or, if you prefer the overlap approach: > > 'AA' (] #~ #@[ */@(-@i.@[ |."_1 #) -.@,:@E.) 'abcAAAdefAAA' > abcdef > > I hope this helps, > > -- > Raul > > On Sun, Aug 30, 2020 at 8:56 PM Devon McCormick <[email protected]> wrote: > > > > Hi - > > > > I just wrote a string removal verb: > > > > NB.* removeStr: remove string x from string y > > removeStr=: 4 : 0 > > wh=. I. whb=. x E. y > > rmb=. -. (1) (~.;(<i.#x)+&.>wh)}whb > > rmb#y > > NB.EG 'H n brn c?' -: 'ow' removeStr 'How now brown cow?' > > NB.EG 'abcdef' -: 'AA' removeStr 'abcAAAdefAAA' NB. May be non-intuitive > > ) > > > > Note the second example in the comment on the final line - since 'AA' > > occurs twice in 'AAA', both are removed, thus removing the triplet. It > > seems an unlikely case but is this behavior too confusing? > > > > Does anyone have an alternate version of this? > > > > Thanks, > > > > Devon > > -- > > > > Devon McCormick, CFA > > > > Quantitative Consultant > > ---------------------------------------------------------------------- > > 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
