Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!seismo!mcvax!ukc!stc!praxis!kees From: kees@praxis.UUCP Newsgroups: comp.misc,comp.lang.prolog Subject: Re: self-reproducing programs Message-ID: <514@newton.praxis.co.uk> Date: Tue, 28-Apr-87 09:25:24 EDT Article-I.D.: newton.514 Posted: Tue Apr 28 09:25:24 1987 Date-Received: Fri, 1-May-87 06:53:55 EDT References: <3248@bigburd.PRC.Unisys.COM> Reply-To: kees@praxis.co.uk.UUCP (Kees Goossens) Organization: Praxis Systems plc, Bath, UK Lines: 30 Keywords: fixedpoint Xref: utgpu comp.misc:450 comp.lang.prolog:200 In article <3248@bigburd.PRC.Unisys.COM> lang@bigburd.PRC.Unisys.COM (Michel Lang) writes: > > ... self-reproducing programs ... > Some time ago there were some self rep palindromic C programs in comp.lang.c (or whatever it's called). Anyway, here are some things to start with: BASIC: (without line number but that's easy enough) a$="a$=:print(left$(a$,3)+chr$(34)+a$+chr$(34)+right$(a$,4))":print(left$(a$,3)+chr$(34)+a$+chr$(34)+right$(a$,4)) Interpreted BASIC: 10 LIST 10 Algol68: ([]CHARs="([]CHARs="";print(2*s[:10]+2*s[10:]))";print(2*s[:10]+2*s[10:])) BASIC: (self rep palindromic program) 1 ')$a(tnirp:tnirp:txen:;))1,i,$a($dim(tnirp:701ot1=irof:)4,$a($thgir+)43($rhc+$a+)43($rhc+)6,$a($tfel=$a:"1 ')$a(tnirp:tnirp:txen:;))1,i,$a($dim(tnirp:701ot1=irof:)4,$a($thgir+)43($rhc+$a+)43($rhc+)6,$a($tfel=$a 2"=$a 2 2 a$="2 a$=left$(a$,6)+chr$(34)+a$+chr$(34)+right$(a$,4):fori=1to107:print(mid$(a$,i,1));:next:print:print(a$)' 1":a$=left$(a$,6)+chr$(34)+a$+chr$(34)+right$(a$,4):fori=1to107:print(mid$(a$,i,1));:next:print:print(a$)' 1 I haven't tested the last one yet so there may be inaccuracies. The idea certainly is correct. Kees -- ---------------------------------+--------------------------------------------- Kees (Dutch Courage) Goossens | "En nu lieve kijkbuis kinderen: Oogjes dicht kees@praxis.uucp or: | en snaveltjes toe. Slaap lekker!" ...!seismo!mcvax!ukc!praxis!kees | -- Meneer de Uil.