Quines and Loons - self replicating programs


#1

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
http://www.madore.org/~david/computers/quine.html

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


#2

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


#3

Only women need apply :smile:


#4

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


#5

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


#6

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