Two programs

60 views
Skip to first unread message

ais523

unread,
Mar 13, 2006, 10:48:19 AM3/13/06
to
I have discovered something else that INTERCAL seems to do better than
most other languages (besides bit-reversing numbers). The following C
program:
#include <stdio.h>
int main()
{
printf("%d\n",(int)(90-(-4.5//**/
-4.5)));
return 0;
}
is considerably longer and less clear (!) than the following program:
DO .1 <- #1$#0
DO READ OUT .1
PLEASE GIVE UP
The fact that the two programs produce different output is irrelevant.
However, if you consider the unusual comment in the C program, and the
fact I didn't specify whether the other program was INTERCAL or
Tri-INTERCAL, the correspondence between the two programs should become
clearer.

OK, so maybe I'm cheating.

Simon Richard Clarkstone

unread,
Mar 13, 2006, 12:55:32 PM3/13/06
to
ais523 wrote:

Heh, clever.

For those of you that haven't worked it out: The C program gives 89 in
C89 and 99 in C99. The INTERCAL program gives the base (TWO to SEVEN).

IMHO, the printf call should be:
> printf("C%d\n",(int)(90-(-4.5//**/
> -4.5)));

Note the extra "C".
--
Simon Richard Clarkstone: s.r.cl?rkst?n?@durham.ac.uk/s?m?n.cl?rkst?n?@
hotmail.com ### "I have a spelling chequer / it came with my PC /
it plainly marks for my revue / Mistake's I cannot sea" ...
by: John Brophy (at: http://www.cfwf.ca/farmj/fjjun96/)

Brian Raiter

unread,
Mar 13, 2006, 10:24:59 PM3/13/06
to
> DO .1 <- #1$#0
> DO READ OUT .1
> PLEASE GIVE UP

That's a lovely little program.

b

Reply all
Reply to author
Forward
0 new messages