Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
24
Task/Long-year/CLU/long-year.clu
Normal file
24
Task/Long-year/CLU/long-year.clu
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
% We can't hide one procedure inside another, but
|
||||
% we can hide the helper `p' in a cluster
|
||||
|
||||
longyear = cluster is test
|
||||
rep = null
|
||||
|
||||
p = proc (n: int) returns (int)
|
||||
return ((n + n/4 - n/100 + n/400) // 7)
|
||||
end p
|
||||
|
||||
test = proc (y: int) returns (bool)
|
||||
return (p(y)=4 | p(y-1)=3)
|
||||
end test
|
||||
end longyear
|
||||
|
||||
start_up = proc ()
|
||||
po: stream := stream$primary_output()
|
||||
|
||||
for i: int in int$from_to(2000, 2100) do
|
||||
if longyear$test(i) then
|
||||
stream$putl(po, int$unparse(i))
|
||||
end
|
||||
end
|
||||
end start_up
|
||||
Loading…
Add table
Add a link
Reference in a new issue