On Sun, Oct 27, 2013 at 1:40 PM, Pascal Jasmin <[email protected]>wrote:
> I don't get how to parse > > 1&:>&;: > > > I think it is (1&:>)&;: , but that is just as confusing since I assume you > are unboxing into a list rather than testing if smaller than 1. > > > ----- Original Message ----- > From: Raul Miller <[email protected]> > To: Programming forum <[email protected]> > Cc: > Sent: Sunday, October 27, 2013 10:41:18 AM > Subject: Re: [Jprogramming] a more useful i. ? > > I am wondering if a "coerce items (rank specified by n) to equal shape > while executing dyad u" conjunction would be worthwhile. > > Perhaps, as a model: > > coer=:2 :0 > : > nounR=. x ,&#&$ y > verbR=. _2 {. n,n > choice=. 0 <: verbR > itemR=. (choice*nounR<.verbR) + (-.choice)*0>.nounR-verbR > cellS=. x >.&((->./itemR)&{.)&$ y > xShape=. ((-#cellS)}.$x),cellS > yShape=. ((-#cellS)}.$y),cellS > (xShape{.x) u yShape{.y > ) > > (clearly, most of this implementation is names, but since it's just a > model I'm not concerned about that.) > > Example use: > 'this is a test' ;&$ coer 1&:>&;: 'and this is yet another test' > > Note that while the conjunction right argument of coer can take the > same kind of value as that of " (the rank conjunction), coer does not > actually impose any rank on its left argument (;&$ in this case). > > And, yes, for some readers it might seem like I am babbling nonsense. > If that is the boat you are stuck in, maybe try it out and see if you > can make sense of what I've written here. (That, or ignore me.) > > Thanks, > > -- > Raul > > > On Sun, Oct 27, 2013 at 10:04 AM, Pascal Jasmin <[email protected]> > wrote: > > maybe this seems a little more useful: > > > > ( > ;:'zero one two five one') (I { 'not found' ,~ [) > ;:'three one > four one five nine' > > not found > > one > > not found > > one > > five > > not found > > > > It was also my question whether I is the right approach to doing such > things, but it seems like boxing variable length strings makes i. i: and = > much more straightforward. > > > > > > > > ----- Original Message ----- > > From: Linda Alvord <[email protected]> > > To: [email protected] > > Cc: > > Sent: Sunday, October 27, 2013 2:13:16 AM > > Subject: Re: [Jprogramming] a more useful i. ? > > > > Is this useful or can it be done some other way more efficiently? > > > > x > > zero > > one > > two > > five > > one > > y > > three > > one > > four > > one > > five > > nine > > (x I y){y > > nine > > one > > nine > > one > > one > > nine > > > > Linda > > > > > > > > -----Original Message----- > > From: [email protected] > > [mailto:[email protected]] On Behalf Of Pascal > Jasmin > > Sent: Saturday, October 26, 2013 9:49 PM > > To: [email protected] > > Subject: Re: [Jprogramming] a more useful i. ? > > > > In this structure, > > > > 'aa',~'asdf',:'asd' > > > > how would you recommend finding the row (or first row) with 'aa ' in it, > > knowing only that 'aa' is what you are searching for? > > > > > > This works: > > 'aa' I~ 'aa',~'asdf',:'asd' > > 2 > > > > I guess that is what its for :) > > > > some timings though: > > > > a =. (<'aa') ,~ (? 1e5 $ 26) <@:$"0 1 (65+i.26) { a. NB. boxed > > > > > > 10 ts '(<''ABC'') i.~ a' > > > > 312499/sec 0.002304MB > > 10 ts '(<''ABD'') i.~ a' NB. not found 243.847/sec 0.002304MB > > 10 ts '(<''aa'') i.~ a' NB. last to find 206.336/sec 0.002304MB > > 10 ts '(<''ABC'') i:~ a' > > 416666/sec 0.002304MB > > > > a2 =. 'aa' ,~ (? 1e5 $ 26) $"0 1 (65+i.26) { a. NB. padded strings > unboxed > > > > > > 10 ts '(''ABC'') I~ a2' > > 99.3004/sec 6.29952MB > > 10 ts '(''ABD'') I~ a2' > > 99.7279/sec 6.29952MB > > 10 ts '(''aa'') I~ a2' > > 101.727/sec 6.29952MB > > > > > > > > ________________________________ > > From: Roger Hui <[email protected]> > > To: Programming forum <[email protected]> > > Sent: Wednesday, October 23, 2013 4:28:52 PM > > Subject: Re: [Jprogramming] a more useful i. ? > > > > > > It is much more efficient in time and space to eschew boxing within a > > column. > > > > > > > > On Wed, Oct 23, 2013 at 2:23 PM, Pascal Jasmin > > <[email protected]>wrote: > > > >> 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 > >> > > ---------------------------------------------------------------------- > > For information about J forums see 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 > > ---------------------------------------------------------------------- > > For information about J forums see 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 > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
