# Christmas quine!

In the language of your choice, write a program that is arranged in the shape of a Christmas tree that prints itself in the same shape.

What is not allowed:

• Printing out the source file
• Code that is nothing but statements that get echoed by an interpreter by virtue of them being literals (eg just using a tree-shaped tower of lists in python)
• "Printing out the source file" is not allowed, but is reading source code (not from file) and printing it allowed? If it is not, then this is practically impossible with Befunge. :/ – Justin Dec 19 '13 at 6:49

## JavaScript

The 'star' might be a bit too large for the tree...

        (function _()
{return('        (')
+(''+''+''+''+'')
+_+
')()'
;'We w'
+'wis'+0+
'h you a '
+0+'merry Ch'
+'ristmas, '+0+
+'we '+0+'wish y'
+0+'ou a merry Chr'
+'istmas, we w'+0+'i'
+0+'sh you '+0+'a merr'
+'y Christmas and a h'+0+
+'appy'+0+'new year! Ho ho'
+0+' ho! Merry '+0+'Christma'
+'s!'
})()


The zeroes are baubles and look best in the editor:

• Nice trick with the baubles! – Manishearth Dec 19 '13 at 17:29
• I love the inclusion of "We wish you a merry Christmas!" – Iszi Dec 19 '13 at 17:46

# Ruby

You never said we couldn't use network access... :D

        #
s="
open(
'http:/
/pastebin
.com/raw.ph
p?i=mGzbahp5'
s.gsub! /\s/,'');
puts(
s+'')


Outputs itself verbatim.

Yes, I could have used a URL shortener, but that would have made it less obvious and amusing :P Also I needed something to take up space; otherwise the tree would be tiny.

Execute like this:

ruby -ropen-uri christmasquine.rb

• In my mind you cheated, but you're right about the rules. Outsmarted by a doorknob. Anyway, here's your upvote, for making me smile :) – Manishearth Dec 19 '13 at 14:52
• @Manishearth Yep, we bend the rules a lot here! Part of the fun. :P (Ex. 0 character quines, etc) – Doorknob Dec 19 '13 at 15:45
• @Manishearth Yeah, what Doorknob said. If you don't want a rule bent, you need to include a rule against bending that rule. Hence why the latest "reverse quine" and "mirror quine" challenges had rules against palindromes and quines shorter than 2 characters. – Iszi Dec 19 '13 at 17:59

# perl

#!/usr/bin/perl
$_=<<'the source';eval$_;

#
#*#
print
"#!/u".
"sr/bin".
"/perl \n".
"$_=<<'the". " source';eva". "l$_;\n${_}th". "e source\n";# Mery #Christmas to all !!! ### ### #*# the source  Here's a tiny one in GolfScript:  { ".~ "2/~\ +@@2$*}.
~


Note that the code above includes two space characters at the end of the second line from the top; those spaces are essential for correct operation. Also, the code should be saved using Unix-style (LF) linefeeds, not Windows-style CR+LF.

Here's a slightly bigger (and less whitespace-sensitive) one, including a festive message:

     {
" "
MERRY
5*n\+\n
CHRISTMAS
".~"+2\$*1>}
.
~


A mildly interesting feature is that the words MERRY and CHRISTMAS are not string literals, although they are no-ops, and are copied to the output along with the code block surrounding them.