The shortest quine (was Re: New meaning of the term "Sputnik")
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: The shortest quine (was Re: New meaning of the term "Sputnik")
- From: TNHarris <telliamed@...>
- Date: 2012年7月25日 17:44:12 -0400
On Wednesday, July 25, 2012 10:08:20 AM Jorge wrote:
>
> As a starting point, http://www.nyx.net/~gthompso/quine.htm
>
> -----------------------------------
> Language:Lua http://www.tecgraf.puc-rio.br/lua/
>
>
> Author:Roberto Ierusalimschy
>
> y = [[ print("y = [[" .. y .. "]]\ndostring(y)") ]]
> dostring(y)
> -----------------------------------
Nested strings and dostring aren't in Lua 5.2
y=[[print("y=[["..y.."]".."]load(y)()")]]load(y)()
Format %q makes it easy, but because of the name it comes out longer.
y="y=%qprint(string.format(y,y))"print(string.format(y,y))
Using only print,
y=[[print("y=[["..y.."]".."]",y)]] print("y=[["..y.."]".."]",y)
Note there's a tab before 'print', so 64 bytes.
--
tom <telliamed@whoopdedo.org>