A single digit followed by a colon is a _constant verb_, which always
produces the same result no matter its operand. For example:
f=. 2:
f 5
2
f 7 7
2
3 f 'a'
2
So, '2: * i.' is a V V V fork, whereas '2 * i.' is an N V V fork. I guess
that the latter were not yet implemented when that entry of the phrasebook
was written.
FWIW the functions are documented in NuVoc; the entry link is titled '_9:
to 9:; Constant Functions', and can be read at
https://code.jsoftware.com/wiki/Vocabulary/zeroco
There is also a dictionary entry:
https://www.jsoftware.com/help/dictionary/dconsf.htm
-E
On Tue, 19 Oct 2021, Jon Quant wrote:
Hi all,
The J phrases book has simple uses of colon which I can't find in the NuVoc
grammar.
Could someone help explain the grammar of the following?
Verb trains:
even=: 2: * i.
odd=: 1: + 2: * i.
These seem to work without the colons anyway. What is the grammar rule and
purpose for an integer followed by a colon?
Great fun so far with J!
Thanks
Jon
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm