(4 years ago, I wrote: "I never considered myself a dc programmer. I tried it out and it was a piece of cake, so here we go - a few slices of that cake. Warning - this is probably the saddest area of my website!")
Actually, when I first tried it 4 years ago, I thought I was smart; however, I now know that to not be the case. In 2001, I finally made a dc breakthrough and all of my programs are shorter than they used to be!
Here I show you the evolution of my dc, so that maybe you can learn from the discoveries and tricks that I use!
I once saw someone with a .sig that was something like:
I'd first optimise that thusly:
That's still far too wasteful. I may be tempted to do:
But even that still is too wasteful. Instead I would do:
Until now, that is (now being 19/10/2001). This is what I'd do now:
I hope you'll agree I've achieved a reasonable character efficiency? If you can make something smaller, please let me know
Update - 2011-05-26:
-- Where Arzka is one Ari Saastamoinen[Arzka] Are you the guy behind fatphil.org? We discussed about DC and someone pointed your page, and it inspired me to optimize your WOODCHUCK... dc skripts. And you asked to tell you shorter solutions. My first try is 9 char shorter than yours [Arzka] dc -e'16i47BEE058EA81808CABC6058EA8191EFB80203240B1D50302C7540C8F7DC01011957DC047BEE040EAD05DE8[20-]sb[20~40+d40=bPd0<a]dsax3FPAP'
Update - 2013-07-16:
Oh dear - Ari missed a 1-character optimisation!
19/10/2001 was a good day - I managed to work out how to quine in dc!
Go into dc, and run that program!
It's fairly obvious how it works, so I'd be surprised if it had never been done before. However, it ain't yet on Gary P. Thompson II's list or Ben Olmstead's list. So I am fairly confident that I'm certainly not treading on too many toes by claiming it as mine. I will retract that claim as soon as anyone provides any evidence to the contrary, obviously.
Update 24/09/2004 - It appears that the above isn't entirely original. A very similar version was posted to a French newsgroup in 1999 by one David Madore, message ID email@example.com. He includes a newline in his, but the script doesn't require a newline, so mine is 4 characters shorter. I am entirely convinced that either these pages did not exist back in 2001, even though as can be seen the contents of the former predates that by 2 years, or that the search engines I used, google et al. really didn't do a very good job at all. (The fact that Ben and Gary weren't aware of the pages backs that up.)
Update 17/02/2009 - It appears I didn't include a new-lined
quine when really I ought to have done:
This is of course 1 character shorter than David Madore's (as I added
2 non-space characters and one newline to the above).
24/09/2004 was a wacky day - I decided that the dc quine which simply reproduces itself wasn't that useful in the real world as most people aren't running dc the whole time. What is obviously needed is the shell command line that uses dc to reproduce itself! This is different from the simply shell command line that reproduces itself, obviously. (I did this before finding out that the previous pure dc one was not entirely original, for reference)
dc -e'[[dc -e]P39P91PP93P[dx]P39PAP]dx'
And with that, I shall retire. No more quines for me, honest. Ever.
Update 31/07/2013 - with fewer numbers, and more letters, or with more numbers, and fewer letters:
dc -e'[[dc -e]P39dP91PrP93P[dx]PPAP]dx'
dc -e'[[dc -e]P10075PP93P[dx]P39PAP]dx'
Another hastily constructed page by Phil Carmody
Home / ob/obdc.html