Date post: | 01-Jul-2015 |
Category: |
Science |
Upload: | jean-baptiste-mazon |
View: | 64 times |
Download: | 0 times |
Programming your wayback to where you were
Riviera.rb5 March 2013
Jean-Baptiste Mazon@jbmazon
Introduction
● What● Cheats● Hacks● Language features
A quine is a computer program which takes no input and produces a copy of its own source code as its only output.
The standard terms for these programs in the computability theory and computer science literature are self-replicating programs, self-reproducing programs, and self-copying programs.
Well-known pattern
D
R
Y
Well-known pattern
Do
Repeat
Yourself
IOCCC 1994: smr
IOCCC 1994: smr
(categorized: Worst Abuse of the Rules)
The recursive aproach
(live demo)
ASCII quine
(live demo)
Generic quine
(but it's still ASCII-based)
(live demo)
A brief math digression
● Fixed-point theorem● Cool functions to fix
– print source
– interpret
– compile
– gzip source
Quines
Quines
Quines
Quine
Quine
● “Yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation.
Quine
● “Yields falsehood when preceded by its quotation” yields falsehood when preceded by its quotation.
● quine “hello”.→ hello “hello”.
Terminology
● code● data● intron
Bootstrapping
Multiquines
Examples
Examples
● (λx.xx) (λx.xx)
Examples
● (λx.xx) (λx.xx)● #!/bin/sh
cat $0
Examples
● (λx.xx) (λx.xx)● #!/bin/sh
cat $0● #!/bin/cat
Examples
● (λx.xx) (λx.xx)● #!/bin/sh
cat $0● #!/bin/cat● puts(s = <<e, s, 'e')
puts(s = <<e, s, 'e')e
Examples
● (λx.xx) (λx.xx)● #!/bin/sh
cat $0● #!/bin/cat● puts(s = <<e, s, 'e')
puts(s = <<e, s, 'e')e
● Q
Other examples
Final thoughts
● incompleteness● trusting trust● Quine Central● backup● introspection● anything else?
References
● Wikipedia● David Madore's quine page● C2● Russ Cox's “Zip Files All The Way Down”● Dan Piponi's “Quine Central”