On 14 Aug 2006 at 12:10, Roger Hui said:

> Do you understand the following?
> 
> sum =: +/
> sum1=: +/"1
> 
> sum1 is defined to apply to the rank 1 cells of
> the argument.  Now:
> 
> foo=: 3 : 0
>  blah blah blah
> )
> 
> foo1=: 3 : 0 " 1
>  blah blah blah
> )
> 
> The pattern regarding rank is the same between 
> sum/sum1 and foo/foo1 .  What is different is
> that for (m : 0) , the lines of the object being
> defined are taken from the following lines,
> terminated by a ) on a line by itself.  It may be
> helpful to compare the above to the following:
> 
> sum=: +/
> sumEach=: +/&.>
> 
> foo=: 3 : 0
>  blah blah blah
> )
> 
> fooEach=: 3 : 0 &.>
>  blah blah blah
> )

OK, but given
  foo2 =. 3 : 'blah blah blah' "1 0
how is the novice to know that the construct with the : 0 form is not
  foo =: 3 : 0
  blah blah blah
  ) "1 0
?

"Terminated by ) on a line by itself" is a major clue, of course, but 
ISTM that an example somewhere obvious would be useful.

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to