Christmas poem since 1988
Anonymous Monk
created: 2005-12-23 12:21:23

This is my Merry Christmas contribution for all of you. First I wanted to post it to the poetry section. It is our beloved Christmas poem since 1988. If you have problems copy-pasting it, download it directly.

Trivia: run this program in three (3) different programming languages, and get three slightly different output!

#include 
#define q char w=0,v[]=
q("@n'+,#'/*{}w+/w#cdnr/+,{}r/*de}+,/*{*+,/w{%+,/w#q#n+,/#{l,+,/n{n+,/+#n+"
",/#;#q#n+,/+k#;*+,/'r :'d*'3,}{w+K w'K:'+}e#';dq#'l q#'+d'K#!/+k#;q#'r}eK"
"K#}w'r}eKK{nl]'/#;#q#n'>{>#}w'>{>{nl]'/+#n';d}rw' i;# >{nl]!/n{n#'; r{#w'"
"r nc{nl]'/#{l,+'K {rw' iK{;[{nl]'/w#q#n'wk nw' iwk{KK{nl]!/w{%'l##w#' i; "
":{nl]'/*{q#'ld;r'}{nlwb!/*de}'c ;;{nl'-{}rw]'/+,}##'*}#nc,',#nw]'/+kd'+e}"
"+;#'rdq#w! nr'/ '> }+}{rl#'{n' '># }'+}##-[w]*%n+r3#l"
#define mysweetdiego ",{}:\nuwloca-O;m .vpbks,fxntdCeghiry"),a+1);}int main
#define cmp(s) (int t,char**_){struct w{int v;};if(sizeof(w)>1){v[111]='d';
#define cos(u) (137)v[112]='n',v[113]=';',v[114]=':';}return!f(t,_?0:0,0);}
dducfirstde lt s ici length mysweetdiego cmp(s ror study biconverge and s l
lleg and s fd fdo do reverse foo xor s go dog chr reverse ord srand hyperge
and s eselcfirstexesee)if cos(s e e q dISWcJyccBWXJKcjBTocVUFEYcCUJWcDooYLW
cWLoUccIEYVcTNTVLPyTcoPooQVXcLcRooVEYmTTTNTcLPREcocWoPYCcnQFKHCocEhcVMcooQt
ctUPcAWWKroCoBLcPcLcAlUToCbcWoTLVYNoREcLcToctYzoooTcoKocMcUTCKJoCDUUocVMURI
gMLSahOXDTcococaAQAoCKBcQoocozfkIITnPikugLocvccCoBGYiTTPcXcoimVuIDfavHlKHVX
cokTPUooKgUYVoXVVxSjIAPmKUNbuocoPcBcYXUcVPkcoTcocVbPHoQTUOGxufBooTcmBFoVKPY
loFcccXcoDmcvIOMMDOGmSBQovoTTBolPycPAoVVnKUIItTwBnYroocTTVccoKCcVoKlocrIrCf
SBzgCocDJQRcccoVVzcQCUBxpioOLMsYZYucYoTTjWCoVoYHPTcBbxjoriLxGkaQcccycccLTTl
UcNTBocoVUtuINkOxXCGOYvccJcCcUoobccLYroTcJtoooTtococzoEngovuncDNgooctcoOLXV
mVmZoTCETcYoARclVQBTVoQoLcYHVcmkjhFjOfoWTocPVmoocWoLoccJMLYWOLsMBvFiMZIHXNo
VochoRcTooJooCoLWuskMhhgIKPTooocZZocXTTYoqcoWWaKSqmCgZoPVmWcVcQokUTWotoNXWP
uGvIqPaowkBocXcoTToLToooVVIcoqAnzzhigoTVohVVoUUQoBAcpccPooMVoGToDYQqqppyIjp
NoVXScXUFovKoocUbLcVQTWNgbuHtioHsTocoRccoGcTXoocKTVocjgEpHDBloWcoEVVoHoocDc
goUoWTVVTcEYBPnKpaoIFVVVXAcHbcoTocoAVTNTToftfXPmiiOopuaoVXccooUjcoocUcJUkTN
cTFEXuVVmoUlWorTccoloGcTBoPooLcUlKoUcoXoYokocaAooTgPqTYLmcwJoVXocvmtJCjpcEo
TTOorccVococoMoocTErPcVocqYEcVQoYcccocoKvoooQKuYcoQoloECoWojooQoofocWRooJLc
coojOIQcWohrdemix)
Re: Christmas poem since 1988
created: 2005-12-24 01:50:01
Ok I give up. Besides C and Perl, what's the other language?
Re: Christmas poem since 1988
created: 2005-12-24 07:19:42
It's also compilable as c++, at least I can compile it with g++. Of course, that is slightly cheating on "different language".

I'm not really a human, but I play one on earth. flash japh
Re: Christmas poem since 1988
created: 2005-12-24 11:08:03

Strict C compilers (tendra in default mode, gcc with -pedantic-errors) refuse to compile this, because while char v[]="..."; is valid, char v[]=("..."); is not. I haven't yet figured out what the third language is, if you don't mean C++, so I'm not sure if this breaks that, but my simple suggestion to resolve this is:

Instead of
#define q char w=0,v[]=
you can use
#define q(x) char w=0,v[]=x

It doesn't affect the output with less strict C compilers (gcc in default mode, icc), nor does it affect the output as a Perl script.

HTH

Update: I see now that the output is different when compiled as C++ instead of C ("only" instead of "true"), so it must be that that was what you meant.

Re: Christmas poem since 1988
created: 2005-12-27 08:31:22
Oh! impressive: not just as impressive as "the Best Ever", but I like the concept of code that is syntactically valid in more than one language. Now, a real challenge would be to write code that is valid C (and/or C++), Perl and Postscript, and does something interesting. As far as I'm concerned... quite about the only multi-language program I could write would probably be... an empty file! It would have the advantage of being a multi-language quine too!!
;-)
Re^2: Christmas poem since 1988
created: 2005-12-29 18:14:08
I've added plain TeX, and updated the original download link target so it is now C, C++, Perl and plain TeX. I'm quite sure that it is not possible to add PostScript, because there is no way to find a common starting for C, C++, Perl, plain TeX and PostScript. However, if we remove plain TeX, it is quite easy to add TCL and Bourne Shell (hint: TCL treats a backslash at the end of the comment line as an indicator that the comment continues in the next line). The starting line should be: #define eval char *eval=
Re^3: Christmas poem since 1988
created: 2005-12-30 14:04:49

I'm quite sure that it is not possible to add PostScript, because there is no way to find a common starting for C, C++, Perl, plain TeX and PostScript.

I took that as a challenge :D

%:/*:if 0;false +s&&(#*/include/*
{ Just another \TeX\ hacker,
{ \bye
} &g;print substr q q
Just another Perl hacker,
q, 1 and exit; q q
%};};);echo -ne "\e[A\e[K\
Just another bash hacker,
" && exit; */
int main() { printf("\
Just another C%s hacker,\n\
", "++"+2*(1%sizeof'2')); } /* }
/Times-Roman findfont 20 scalefont setfont newpath 72 72 moveto
(Just another PostScript hacker,)
show showpage % q # */
Re^4: Christmas poem since 1988
created: 2005-12-31 05:46:49
The starting %: is just brilliant. Congratulations! In the meantime I added LaTeX, zsh and original Bourne Shell (tested on SunOS 5.7) support. Here it is:
%:/*:if 0;false +s &&(#*/include/*
{ \egroup\expandafter\ifx\csname documentclass\endcsname\relax
  \else \documentclass{article}\begin{document} Just another
  \LaTeX\ hacker, \csname fi\endcsname \end{document}
  \fi Just another \TeX\ hacker,
{ \egroup\end                   
} &g;print substr q q
Just another Perl hacker,
q, 1 and exit; q q
" (";})
awk 'BEGIN{printf"%c[A%c[K",27,27
}';sh=sh;test $BASH_VERSION&&sh=bash
test $ZSH_VERSION&&sh=zsh
echo Just another $sh hacker, && exit; */
int main() { return 0*printf("\
Just another C%s hacker,\n\
", "++"+2*(1%sizeof'2')); } /* }
/Times-Roman findfont 20 scalefont setfont newpath 72 72 moveto
(Just another PostScript hacker,)
show showpage % q # */
Reaped: Re^4: Christmas poem since 1988
created: 2005-12-31 09:18:48
This node was taken out by the NodeReaper on 2005-12-31 22-50-06
Reason: [jdporter]: reap. failed post. correctly posted at Re^4: Christmas poem since 1988

You may view the original node and the consideration vote tally.

Reaped: Re^4: Christmas poem since 1988
created: 2006-01-01 08:54:21
This node was taken out by the NodeReaper on 2006-01-01 11-00-10
Reason: [grinder]: reap: partial contents of Re^4: Christmas poem since 1988

You may view the original node and the consideration vote tally.

Reaped: Re^4: Christmas poem since 1988
created: 2006-01-01 11:24:36

perlmonks.org content © perlmonks.org and Anonymous Monk, blazar, Errto, NodeReaper, truedfx, zentara

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03