Calendar: Difference between revisions
Content added Content deleted
(→{{header|Tcl}}: Go into more depth in the complexities of the code) |
(revised/clarified task & added Template:Needs-review. Also updated the ALGOL 68 code to match. BTW: μέγας κῦδος to the Tcl code for the "octubre 1582" :Europe/Madrid es_ES calendar!!!) |
||
Line 1:
{{task|Date and time}}
Create a routine that will generate an
As a test case, target formatting the months of the year to fit nicely across the 80 character width page. Restrict number of lines in test output to 43.
Ideally the program will generate well formatted calendars for any page width from 20 characters up.▼
▲(Ideally the program will generate well formatted calendars for any page width from 20 characters up
Kudos (κῦδος) for routines that also correctly transition from Julian to Gregorian calendar in September 1752.
Line 9 ⟶ 11:
THE REAL PROGRAMMER'S NATURAL HABITAT
"Taped to the wall is a line-printer Snoopy calender for the year 1969."
For economy of size, do not actually include Snoopy generation in either the code or the output, instead just output a place-holder.
Line 121 ⟶ 123:
CO
INT mankind stepped on the moon = 1969,
line printer width =
print calendar(mankind stepped on the moon, line printer width)
)</lang>
Output:
<pre>
1 2 3 4
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
1 2 3 4 5
13 14 15 16 17 18 19
20 21 22 23 24 25 26
July August September
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 5 1 2 1 2 3 4 5 6
6 7 8 9 10 11 12 3 4 5 6 7 8 9 7 8 9 10 11 12 13
13 14 15 16 17 18 19 10 11 12 13 14 15 16 14 15 16 17 18 19 20
20 21 22 23 24 25 26 17 18 19 20 21 22 23 21 22 23 24 25 26 27
27 28 29 30 31 24 25 26 27 28 29 30 28 29 30
31
October November December
Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa
1 2 3 4 1 1 2 3 4 5 6
5 6 7 8 9 10 11 2 3 4 5 6 7 8 7 8 9 10 11 12 13
12 13 14 15 16 17 18 9 10 11 12 13 14 15 14 15 16 17 18 19 20
19 20 21 22 23 24 25 16 17 18 19 20 21 22 21 22 23 24 25 26 27
26 27 28 29 30 31 23 24 25 26 27 28 29 28 29 30 31
30
</pre>
=={{header|J}}==
{{Template:Needs-review}}
'''Solution:'''
<lang j>require 'dates format' NB. J6.x
Line 178 ⟶ 196:
=={{header|PicoLisp}}==
{{Template:Needs-review}}
This "calendar" is nicely formated, and fits into 20 columns ;-)
<lang PicoLisp>(de cal (Year)
Line 219 ⟶ 238:
=={{header|Python}}==
{{Template:Needs-review}}
The Python [http://docs.python.org/py3k/library/calendar.html calendar].pryear function prints calendars with the following formatting options: optional parameters w, l, and c are for date column width, lines per week, and number of spaces between month columns, respectively.
Line 261 ⟶ 281:
=={{header|Ruby}}==
{{Template:Needs-review}}
{{incomplete|Ruby|The width is always 130 characters. The program needs more code to adjust the calendar for different widths.}}
<lang ruby>require 'date'
|