[comp.lang.pascal] A Classic Problem

cfogg@blake.acs.washington.edu (C.E. Fogg) (04/18/89)

A friend challenging Pascal would kindly appreciate any help on the
following problem. In his own words......:
------------------------------------------------------------------------

The problem is to write a PASCAL program whose output is the program.
You cannot use file manipulation.  The program itself is constrained
within the language.  If you have the solution to this problem worked
out, tell me how long it is.  (Only a single semicolon must appear
in a single line to count as a single line, excluding those in
writeln quotations.  That is, you cannot count:

   number : integer; truthfulness : boolean;

as a single line!  It counts as two.)

Additional note: If you have such a program, say in a file named
"self.pas", you can compile it, run it, redirecting your output
to a file named "self.out."  From there it should be possible to
compile "self.out" and run it without any differences or errors.

---------- [he restates...]
I guess I didn't make very clear the programming challenge.
It happens to be a 'classic' problem in computer science,
or so a reputed computer lecturer says.  To make things clear, the
following program is an ill-fated attempt to do this task:

   program (input, output);
   begin
      writeln ('program (input, output);';
      writeln ('begin');
      writeln ('   writeln ('....

and obviously from here the program breaks down.  The ide
is simple enough.  The program is surprisingly easy but
the length is the most difficult challenge.  My computing
skills won't allow me to make such a program in less than
25 lines (as defined in the previous message).  But that
program is currently the shortest offered by any of my
colleagues!
------------------------------------------------------------------------
Any takers?

Thanks,
CF 

Feel free to E-mail.
===========================================================================
E-mail address:              INTERNET,BITNET:cfogg@blake.acs.washington.edu
                        DECNET: MAX::CFOGG  UUCP:...uw-beaver!blake!cfogg
===========================================================================