Live data from Hacker News

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

github.com

11–20 of 63 posts

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

#14
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 bad as/g;s/3/ a son!Speak your mind!/g\\\\\\\\n#The Relay of Quine.\\\\\\\\n#Ajax, a man.\\\\\\\\n#Ford, a man.\\\\\\\\n#Act i: Quine.\\\\\\\\n#Scene i: Relay.\\\\\\\\n#[Enter Ajax and Ford]\\\\\\\\n#Ajax:\\\\\\\\n#\\\\\\\");function[]=f(s);for i=1:2:length(s),printf(\\\\\\\"2%s3\\\\\\\",part(dec2bin(hex2dec(part(s,i:i+1))),$:-1:2)),end;endfunction\\\\nf('[lots of hexdump]')\\\\nf('[lots of hexdump]')[snip]\\\\nprintf(\\\\\\\"\\\\\\\\n#[Exeunt]\\\\\\\");quit\\\")\");}"));}
...where `("object ... ;}")` part is a single string literal here. The actual quine stuff can be done in just one language at your choice, or can be assimilated into some other language where unquoting is a bit heavier. It is much easier than polyglots, where a single code should be interpreted in multiple languages.

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

#17
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…

In this video (where among the other things they explain huroboro), they show an example of code that prints out exactly the same output (itself) whether it's compiled/executed in c, python or ruby

https://youtu.be/6avJHaC3C2U?t=1957

Post reply on HN