Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!ucbvax!SUN.COM!wmb From: wmb@SUN.COM Newsgroups: comp.lang.forth Subject: Re: Shortest selfreproducing Forth program Message-ID: <9001180238.AA28699@jade.berkeley.edu> Date: 17 Jan 90 22:24:07 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: Forth Interest Group International List Organization: The Internet Lines: 47 > That makes yours 13 chars to be completely self-reproducing when run, since > running it also generates the `ok'. I don't count the "ok" prompt as part of the output. > Are interactive input lines really programs? Sure, why not? Forth doesn't make a big distinction between interactive commands and programs, as do other languages. This is one of the great things about Forth, and it seems like fair game to be able to use it. Admittedly, however, whoever first posed this problem (it was floating around the net several years ago) probably wasn't thinking about Forth's incremental compilation model. > : de recursive ' de (see) ; > > which looks like it should work and doesn't? Several problems: 1) use ['] instead of ' 2) (see) is not standard Forth 3) The decompiler probably won't regenerate the "recursive" keyword On my system, you can get close with this technique: : de recursive ['] de (see) ; results in: : de ['] de (see) ; but, anyway, using the decompiler is not the right approach because of objection (2) There is probably some other way to solve this problem, but I haven't thought of it yet. Mitch