Tcl Quine

A Quine [1] is a program that produces its code as output. Quines can be written in almost any language. Gary P. Thompson II has a large collection of quines [2] [3]


Below is a very simple to understand quine written in Tcl

 #! /usr/bin/env tclsh

 proc MySelf {} {
   puts {#! /usr/bin/env tclsh}
   puts {}
   puts -nonewline "proc MySelf {} {"
   puts -nonewline [info body MySelf]
   puts "}"
   puts ""
   puts "MySelf"
 }

 MySelf