Long year: Difference between revisions
Content deleted Content added
→{{header|Terraform}}: single-quotes are not legal string delimiters (anymore? were they ever?) |
Not a robot (talk | contribs) Add CLU |
||
Line 577: | Line 577: | ||
(2004 2009 2015 2020 2026 2032 2037 2043 2048 2054 2060 2065 2071 2076 2082 2088 2093 2099) |
(2004 2009 2015 2020 2026 2032 2037 2043 2048 2054 2060 2065 2071 2076 2082 2088 2093 2099) |
||
</pre> |
</pre> |
||
=={{header|CLU}}== |
|||
<lang clu>% 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</lang> |
|||
{{out}} |
|||
<pre>2004 |
|||
2009 |
|||
2015 |
|||
2020 |
|||
2026 |
|||
2032 |
|||
2037 |
|||
2043 |
|||
2048 |
|||
2054 |
|||
2060 |
|||
2065 |
|||
2071 |
|||
2076 |
|||
2082 |
|||
2088 |
|||
2093 |
|||
2099</pre> |
|||
=={{header|Commodore BASIC}}== |
=={{header|Commodore BASIC}}== |