I was a bit luckier than you Graham. The first time I saw the Solo Colon, its 
capabilities were being demonstrated to me and was told that it has to be the 
only character on that line, just like the closing parens ) should be the only 
character in the line to close a verb.

I never questioned it ... I'm a sheep that way. :P ;)


-----Original Message-----
From: programming-boun...@jsoftware.com 
[mailto:programming-boun...@jsoftware.com] On Behalf Of Graham Parkhouse
Sent: Tuesday, August 17, 2010 4:25 PM
To: programming@jsoftware.com
Subject: [Jprogramming] Solo colon

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
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to