I also often use these two even & odd verbs to extract even or odd integers from a list:
ev=.]#~0=2|] od=.]#~2|] ]n=.?15#20 12 6 18 1 7 6 1 12 5 18 5 8 13 16 15 ev n 12 6 18 6 12 18 8 16 od n 1 7 1 5 5 13 15 Skip Cave Cave Consulting LLC On Tue, Oct 19, 2021 at 2:33 AM Jon Quant <[email protected]> wrote: > Thanks Elijah, > > That's amazing, such a clear explanation! > Links and N V V update much appreciated. > > Thanks again > Jon > > On Tue, 19 Oct 2021 at 08:14, Elijah Stone <[email protected]> wrote: > > > 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 > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
