Code Monkey home page Code Monkey logo

quine's Introduction

Quine

In logic, Quine's paradox shows that a sentence that is not directly self-referential can nonetheless be paradoxical. In particular, this sentence asserts that the sentence itself is false:

“yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation.

In computing, a quine is a program that prints its own source code, usually by using the same trick as Quine's sentence. For example, this Scheme program is a quine:

((lambda (x) `(,x ',x))
'(lambda (x) `(,x ',x)))

Ken Thompson's Turing Award lecture is all about quines and computer security.

This Git repository holds the source code to some other quines. Most are direct uses of the quotation pattern, like the two above, but a few are worth additional notes.

Shell

qshell takes advantage of the Unix kernel to arrange the quotation. When the kernel is asked to run with a program beginning with #!, it instead runs the program named by the remainder of that line, with the name of the program file itself as an additional argument. The file qshell/quine is a single line:

#!/bin/cat

To run this program, the kernel would execute:

/bin/cat qshell/quine

which will in turn print the source code.

Zip

The qzip directory contains compressed archives that manage to write a quine using the DEFLATE compression method's bytecode programs. See Zip Files All The Way Down for details about how they were constructed.

quine's People

Contributors

rsc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.