I guess a possible explanation for the pattern 3 : 0'' is that the
conjunction : has a higher binding power so that the 3 : 0 part will be executed
first with or without the argument ''.
And execution of 3 : 0 will include lines up to the closing bracket. If there
happens to be an argument '' then the verb (which is the result of execution
of 3 : 0) will be executed.
Devon McCormick wrote:
Bill, Jeff -
I think Jeff was referring to the double-quote following the zero in " 3 : 0
'' ", not to the body of the function.
I'm not Grammar Boy (Dan?), but the use of an empty argument makes sense if
you think of it in terms of substitution.
That is, the following two lines can be combined to avoid naming the verb:
foo=: 3 : 'y'
foo ''
thusly
3 : 'y' ''
So, Bill's earlier example could also be written without the parens as
3 : 'y,y' 'abc'
abcabc
Or, even more confusingly, as
3 : 'y,y' 'y,y'
y,yy,y
Note that
'y,y' 'y,y'
|syntax error
| 'y,y''y,y'
whereas this pair separated by space is a single thing
3 2
3 2
So we can't give the argument to 6!:3 ("wait") unadorned:
6!:3 2
|rank error
| 6!:3 2
We have to break up "3 2", e.g.
6!:3 ] 2
2
(6!:3) 2
2
Bill probably wrote "(3 : 'y,y')" with the surrounding parens as a defensive
measure because of the way
this is sometimes necessary.
This is my way of thinking about it without resorting to formality. Maybe
Grammar Boy can come to the rescue here for those who prefer a more
theoretical framework.
Regards,
Devon
On 7/17/08, bill lam <[EMAIL PROTECTED]> wrote:
Jeff.Mosmann wrote:
experimentation. I am still not clear, though, how the syntax used in
jijs.ijs works, as in 3 : 0''
if. 0: ~: 4!:0 <'IFJIJX_j_' do. IFJIJX_j_=: 0 end.
)
where the '' seems to me to be syntactically in error. Or is this a
sounds it should be
if. 0 ~: 4!:0 <'IFJIJX_j_' do. IFJIJX_j_=: 0 end.
or
if. (0: ~: 4!:0) <'IFJIJX_j_' do. IFJIJX_j_=: 0 end.
regards,
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm