Tuesday, October 31 2006 @ 09:46 AM EST Contributed by: jknapka Views: 384
I had a very interesting experience last night: just for the hell of it, I decided to try writing a quine (http://en.wikipedia.org/wiki/Quine) in Scheme. It took just a few minutes for me to think of a reasonable approach, and it worked the first time under DrScheme (http://www.plt-scheme.org/):
This week I've engaged in a silly thread about quining on comp.lang.forth (archived here http://groups.google.com/group/comp.lang.forth/browse_thread/thread/ba6fe1a735c3dca6/8bee19a004b7cbcd#8bee19a004b7cbcd), in which I argue pointlessly with another poster about the exact definition of "quine". I think what bothers my correspondent about my "context-specific" quines is that it is the context, rather than the quine itself, which contains the knowledge about how to reproduce the quine's source. My position was that that is true of all quines, to the extent that they depend on external tools (such as a runtime library) in order to run. However, in a "context-specific" quine, the self-referentiality is trivial, since it is built in to the runtime environment. The Scheme quine above does not share that characteristic, although it's hard to see exactly where the dividing line is.