I find that using boxed strings in inverted tables avoids a whole series of issues that occur if you let J fill short strings with pads until they match length to whatever the longest string is.
I don't really know how much it slows down things by doing it that way, but the approach can fix i. by comparing to boxed values. I definitely don't have an exhaustive list of things that seem harder without boxing first, but there is probably more than just i. ________________________________ From: Roger Hui <[email protected]> To: Programming forum <[email protected]> Sent: Wednesday, October 23, 2013 4:53:34 PM Subject: Re: [Jprogramming] a more useful i. ? Thanks. I had not intended to promote rank-deficient arguments. I probably want to disallow that. One effect would be to make http://www.jsoftware.com/jwiki/Essays/Inverted_Table#Index_of more immediately useful: If you have to do the overtake yourself for one table, it's tolerable; if you have to do it on some subset of columns (and you don't know ahead of time which ones), it's a big mess. Basically in tindexof=: i.&>~@[ i.&|: i.&> you'd replace the i. in the left and right tines with the I verb that I defined. On Wed, Oct 23, 2013 at 1:45 PM, Henry Rich <[email protected]> wrote: > Seems reasonable. This would also promote atoms to match rows of tables. > I've never needed it. > > Henry Rich > > > On 10/23/2013 4:28 PM, Roger Hui wrote: > >> Thought experiment: What if i. does overtake on the arguments to ensure >> that the item shape of the left argument matches the cell shape of the >> right argument? >> >> I=: 4 : '(s{."c x) i. (s{."c y) [ s=. (}.$x)>.(-c=. <:$$x){.$y' >> x=: > ;:'zero one two five one' >> y=: > ;:'three one four one five nine' >> >> $x >> 5 4 >> $y >> 6 5 >> >> x i. y >> 5 5 5 5 5 5 >> x I y >> 5 1 5 1 3 5 >> ------------------------------**------------------------------** >> ---------- >> For information about J forums see >> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm> >> >> ------------------------------**------------------------------** > ---------- > For information about J forums see > http://www.jsoftware.com/**forums.htm<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
