6 ms·
Ken Thompson wrote in his famous paper [1] about quines: > If you have never done this, I urge you to try it on your own. The discovery of how to do it is a re
by whage 4y ago
Ken Thompson wrote in his famous paper [1] about quines:
> If you have never done this, I urge you to try it on your own. The discovery of how to do it is a revelation that far surpasses any benefit obtained by being told how to do it
Every once in a while I give them a try but I couldn't yet create one and it frustrates me very much. Afraid of being denied that "revelation" I never dared to read his paper past that point. I'm afraid I might never read it because of my ego.
1: https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_ReflectionsonTrustingTrust.pdf https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_Ref...
- 3pt14159 4y agoIt's easier in some languages than others. There is a delight in doing it, but don't overdo the anticipation. I've found greater delights in programming.
- behnamoh 4y ago> It's easier in some languages than others. Yes, it seems Lisp wouldn't be appropriate for this.
- moomin 4y agoI tried typing `1` into the REPL. Am I doing this right?
- tmtvl 4y agoI mean, isn't generating quines and twines one of the examples used to show of MiniKanren? William Byrds presentations of MK are absolutely delightful, by the way.
- kazinator 4y agoI believe that solution is possible for the Lisp-modified task description: Write a cyclic quine that reproduces itself through 128 Lisp languages because we easily have that many, or more.
- sixothree 4y agoLike refactoring someone else's code? So much fun.
- 3pt14159 4y agoYou're teasing, but I understand the question so I'll answer. I've had a good deal of joyous fun exploring quirky ideas with mathematics and software. It's old hat now, but back in 2011 I repurposed an algorithm primarily used for document classification by creating my own tokenization of features and stuffing it in there then running it through a ton of photographs, but forcing it to only 200 dimensions of freedom. Since the algorithm didn't have room to fully separate dimensions, it had to start grouping photos together along dimensions that had to account for multiple topics. I'll never forget bursting out laughing as I explored one particular dimension that was "motorcycles...... and photos of women taken from street level aimed at their scantily clad behinds." Collaborative filtering proved to me that some stereotypes really do have grounding in reality. As for the quine stuff? I actually had more fun repurposing[0] some of the ideas for a letter to my MP about the dangers of electronic voting back in 2011 when it seemed possible that Canada was going to allow it at the federal level. I chuckled more at literally sending self-eating code to a presumable less technical politician than I did at getting something to repeat itself. [0] https://github.com/zachaysan/darth_vader_wins_election https://github.com/zachaysan/darth_vader_wins_election
- emmelaich 4y agoYes, it's quite easy in sh: [update: same program also works in python and ruby]
- titzer 4y agoI hadn't written one until ~30 mins ago [1]. I cheated and looked at a Java quine (not particularly elegant, but easy to see what is going on.), but I wrote one for Virgil. Just think string substitution; a string with a hole in it and you substitute a copy of the string, quoted into the hole. Just one substitution suffices. [1] https://github.com/titzer/virgil/blob/master/apps/Quine/Quine.v3 https://github.com/titzer/virgil/blob/master/apps/Quine/Quin...
- thomasahle 4y agoYou should put SPOILER tags on that.
- _wldu 4y agoNice, this Go version satisfies gofmt: https://github.com/62726164/quine https://github.com/62726164/quine