This is one way: (_1([:I.2|])}])0 1 2 3 4 0 _1 2 _1 4
If you want to make the replaced value a left argument then: _2(([:I.2|])}])0 3 2 2 4 1 6 0 _2 2 2 4 _2 6 On Sun, Sep 5, 2010 at 12:05 PM, gary ng <[email protected]> wrote: > Hi, > > What would be the recommended way to do this , say replace every > element that is odd to '_1' ? > > 0 1 2 3 4 => 0 _1 2 _1 4 > > I tried to under stand the 'm } ' verb but don't know how to generate > the m based on a predicate. > > similarly how about replace the first n with _1 ? > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
