newsuser@LTH.Se (LTH network news server) (10/12/88)
Several examples of self-reproducing code has been given in this group lately. While running a definite risc of reminding people of what may be already generally known, I would like to submit the shortest solution of all. And not only the shortest, it will work in almost any language! The solution is: The only problem with this solution, the empty program, is that someone might argue that it is not a program at all. Still, I think it has a certain elegance to it. "Real Programmers aren't afraid of RISC architectures." -- Jan Eric Larsson janeric@Control.LTH.Se +46 46 108795 Department of Automatic Control Lund Institute of Technology "We watched the thermocouples dance to the Box 118, S-221 00 LUND, Sweden spirited tunes of a high frequency band."
STCS8004%IRUCCVAX.UCC.IE@MITVMA.MIT.EDU ("G.OULSNAM") (10/12/88)
My thanks to John Gateley for pointing out the erroneous claim regarding the normal order/applicative order evaluation of ((lambda (x) (x x) (lambda (x) (x x)). I'm sorry he chose not to examine the rest of the derivation, as it did not rely on the erroneous claim. For the record, what I now consider I should have written was: "Consider ((lambda (x) (x x)) (lambda (x) (x x))). With normal order evaluation this reproduces itself, but loops forever on attempting to evaluate the result. However, in Scheme the argument is evaluated to an internal procedure, say #<procedure>, which then loops forever trying to evaluate the first (x x) in the above expression, without reproducing the original form directly." The remark about Scheme applies to TI Scheme (v2), and can be checked by depositing extra code to see what is being passed around. My point was, and remains, that both normal order and applicative order (by-value in Scheme) cause the above to loop, but for different reasons. Normal order provided the idea for self-reproducing code, if one could first find a way to emulate normal order evaluation, and then find a way to stop evaluation of the result. The remainder of the article showed how. Gordon Oulsnam.