The shape calculus that the interpreter 'knows' should include the type. You give a good rule for how zero frame is handled. There is no reason to require 5 +"1 s$0 to give the same result as 5 +"1 s$'a' ; at least none that justifies deviating from that rule, IMO.
Whatever shape calculus is built into the interpreter should match the rule. We could debate whether f 0 1$'a' should or should not match f 0 1$0, but surely it is much more important for +"1 and plus"1 to produce absolutely the same results. They almost do now, and if you follow your rule, they will completely. "It's not what the interpreter doesn't know that hurts you; it's what the interpreter knows that ain't so." -- traditional Henry Rich > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of R&S HUI > Sent: Wednesday, July 05, 2006 7:19 PM > To: Beta forum > Subject: Re: [Jbeta] Incorrect result shape from 5 +"1 (0 1 $' ') > > There are competing rationale for what the result of > 5+"1 (0 1$'a') should be. A pretty strong one is > the identity > > s -: $ 5 +"1 s$0 [ s=: 10 ? 100 > > So $ 5+"1 (0 1$' ') should be 0 1 , and it is the > other results that are "wrong". > > I say "wrong" because that is the best that the > interpreter can do. For an arbitrary verb (of which > plus=: 4 : 'x+y'"0 and plus=:+ are examples) the > interpreter can not figure out in general what the > shape of the result should be. > > The rule is something like this for a zero frame: > If the interpreter "knows" the shape calculus for a verb, > it applies it. If it does not, it applies the verb to a > cell of fills, and assumes that the shape of the result > is typical; and if in such application there is an error, > it assumes the result is an atom. And: what the interpreter > "knows" can expand from version to version. > > > > ----- Original Message ----- > From: Henry Rich <[EMAIL PROTECTED]> > Date: Tuesday, June 27, 2006 12:04 pm > Subject: RE: [Jbeta] Incorrect result shape from 5 +"1 (0 1 $' ') > > > plus =: + > > $ 5 plus"1 (0 1 $' ') > > 0 > > > > This works correcly too, so I guess integrated rank support > > in + is implicated. > > > > Henry Rich > > > > > -----Original Message----- > > > From: [EMAIL PROTECTED] > > > [EMAIL PROTECTED] On Behalf Of Henry Rich > > > Sent: Tuesday, June 27, 2006 2:56 PM > > > To: 'Beta forum' > > > Subject: [Jbeta] Incorrect result shape from 5 +"1 (0 1 $' ') > > > > > > The rules are not made explicit for what happens when a > > > verb fails when applied to a fill cell, but I have deduced > > > by experiment that the interpreter behaves as if the > > > failing result were a scalar numeric. Thus: > > > > > > plus =: 4 : 'x + y'"0 > > > $ 5 plus"1 (0 1 $' ') > > > 0 > > > > > > Correct: 5 +"1 (1 $ ' ') failed, so ($0) was used as the > > > result shape from the fill-cell, and that was extended with > > > the frame (,0) to give a final result shape of ,0 . > > > > > > $ 5 +"1 (0 1 $' ') > > > 0 1 > > > > > > Incorrect: should be the same result as above, but apparently > > > special code for the + verb did not take into account the > > > subtleties of fill-cell processing and assigned the result > > > to have the same shape as the array operand. > > > ---------------------------------------------------------------------- > For information about J forums see > http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
