Hi, is the expected output of transforming 1 3 _3 3 5 to be 1 3 5 or 1 5 ?
On Fri, Dec 6, 2019 at 7:15 AM R.E. Boss <[email protected]> wrote: > Given an array with zero or more annihilating pairs, i.e., two subsequent > numbers which add up to zero, the question is to clean up the array by > deleting all annihilating pairs such that no such pairs are left. > I do have a solution that is both elegant and efficient (I believe), but I > am curious about other thoughts. > > foo 2 1 1 _1 2 _2 _1 > 2 > > foo 1 _1 2 _2{~100?.@#4 NB. Notice (?.) > 2 1 2 1 _2 _1 2 1 1 2 2 2 _1 2 _1 2 1 2 2 2 1 1 _2 _1 2 1 _2 _1 _2 _2 _2 > _2 _1 _2 _1 _1 _2 _2 1 1 1 2 1 _2 1 _2 _1 _1 _1 2 > > > R.E. Boss > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
