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

Reply via email to