>Ragged arrays are a problem for J, if boxing is costly. Eg a dictionary of the
>English language can be easily be represented as a (very sparse) array of
>dimension the longest word {an extent of 26 in each dimension). No problem
>using this representation in a language such as K. But for an alternative in J
>... i do not know, even memory mapping the full rectangularity would be taxing.
greg
~krsnadas.org
--
from: Brian Schott <[email protected]>
to: Programming forum <[email protected]>
date: 23 October 2013 14:42
subject: Re: [Jprogramming] a more useful i. ?
>Would this feature be more adaptable if it were implemented as a !. feature? I
>don't have any example in mind, but the thought occurs.
--
from: Roger Hui <[email protected]>
to: Programming forum <[email protected]>
date: 23 October 2013 14:28
subject: Re: [Jprogramming] a more useful i. ?
>It is much more efficient in time and space to eschew boxing within a column.
--
from: Pascal Jasmin <[email protected]>
to: "[email protected]" <[email protected]>
date: 23 October 2013 14:23
subject: Re: [Jprogramming] a more useful i. ?
>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]>
date: 23 October 2013 13:53
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.
--
from: Henry Rich <[email protected]>
to: [email protected]
date: 23 October 2013 13:45
subject: Re: [Jprogramming] a more useful i. ?
>Seems reasonable. This would also promote atoms to match rows of tables.
>I've never needed it.
--
from: Roger Hui <[email protected]>
to: Programming forum <[email protected]>
date: 23 October 2013 13:28
subject: [Jprogramming] a more useful i. ?
>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