mfashby.net

Website mfashby.net
git clone git://code.mfashby.net:/mfashby.net
Log | Files | Refs | Submodules | README

2022-10-09-quine.smd (937B)


      1 ---
      2 .title = "Quine",
      3 .author = "Martin Ashby",
      4 .date = @date("2022-10-09T13:11:52+01:00"),
      5 .layout = "single.shtml",
      6 .custom = {"comments": true},
      7 ---
      8 
      9 A [quine](https://en.wikipedia.org/wiki/Quine_%28computing%29) is a program that takes no input, and it's output is it's own source code. A quine-relay is a program that outputs the source code for another program, and when that next program is run it outputs the source code of the first program. I recently saw [this quine relay](https://github.com/mame/quine-relay) program which was super impressive as it goes through 128 languages like this! 
     10 
     11 Having recently learned some [Rust](https://www.rust-lang.org/), I thought I'd write a simple [quine in rust](https://code.mfashby.net/martin/rust-quine). It wasn't actually as difficult as I imagined, this took about 25 minutes. The rust standard library has a really convenient function `escape_default` which made it pretty easy!
     12