Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
susam
on Jan 11, 2022
|
parent
|
context
|
favorite
| on:
Quines (Self-Replicating Programs)
Or as was posted to
https://news.ycombinator.com/item?id=29874052
by @jcalvinowens a few hours ago, we can also simplify this to just:
#!/bin/cat
Example:
$ echo '#!/bin/cat' > foo $ chmod +x foo $ cat foo #!/bin/cat $ ./foo #!/bin/cat
charcircuit
on Jan 11, 2022
[–]
or just an empty string for various languages
capableweb
on Jan 11, 2022
|
parent
[–]
Seems like that would only work for languages where the last returned value is printed as-is when running it. Other languages wouldn't print `""` but have no output instead.
drdeca
on Jan 11, 2022
|
root
|
parent
[–]
I think they meant that the program would be 0 bytes long, not two characters which are both quotation marks
capableweb
on Jan 11, 2022
|
root
|
parent
[–]
Ah, I see. Funny lateral thinking exercise I guess, not so interesting in terms of actually creating a Quine :)
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: