RosettaCodeData/Task/Long-year/CLU/long-year.clu

25 lines
550 B
Plaintext

% 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