Programming Corner from Icon Newsletter 8


November 30, 1981; Icon Version 5


There are relatively few responses to the request for self-reproducing Icon programs. although a number of self-reproducing programs in other languages were offered. Viktors Berstis pointed out that the self-reproducing SNOBOL4 program given in Newsletter 7 could be shortened and made more easily usable by replacing OUTPUT by PUNCH. He also suggested the following program:
PUNCH = REWIND(5) INPUT;END
This solution is certainly slower than the one given, although it is more of a "self-copying" program than a self-reproducing one, since it relies on facilities of the operating system (including the capacity to rewind the standard input file).

The shortest self-reproducing Icon program as supplied by Steve Wampler (an inside job):
procedure main();x:="write(\"procedure main();x:=\",image(x));write(x);end"
write("procedure main();x:=",image(x));write(x);end

Icon home page