Quine using strings?

Nestor via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jan 15 11:43:22 PST 2017


I was reading some of the examples of writing a quine with D, but 
apparently the language has evolved and they no longer compiled 
unchanged.

So I tried to program one by myself using strings and std.stdio, 
but the result seems long and redundant:

import std.stdio;void main(){string s=`import std.stdio;void 
main(){string 
s=writefln("%s\x60%s\x60;s",s[0..38],s,s[38..$]);}`;writefln("%s\x60%s\x60;%s",s[0..38],s,s[38..$]);}

Any ideas for a shorter version (preferably without using 
pointers)?


More information about the Digitalmars-d-learn mailing list