Like this? arr=: ;:'a b a c b c a b b b c a b' (;:'a b c')i.arr 0 1 0 2 1 2 0 1 1 1 2 0 1 ((;:'a b c')i.arr){;:'e f g' ┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐ │e│f│e│g│f│g│e│f│f│f│g│e│f│ └─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘
I hope this helps, -- Raul On Sat, May 27, 2017 at 4:43 AM, 'Jon Hough' via Programming <programm...@jsoftware.com> wrote: > Let > a=: 'a' > b=: 'b' > c=: 'c' > > and let > arr=: a;b;a;c;b;c;a;b;b;b;c;a;b NB. i.e. all items from a,b,c > > I want to relabel the items > with > e=: 'e' > f=: 'f' > g=: 'g' > so a -> e, b -> f, c -> g. > so arr becomes > e;f;e;g;f;g;e;f;f;f;g;e;f > > Is there a succinct (preferably tacit) way to do this? > I feel like there should be, but can't find a way, so my current > method is to use a for__i. loop, which feels very clumsy for > something that seems should have a nice solution. > > Thanks, > Jon > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm