Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics

Dashboard
Notifications
Mark all as read
Challenges

Obligatory Quine Challenge

+5
−0

Rules

Using your language of choice, golf a quine.

A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.

No cheating -- that means that you can't just read the source file and print it. Also, in many languages, an empty file is also a quine: that isn't considered a legit quine either.

Additionally, your quine may not consist of only one data section. This includes HTML programs without tags (thus only printing their source), and the Golfscript program 1.

Scoring

The shortest program in bytes wins. Trailing newlines must be counted if your program outputs one.

Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

5 comments

Might wanna change the name to something better, just sayin' Razetime‭ 2 months ago

"that means that you can't just read the source file and print it" Does JavaScript "toString()" count as reading the source file? Moshi‭ 2 months ago

I posted a PHP simplistic answer that was rejected based on a reference to SE rules. Can we get those rules (a) at a minimum linked inside this question (the only link is to a Wikipedia definition, which since Wikipedia can change beyond our control is not definitive) and (b) preferably spell out all the rules somewhere on Codidact (Meta to start, eventually a Help/FAQ page). And if that info. is already on Codidact, include a link here. manassehkatz‭ 2 months ago

I've asked a meta question regarding whether or not we should import the FAQ questions from SE, which includes a comprehensive definition of a valid quine. Lyxal‭ 2 months ago

I was also thinking of reposting the quine question, but you beat me to it. One thing that I was thinking of changing was to allow function submissions, which would let some answers be somewhat distinct from the old question. Jo King‭ 2 months ago

2 answers

+2
−0

Vyxal/Keg , 8 bytes

`:.,`:.,

Try it online! (Keg)

The explanations are the same for both languages, seeing as how Vyxal is heavily based on Keg.

Explained

`:.,`	# Push the string ":.,"
:.,	# Duplicate it, print it raw and then print it nice
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

+1
−0

Husk, 8 bytes

S+s"S+s"

Try it online!

Basically Leo's original quine.

It concatenates the string evaluated version of S+s to itself.

So: "S+s" + "\"S+s\"" gives the original code.

Why does this post require moderator attention?
You might want to add some details to your flag.

0 comments

Sign up to answer this question »

This community is part of the Codidact network. We have other communities too — take a look!

You can also join us in chat!

Want to advertise this community? Use our templates!