ashani
unread,Jan 26, 2011, 7:11:07 AM1/26/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts
Just as all languages have a documented quine (program that prints
itself), GO should also have his...This is the first quine written in
GO..Hope we will have more quines in GO..The output of the following
code snippet is the code snippet itself !! and in a formatted way..
package main
import (
"fmt"
)
func main() {
prelude := "package main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n
\tprelude := "
format := "%s%cpackage main%cn%cnimport (%cn%ct%c%cfmt%c%c%cn)%cn
%cnfunc main() {%cn%ctprelude := %c%c%cformat := %c%s%c%c
%cfmt.Printf(format, prelude, 34, 92, 92, 92, 92, 92, 34, 92, 34, 92,
92, 92, 92, 92, 34, 10, 9, 34, format, 34, 10, 9, 10, 10);%c}%c"
fmt.Printf(format, prelude, 34, 92, 92, 92, 92, 92, 34, 92, 34, 92,
92, 92, 92, 92, 34, 10, 9, 34, format, 34, 10, 9, 10, 10)
}