PackRat wrote: > > I'm trying to understand some J code that uses the interval index I. > primitive. As a newbie to some of the more "advanced" primitives in J, > the DoJ's explanation is beyond me. Can someone please clue me in on > what the purpose of I. is and how it works (in verbose, easy English, > please)? I thought I'd do a little trial and error (you know, what > if...?) with some data to see what the results of I. were. But looking > at the results below, I just don't see or understand what's going on. > I also don't know how these results would then be used as a possible > next step. > > d=. 0 1 4 5 7 8 11 13 14 17 > e=. 2 3 6 7 10 13 14 > > d I. e > 2 2 4 4 6 7 8 > Intervals here are:
2 ,\ d NB. Interval index: 0 1 NB. 1 1 4 NB. 2 4 5 NB. 3 5 7 NB. 4 7 8 NB. 5 8 11 NB. 6 11 13 NB. 7 13 14 NB. 8 14 17 NB. 9 Now d I. e just tells you the index of the interval to which each item of e belongs: 2 belongs to the 2nd interval, 3 also,..., 14 belongs to the 8th interval (not 9th). In this case there are also 0th and 10th interval, for numbers outside of the interval 0 17. > e I. d > 0 0 2 2 3 4 5 5 6 7 > Hopefully this is obvious now. > If you prefer other examples, that's fine, too--as long as they clearly > show what I. is doing. Thanks in advance for any help with > understanding I. better! > > Harvey > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > -- View this message in context: http://old.nabble.com/Wanted%3A-%22interval-index%22-explanation-tp31420929s24193p31421448.html Sent from the J Programming mailing list archive at Nabble.com. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
