Last Friday of each month: Difference between revisions
Content added Content deleted
No edit summary |
m (→{{header|zkl}}: move Category to top) |
||
Line 1,799: | Line 1,799: | ||
} |
} |
||
lastDay(2012,D.Friday)</lang> |
lastDay(2012,D.Friday)</lang> |
||
For each month in year y, count back from the last day in the month |
|||
For each month in year y, count back from the last day in the month until a Friday is found and print that date. A pump is a loop over a sequence and Void.Stop stops the pump with a value. The first parameter to a pump is the sink. All the imperative loop constructs are available but I didn't feel like using them. A wrap is a function closure over unknown values in the function, necessary because functions are not lexically scoped. |
|||
until a Friday is found and print that date. |
|||
A pump is a loop over a sequence and Void.Stop stops the pump with a value. |
|||
The first parameter to a pump is the sink. |
|||
All the imperative loop constructs are available but I didn't feel like using them. |
|||
A wrap is a function closure over unknown values in the function, |
|||
necessary because functions are not lexically scoped. |
|||
{{out}} |
{{out}} |
||
<pre> |
<pre> |
||
Line 1,815: | Line 1,821: | ||
2012-12-28 |
2012-12-28 |
||
</pre> |
</pre> |
||
[[Category:Date and time]] |