Questions tagged [quine]

A program that generates a copy of its own source text as its complete output (generally of interest in theory only).

A program that generates a copy of its own source text as its complete output. This is generally considered of interest in theory only; but highly self-contained programs ( for example) may be viewed as quine-like. Named after the logician Willard van Orman Quine

99 questions
2
votes
4 answers

Techniques to implement quines

A few years back I was thinking about ways to make a program that prints its own source code and I came up with these two approaches: the program prints the .c or .cpp file based upon the executable name (app1 prints app1.cpp). but this will fail…
c0da
  • 1,009
  • 3
  • 14
  • 28
2
votes
1 answer

Function that self destructs

I read some post where Hadley made a joke about a self destructing function. I thought this would be relatively simple to implement but turns out it's not. Here is an attempt to write a function named self_delete that is a quine and attempts to…
NelsonGon
  • 13,015
  • 7
  • 27
  • 57
2
votes
1 answer

Why does LET not play nice with EVAL in my quine?

I was trying to write a Common Lisp quine. I figured one of the simplest options was as follows: (let ((program '`(let ((program ',program ) (print (eval program))))) (print (eval program)))) This does not work, SBCL and CLISP…
Charlim
  • 521
  • 4
  • 12
2
votes
3 answers

Shortest non-null bash quine

The shortest bash quine is the null string: $ bash -c '' $ What is the shortest non-null bash script which produces its own source code as output?
Tom Hale
  • 40,825
  • 36
  • 187
  • 242
2
votes
2 answers

Does this code qualify as a Quine in Java?

Here's the code. It basically reads from the original code file and prints onto the terminal. import java.io.*; public class Quine { static void Quine() throws IOException { FileReader fr = new FileReader("C:/Quine.java"); …
Ronit Ray
  • 51
  • 2
2
votes
3 answers

Language features helpful for writing quines (self-printing programs)?

OK, for those who have never encountered the term, a quine is a "self-replicating" computer program. To be more specific, one which - upon execution - produces a copy of its own source code as its only output. The quines can, of course, be developed…
DVK
  • 126,886
  • 32
  • 213
  • 327
2
votes
0 answers

How can you formally prove that a specific quine is the shortest for its language?

I had come up with a Ruby quine: eval s=%q(puts"eval s=%q(#{s})") and claimed it to be the shortest, but a quine originally written for Perl by "Robin Houston" and ported to Ruby by "Sabby and Tabby": puts <<2*2,2 puts <<2*2,2 2 turned out to be…
henon
  • 2,022
  • 21
  • 23
2
votes
3 answers

How does this self outputting C program works?

here is the smallest code that output itself. But can't grasp how this works. can somebody explain? main(a){printf(a,34,a="main(a){printf(a,34,a=%c%s%c,34);}",34);}
Unbound
  • 243
  • 2
  • 12
2
votes
1 answer

Quine using reflection

Would it be possible to write a quine (a program whose output is itself) in Java using the Reflection API to access the quine's code and then print it out? Such a program would still print itself out accurately even when random lines that have no…
APerson
  • 8,140
  • 8
  • 35
  • 49
1
vote
2 answers

program to reproduce itself and be useful -- not a quine

I have a program which performs a useful task. Now I want to produce the plain-text source code when the compiled executable runs, in addition to performing the original task. This is not a quine, but is probably related. This capability would be…
Ben
  • 563
  • 1
  • 5
  • 12
1
vote
1 answer

What to do Quine McCluskey Minterm having zero

What to do zero minterm in Quine-McCluskey algorithm? e.g. Sigma (0,1,3) is the input Then do we have to ignore first zero minterm while finding prime implicants or we don't care about zero.? i.e. it's not included in output?
Muhammad Arslan Jamshaid
  • 1,077
  • 8
  • 27
  • 48
1
vote
1 answer

Is this possible to write a Quine in ook

According to this comment from the general question Is it possible to create a quine in every turing-complete language? it seems like it is said that it's possible. However I didn't find any Ook! Quine on the internet. Do you think that it's really…
Butanium
  • 726
  • 5
  • 19
1
vote
1 answer

Is that quine or what?

I have written simple decorator which prints the function passed to it (for example "foo"), and then I decorate it against itself. So finally it prints both written functions. I have read about quines recently and a little bit stuck with its a…
Michael Abyzov
  • 452
  • 1
  • 6
  • 16
1
vote
3 answers

How to write a quine program without main()

I went through all sorts of quine problems, but my task was to get a quine problem without main(), and loops are also forbidden. Without loop, it is easy, but I can't figure out how to write one without main(). Can anyone help me or provide me with…
1
vote
0 answers

On compilation of The Qlobe

I don't know ruby at all,but while reading some another blog I came across this beautiful piece of work The Qlobe. But I am a windows vista user and I don't have ruby installed in my system,but I am very much inquisitive to enjoy this…
Quixotic
  • 2,424
  • 7
  • 36
  • 58