Quines and Loons - self replicating programs

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

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

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

Only women need apply :smile:

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

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

Quines are awesome, and even more is:

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:

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).

3 Likes

Haha omg that quine relay is amazing! Very cool.

Also, here’s a super simple julia quine:

quine = "@show quine; println(quine)"
@show quine; println(quine)
11 Likes