Live data from Hacker News

A Ruby program that generates itself through a 128-language quine loop

github.com

21–30 of 63 posts

Re: A Ruby program that generates itself through a 128-language quine loop

#21
post #9

Many programmers complain that they can't complete a hello world example in one or more of the languages featured here because they're too difficult. This guy demonstrated enough understanding of 128 of them to make this work. Is the difference in competence really so big between us?

While this is amazing, I should point out that for most languages he only needs to understand enough syntax to print strings and possibly unquote them. If you actually run this program into the first language, Ruby, the actual code (meant to be a Rust code) is as follows: fn main(){print!("{}",("object QR extends App{print(\"(display \\\"printf(\\\\\\\"1d;s/.//;s/1/ the sum of a son and0/g;s/0/ twice/g;s/2/You are as…

Printing and unquoting strings is enough to write an ordinary quine (although getting it exactly right is still quite subtle).

Making a quine relay is substantially more complicated, because you don't just print the quoted string, you have to print the quoted version of a string in a different language, but that unwraps to the same thing 128 applications later!

If you still think it's easy, I reckon you should write us a quine relay of just 3 languages and then explain how simple it is.

Re: A Ruby program that generates itself through a 128-language quine loop

#24

I am amazed. I have no idea how the hell could the author even do that. Apparently, they have a book called "The world of obfuscated, esoteric, artistic programming", but it seems to be written in Japanese. I hope it will be translated to English someday, so I may learn this dark sorcery.

No post body was provided.

Re: A Ruby program that generates itself through a 128-language quine loop

#25
Ken Thompson wrote in his famous paper [1] about quines:

> If you have never done this, I urge you to try it on your own. The discovery of how to do it is a revelation that far surpasses any benefit obtained by being told how to do it

Every once in a while I give them a try but I couldn't yet create one and it frustrates me very much. Afraid of being denied that "revelation" I never dared to read his paper past that point. I'm afraid I might never read it because of my ego.

1: https://www.cs.cmu.edu/~rdriley/487/papers/Thompson_1984_Ref...

Re: A Ruby program that generates itself through a 128-language quine loop

#26

Earlier quoted context omitted.

While this is amazing, I should point out that for most languages he only needs to understand enough syntax to print strings and possibly unquote them. If you actually run this program into the first language, Ruby, the actual code (meant to be a Rust code) is as follows: fn main(){print!("{}",("object QR extends App{print(\"(display \\\"printf(\\\\\\\"1d;s/.//;s/1/ the sum of a son and0/g;s/0/ twice/g;s/2/You are as…

Printing and unquoting strings is enough to write an ordinary quine (although getting it exactly right is still quite subtle). Making a quine relay is substantially more complicated, because you don't just print the quoted string, you have to print the quoted version of a string in a different language, but that unwraps to the same thing 128 applications later! If you still think it's easy, I reckon you should write…

He didn't say it was easy at all, he simply pointed out that the required knowledge of each language is a subset of the total available functionality of each language.

Re: A Ruby program that generates itself through a 128-language quine loop

#27
post #25

Ken Thompson wrote in his famous paper [1] about quines: > If you have never done this, I urge you to try it on your own. The discovery of how to do it is a revelation that far surpasses any benefit obtained by being told how to do it Every once in a while I give them a try but I couldn't yet create one and it frustrates me very much. Afraid of being denied that "revelation" I never dared to read his paper past that…

It's easier in some languages than others.

There is a delight in doing it, but don't overdo the anticipation. I've found greater delights in programming.

Re: A Ruby program that generates itself through a 128-language quine loop

#28
post #25

Ken Thompson wrote in his famous paper [1] about quines: > If you have never done this, I urge you to try it on your own. The discovery of how to do it is a revelation that far surpasses any benefit obtained by being told how to do it Every once in a while I give them a try but I couldn't yet create one and it frustrates me very much. Afraid of being denied that "revelation" I never dared to read his paper past that…

It's easier in some languages than others. There is a delight in doing it, but don't overdo the anticipation. I've found greater delights in programming.

> It's easier in some languages than others.

Yes, it seems Lisp wouldn't be appropriate for this.

Re: A Ruby program that generates itself through a 128-language quine loop

#30
post #25

Ken Thompson wrote in his famous paper [1] about quines: > If you have never done this, I urge you to try it on your own. The discovery of how to do it is a revelation that far surpasses any benefit obtained by being told how to do it Every once in a while I give them a try but I couldn't yet create one and it frustrates me very much. Afraid of being denied that "revelation" I never dared to read his paper past that…

I hadn't written one until ~30 mins ago [1]. I cheated and looked at a Java quine (not particularly elegant, but easy to see what is going on.), but I wrote one for Virgil. Just think string substitution; a string with a hole in it and you substitute a copy of the string, quoted into the hole. Just one substitution suffices.

[1] https://github.com/titzer/virgil/blob/master/apps/Quine/Quin...

Post reply on HN