Palindrome dates: Difference between revisions

Line 2,264:
2130-03-12
2140-04-12
</pre>
 
=={{header|RPL}}==
{{works with|Halcyon Calc|4.2.7}}
≪ DUP 100 MOD 4 400 IFTE MOD NOT ≫
‘LEAP?’ STO
≪ 100 + →STR 2 3 SUB ≫
‘→2STR’ STO
≪ STR→ → mm dd yy
≪ mm 1 ≥ mm 12 ≤ AND
IF DUP
THEN
{ 31 28 31 30 31 30 31 31 30 31 30 31 }
IF yy LEAP? THEN 2 29 PUT END
mm GET dd ≥ AND dd 1 ≥ AND
END
≫ ≫
‘DTOK?’ STO
≪ →STR → year
≪ year 4 DUP SUB year 3 DUP SUB + STR→
year 2 DUP SUB year 1 DUP SUB + STR→
IF DUP2 year DTOK?
THEN year "-" + ROT →2STR + "-" + SWAP →2STR +
ELSE DROP2 ""
END
≫ ≫
‘PALDT’ STO
 
≪ { } 2023
WHILE OVER SIZE 15 < REPEAT
DUP PALDT
IF DUP "" ≠ THEN ROT SWAP + SWAP ELSE DROP END
1 +
END
DROP
EVAL
{{out}}
<pre>
1: { "2030-03-02" "2040-04-02" "2050-05-02" "2060-06-02" "2070-07-02"
"2080-08-02" "2090-09-02" "2101-10-12" "2110-01-12" "2111-11-12"
"2120-02-12" "2121-12-12" "2130-03-12" "2140-04-12" "2150-05-12" }
</pre>
 
1,151

edits