Jump to content

Calendar - for "REAL" programmers: Difference between revisions

m
{{out}}
m ({{out}})
Line 1:
{{task|Date and time}}
Provide an algorithm as per the [[Calendar]] task, except the entire code for the algorithm must be presented entirely without lowercase. Also - as per many 1969 era [[wp:line printer#Paper (forms) handling|line printer]]s - format the calendar to nicely fill a page that is 132 characters wide.
Also - as per many 1969 era [[wp:line printer#Paper (forms) handling|line printer]]s - format the calendar to nicely fill a page that is 132 characters wide.
 
(Hint: manually convert the code from the [[Calendar]] task to all UPPERCASE)
Line 17 ⟶ 18:
[[wp:GOST_10859#7-bit code: Cyrillic & Latin upper case letters|7-bit]] depending on how the file was opened... '''And''' one rogue Soviet university went further and built a [http://www.computer-museum.ru/english/setun.htm 1.5-bit] based computer.
 
Of course... as us [[wp:Baby-Boom Generation|Boomers]] have turned into [[wp:Geezer|Geezer]]s we have become [[wp:All_caps#Computing|HARD OF HEARING]], and suffer from chronic [[wp:Presbyopia|Presbyopia]], hence programming in UPPERCASE is less to do with computer architecture and more to do with practically. :-)
and suffer from chronic [[wp:Presbyopia|Presbyopia]], hence programming in UPPERCASE
is less to do with computer architecture and more to do with practically. :-)
 
For economy of size, do not actually include Snoopy generation in either the code or the output, instead just output a place-holder.
in either the code or the output, instead just output a place-holder.
 
FYI: a nice ASCII art file of Snoopy can be found at [http://www.textfiles.com/artscene/asciiart/cursepic.art textfiles.com]. Save with a .txt extension.
 
=={{header|Ada}}==
 
In Ada, the task is really easy, because Ada is case insensitive. I.e., one could simply replicate the code from [[Calendar#Ada|Ada solution of the calendar task]] and convert every lowercase character to uppercase. Instead of doing that, the implementation below reuses the package "PRINTABLE_CALENDAR" (same as "Printable_Calendar" or "printable_calendar") from [[Calendar#Ada|the calendar task]]:
Instead of doing that, the implementation below reuses the package "PRINTABLE_CALENDAR" (same as "Printable_Calendar" or "printable_calendar") from [[Calendar#Ada|the calendar task]]:
 
<lang Ada>WITH PRINTABLE_CALENDAR;
Line 48 ⟶ 54:
END REAL_CAL;</lang>
 
{{out}}
Output:
<pre> [SNOOPY]
 
Line 187 ⟶ 193:
PRINT CALENDAR(MANKIND STEPPED ON THE MOON, LINE PRINTER WIDTH)
'END'</lang>
{{out}}
Output:
<pre>
(INSERT SNOOPY HERE)
Line 266 ⟶ 272:
EXITAPP
RETURN</lang>
{{out}}
Outputs:<pre> 1969
 
JANUARY FEBRUARY MARCH
Line 354 ⟶ 361:
OTHERWISE = 31
ENDCASE</lang>
{{out}}
Output:
<pre>
[SNOOPY]
Line 786 ⟶ 793:
 
=={{header|Perl}}==
Since we can't use <code>eval</code> or <code>print</code> (or any other keywords) at the top level, we need to abuse backticks in order to print anything, as in [http://www.perlmonks.org/?node_id=43797 the infamous JAPH with no letters or numbers]. Consequently, the calendar is printed to standard error instead of standard output.
at the top level, we need to abuse backticks in order to print anything, as in [http://www.perlmonks.org/?node_id=43797 the infamous JAPH with no letters or numbers]. Consequently, the calendar is printed to standard error instead of standard output.
 
<lang perl>$PROGRAM = '\'
Line 860 ⟶ 868:
Then it can be executed with this command line:
<pre>$ pil -'load (list "awk" "{print tolower($0)}" "CALENDAR.L")'</pre>
{{out}}
Output:
<pre>====== 1969 ======
Jan 1 Wed
Line 1,008 ⟶ 1,016:
<br>it could be written without any Latin (or any language) letters of any kind for the REXX program's variables.
 
From the task's description, I took it to mean the program was to be in all uppercase, but the output was<br>
<br>still supposed to look pretty (that is, partly in lowercase). Even so, on the (line) printers that were used
Even so, on the (line) printers that were used <br>
<br>long ago, the printers (if not supporting lowercase), would print lowercase as uppercase (with the FOLD option).
long ago, the printers (if not supporting lowercase),
<br>long ago, the printers (if not supporting lowercase), would print lowercase as uppercase (with the FOLD option).
 
The other REXX program made use of lowercase letters for determining the minimum length of any of the options
the minimum length of any of the options<br>
<br>(from the command line), and a few simple tricks were used to accomplish this.
<br>[Note: the command line may also be all uppercase.]
 
In any case, both versions of the programs' output are identical (but the second REXX version sure as heck looks
(but the second REXX version sure as heck looks
<br>like it was beat with a big ole ugly stick ─── and pardon the strong language).
<lang rexx>/*REXX PROGRAM TO SHOW ANY YEAR'S (MONTHLY) CALENDAR (WITH/WITHOUT GRID)*/
Line 1,188 ⟶ 1,200:
TELL:SAY ARG(1);RETURN
UNGRID:RETURN TRANSLATE(ARG(1),,"│║─═┤┐└┴┬├┼┘┌╔╗╚╝╟╢╞╡╫╪╤╧╥╨╠╣")</lang>
'''output'''{{out}} when using the input of: <tt> 1/1/1969 (noGrid shortest narrowest) </tt>
<pre style="height:40ex">
«Snoopy "picture" here»
Line 1,535 ⟶ 1,547:
CALENDAR
</lang>
{{out}}
Output:
<pre>
(SNOOPY)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.