avoiding fancy use of . which documentation can explain but is best understood use is "magic for matrices", but from documentation is a "fancy form of @"
lets start with core function
( 4 100 400"_ |/ ]) 1996
0 96 396
( 4 100 400"_ |/ ]) 2000
0 0 0
The "_ is unnecessary in this fork. Perhaps this was written before NVV was a thing? But "_ turns a noun into a verb with constant output.
For a single argument |/ is unnecessary. Just | works fine
( 4 100 400 |/ ]) 1996 2000
0 0
96 0
396 0
( 4 100 400 | ])("0) 1996 2000 NB. different shape than original function, but still get's "core results"
0 96 396
0 0 0
how can we combine your rules to get right answer from the individual constraints?
is any one residue 0, is a start.
(0 = 4 100 400 | ])("0) 1996 1997 2000
1 0 0
0 0 0
1 1 1
(0 ~:/@:= 4 100 400 | ])("0) 1996 1997 2000
1 0 1
~:/@: is maybe easier to understand than . version.
not equal inserted.
if not both 100 and 400 and then because 100 and 400 are both divisible by 4, result of 100&| ~: 400%&| not matching means if 4&| is = 0, then leap year,
This is very special logic related to 3 constraints, where all leap years have first criteria true, and not both other 2 criteria. I don't think this is a general field of research.
On Friday, October 10, 2025 at 06:09:24 p.m. EDT, 'Skip Cave' via forum <
fo...@jsoftware.com> wrote:
Rules for leap years.
1. If a year is divisible by 400, it is a leap year.
2. If a year is divisible by 100 but not by 400, it is not a leap year.
3. If a year is divisible by 4 but not by 100, it is a leap year.
4. If a year is not divisible by 4, it is not a leap year.
Here's the J verb to find leap years:
From:
https://code.jsoftware.com/wiki/JPhrases/DateTime
m11=: 0: ~:/ .= 4 100 400"_ |/ ]
How does this work?
What does the |/ .] do?
What does the "_ do?
What does the .= do?
What does the ~:/ do?
What does the 0: do?
Skip
Skip Cave
Cave Consulting LLC
To unsubscribe from this group and stop receiving emails from it, send an email to
forum+un...@jsoftware.com.