Oops, Dan Bron already posted this earlier, which turns out to be his idiom. Is it recorded anywhere?
It is similar to odometer: http://www.jsoftware.com/jwiki/Essays/Odometer http://www.jsoftware.com/help/release/odom.htm #: i.@(*/) Improved http://www.jsoftware.com/help/phrases/numbers_counting.htm m33=: odometer=: #: i.@(*/) NB. All #s in radix y (odometer) --- Dan Bron <[EMAIL PROTECTED]> wrote: > Whenever I want a matrix of indicies I think first of the idiom (#:i.)@:$ . > So, in this case, > I would write something along the lines of: > > (+/@ #&,~ ] = (+/@#: i.)@ $) i. 3 4 > 6 --- Oleg Kobchenko <[EMAIL PROTECTED]> wrote: > Here's yet another successively "better" answer > working for any rank > > +/ , M * M = (+/@#: i.) $ M=. i.2 3 4 > 6 > > > 0j8 0":10 ts '+/ , M * M = +/&> {i.&.> $ M' [ M=. i.20 30 40 > 0.01522392 2194752 > 0j8 0":10 ts '+/ , M * M = (+/@#: i.) $ M' [ M=. i.20 30 40 > 0.01446958 428352 > > --- Roger Hui <[EMAIL PROTECTED]> wrote: > > > I might say: > > > > +/ , M * M = +/&> {i.&.> $M > > 6 > > > > If I were under pressure (e.g. with Dijkstra in the audience > > asking the question) and wanted to avoid any fumbling, > > I might say: > > > > +/ , M * M = (i.#M) +/ i.{:$M > > 6 > > > > And then from that to successively "better" answers > > +/ , M * M = (#M) +/&i. {:$M > > +/ , M * M = +/&i./ $M > > +/ , M * M = +/&> {i.&.> $M > > not forgetting to point out that the last expression > > works for M of any rank. > > > > Dijkstra's question in 1963 was: How would you represent a > > more complex operation, for example, the sum of all elements of > > a matrix which are equal to the sum of the corresponding row > > and column indices? > > > > > > > > ----- Original Message ----- > > From: Oleg Kobchenko <[EMAIL PROTECTED]> > > Date: Wednesday, November 7, 2007 17:00 > > Subject: Re: [Jchat] why did Dijkstra dislike APL so much? > > To: Chat forum <[email protected]> > > > > > What is the standard J answer? > > > > > > ((= +/@#&, [) +/&i./@$) i.3 4 > > > 6 > > > (+/@#~&, (= +/&i./@$)) i.3 4 > > > 6 > > > (+/@,@:* (= +/&i./@$)) i.3 4 > > > 6 > > > +/,M*M=+/&i./$ M =. i.3 4 > > > 6 > > > > > > > > > --- Roger Hui <[EMAIL PROTECTED]> wrote: > > > > > > > I don't know of any and I suspect Ken was too smart to respond. > > > > > > > > There was an encounter between KEI and Dijkstra recorded in > > > > http://keiapl.info/anec/#Dijkstra > > > > > > > > > > > > > > > > ----- Original Message ----- > > > > From: Richard Hill <[EMAIL PROTECTED]> > > > > Date: Wednesday, November 7, 2007 15:21 > > > > Subject: Re: [Jchat] why did Dijkstra dislike APL so much? > > > > To: Chat forum <[email protected]> > > > > > > > > > Is there any record, or even an anecdote, of KEI's > > > > > own response to Dijkstra's comment? > > > > > Richard Hill __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
