# Quines and Loons - self replicating programs

**URL:** https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607
**Category:** Offtopic
**Created:** [July 23, 2018, 2:28pm UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607 "2018-07-23T14:28:45Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [July 23, 2018, 2:28pm UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607/1 "2018-07-23T14:28:45Z")

</div>

At lunch I commented that the Scots use the work Quine for a woman which is similar to the Danish word Kvinde (I am working in denmark for a biotech company)  
A colleague pointed out that a Quine program is a self-replicating computer program

> **[Quines (self-replicating programs)](http://www.madore.org/~david/computers/quine.html)**
>
> Some thoughts and explanations about quines (self-printing computer programs) and related concepts

Surely with macros Julia ought to be able to produce its own code as output…

Far off topic, if anyone is interested in Doric Scots

> **[Word up: 20 of the best Doric terms](https://www.heraldscotland.com/news/13140464.word-20-best-doric-terms/)**
>
> But champions of Doric in the north-east have fought a doughty campaign to keep it alive, and today found support from local bus operator First…

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [July 23, 2018, 2:31pm UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607/2 "2018-07-23T14:31:18Z")

</div>

Beer may be on offer at JuliaCON for the most inventive Quine.  
Though maybe a category which does NOT use macros is necessary too.

---

<div class="post-metadata">

### Author: ![jandehaan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jandehaan/32/6805_2.png) [@jandehaan](https://discourse.julialang.org/u/jandehaan)
#### Post date: [July 23, 2018, 2:33pm UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607/3 "2018-07-23T14:33:25Z")

</div>

Only women need apply 😄

---

<div class="post-metadata">

### Author: ![johnh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/johnh/32/3615_2.png) [@johnh](https://discourse.julialang.org/u/johnh)
#### Post date: [July 23, 2018, 2:50pm UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607/4 "2018-07-23T14:50:52Z")

</div>

May I ask - what is the data structure which holds the Julia program itself?  
The answer is probably blindingly obvious, but not to me!

---

<div class="post-metadata">

### Author: ![avik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/avik/32/17_2.png) [@avik](https://discourse.julialang.org/u/avik)
#### Post date: [July 23, 2018, 5:48pm UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607/5 "2018-07-23T17:48:42Z")

</div>

[https://docs.julialang.org/en/v0.6.1/manual/metaprogramming/#Program-representation-1](https://docs.julialang.org/en/v0.6.1/manual/metaprogramming/#Program-representation-1)

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [July 23, 2018, 8:14pm UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607/6 "2018-07-23T20:14:08Z")

</div>

Quines are awesome, and even more is:

> **[GitHub - mame/quine-relay: An uroboros program with 100+ programming languages](https://github.com/mame/quine-relay)**
>
> An uroboros program with 100+ programming languages - GitHub - mame/quine-relay: An uroboros program with 100+ programming languages

> This is a Ruby program that generates Rust program that generates Scala program that generates …(through 128 languages in total)… REXX program that generates the original Ruby code again.

Julia is missing. Would make for an odd number, unless you have a candidate to throw out, for an even 128.

Also interesting is:

> **[Polyglot (computing)](https://en.wikipedia.org/wiki/Polyglot_(computing))**
>
> In computing, a polyglot is a computer program or script (or other file) written in a valid form of multiple programming languages or file formats. The name was coined by analogy to multilingualism. A polyglot file is composed by combining syntax from two or more different formats. 
> When the file formats are to be compiled or interpreted as source code, the file can be said to be a polyglot program, though file formats and source code syntax are both fundamentally streams of bytes, and exploit...

e.g. there “A polyglot in 185 different languages”. [This however includes Julia (unspecified version) as language 17.]

I have a practical use for a polyglot if you can make one for Julia, plus Unix shell (probably bash) AND some Windows shell (I guess Powershell, or older cmd).

> **[Multilingualism](https://en.wikipedia.org/wiki/Polyglotism#Polyglot_savant_syndrome)**
>
> Multilingualism is the use of more than one language, either by an individual speaker or by a group of speakers. It is believed that multilingual speakers outnumber monolingual speakers in the world's population. More than half of all Europeans claim to speak at least one language other than their mother tongue; but many read and write in one language. Multilingualism is advantageous for people wanting to participate in trade, globalization and cultural openness. Owing to the ease of Multiling...

---

<div class="post-metadata">

### Author: ![NHDaly](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nhdaly/32/1413_2.png) [@NHDaly](https://discourse.julialang.org/u/NHDaly)
#### Post date: [March 13, 2019, 3:23am UTC](https://discourse.julialang.org/t/quines-and-loons-self-replicating-programs/12607/7 "2019-03-13T03:23:02Z")

</div>

Haha omg that quine relay is amazing! Very cool.

Also, here’s a super simple julia quine:

```julia
quine = "@show quine; println(quine)"
@show quine; println(quine)

```
