The same thing will "gotcha" if you add a comment on the same line as the
solo closing paren at the end of a definition, e.g.

worksOK=: 3 : 0
   foo y
)

NotOK=: 3 : 0
   foo y
)         NB. This comment messes
NB. things up - this function not yet closed.
)
   NB. But now it is.
NB. However, the definition of NotOK is invalid:
   foo=: -
   NotOK 3
|syntax error: NotOK
|   )


On Tue, Aug 17, 2010 at 4:25 AM, Graham Parkhouse <
graham.parkho...@ntlworld.com> wrote:

> Both JfC and LJ mention a 'solo colon' separating the monadic from the
> dyadic cases of an explicit verb. Unaware of this, I got caught out
> recently
> by adding a comment after the colon. J doesn't like it!
>
>   foo=: 3 : 0
> -y
> :
> x-y
> )
>   foo 3
> _3
>   5 foo 3
> 2
>
> 0K! But ...
>
>   foo=: 3 : 0
> -y
> :    NB. No comments allowed on this line!
> x-y
> )
>
>   foo 3
> |value error: x
> |       x-y
>   5 foo 3
> |domain error: foo
> |   5     foo 3
>
> It appears that the colon should be oh so solo!
>
> Regards
>
> Graham
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to