Find the last Sunday of each month: Difference between revisions
Content added Content deleted
m (→{{header|Factor}}: tweak whitespace) |
m (→{{header|Factor}}: align stack effects) |
||
Line 1,147: | Line 1,147: | ||
IN: rosetta-code.last-sunday |
IN: rosetta-code.last-sunday |
||
: parse-year ( -- ts |
: parse-year ( -- ts ) (command-line) second string>number <year> ; |
||
: print-last-sun ( ts -- |
: print-last-sun ( ts -- ) last-sunday-of-month (timestamp>ymd) nl ; |
||
: inc-month ( ts -- ts' ) 1 months time+ ; |
: inc-month ( ts -- ts' ) 1 months time+ ; |
||
: process-month ( ts -- ts' ) dup print-last-sun inc-month ; |
: process-month ( ts -- ts' ) dup print-last-sun inc-month ; |
||
: main ( |
: main ( -- ) parse-year 12 [ process-month ] times drop ; |
||
MAIN: main</lang> |
MAIN: main</lang> |