Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site dartvax.UUCP Path: utzoo!linus!decvax!dartvax!alexc From: alexc@dartvax.UUCP (Alex Colvin) Newsgroups: net.sources Subject: re: Thompson's self-reproducing program Message-ID: <2357@dartvax.UUCP> Date: Tue, 28-Aug-84 09:10:31 EDT Article-I.D.: dartvax.2357 Posted: Tue Aug 28 09:10:31 1984 Date-Received: Thu, 30-Aug-84 10:34:42 EDT Organization: Dartmouth College Lines: 15 "What is the point of a self-duplicating program?" Well ... For one thing, you never have to keep the source code around. Seriously, it's mildly interesting as a bit-banging (character-banging) challenge to those who don't worry about the fixed-point combinator. For those who do, here's a different version in SCHEME (or, with slight syntax changes, in LISP). (labels (f (lambda () f)) f) This one simply returns itself -- not necessarily its source code. It gets printed by the read-eval-print loop. A C analogue is f() { return f; };