Jump to content

Calendar - for "REAL" programmers: Difference between revisions

J: add some docs
(J: remove "sneaky version" (wasn't 132 columns) and fix up text)
(J: add some docs)
Line 330:
E=: (|."0 1~ _2 <.@%~ +/ .(*./\.@:=)"1&' ')@:({."1) L
F=: 0 _1 }. 0 1 }. (2+[) E '[INSERT SNOOPY HERE]', ":@], D</lang>
 
B: given a year returns a number where numeric values within that year, mod 7, index the proper day names within a week.
 
M: given a year return a list of 12 numbers representing the number of days in each month
 
R: given a year, return 12 rows of 42 numbers, each row representing days of the month framed in a six week period which will be used to display that month (0 for days that are not part of that month)
 
H: text that will be the header for each month's block of days
 
C: A calendar of 12 months (in a flat list, each month is structured text but there's no higher level formatting)
 
D: given a number of characters (at least 20) and a year, gives the calendar arranged in rows that will best fill that character width without exceeding it.
 
L: given a textual table (fixed with character columns), left justify it
 
E: given a textual table and a width, center the text within that width (assuming it fits)
 
F: <code>width F year</code> gives us our formatted calendar
 
Here's an example calendar (the first line <code>132 F 1969</code> being the command that build this calendar):
6,962

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.