quines—programming your way back to where you were

Post on 01-Jul-2015

66 Views

Category:

Science

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

My 2013-03-05 Riviera.rb quines talk slides. I'm afraid there's not much left without the speech and live demos. Quines are programs (or, more generally, concepts) that reproduce themselves. During this talk we explored how they were possible, what they could look like, how to generate them and how to generalize them,

TRANSCRIPT

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”

top related