Re: [dk-tug] Kontonummer
Steffen Videbæk Petersen <[email protected]>
| Newsgroups | gmane.comp.tex.danish |
|---|---|
| Message-ID | <[email protected]> |
On 2011-12-24 13:46, "E. Sjørlund" wrote: > Er der ikke en venlig sjæl som kan sende det kontonummer der skal > indbetales til. Min opkrævning er forsvundet. Kontonummeret er 9395-3965635091. Husk at skriver Jeres DK-TUG-brugernavn i feltet "Tekst til modtager". Derudover en glædelig jul til alle, medlemmer eller ej. I denne anledning vil jeg lige dele følgende stump TeX-kode, som jeg har fra daleif. /Steffen -------- Original Message -------- Subject: Obfuscated partridge in a pear tree Date: Wed, 20 Apr 2011 04:03:42 +0000 (UTC) From: Charles P. Schaum <[email protected]> Organisation: Aioe.org NNTP Server Newsgroups: comp.text.tex Just for fun I spent a few minutes revisiting that famous(?) bit of obfuscated plain TeX that generates "The Twelve Days of Christmas" and addressed the misapplication of the q macro that results in "partridge" in a "pair" tree or "pertridge" in a "pear" tree. I just yanked the macro and did a minor adjustment. I also provided a less than satisfactory breakdown that accounts for all the easy replacements and then does a bit of hand-waving at macros & U and B that handle the recursive generation of the song by the use of delimited arguments. If nothing else, it is a mental exercise to see how arguments get passed and how the recursion works. I thought that some might also be interested. Charles % !TEX program=pdftex Obfuscated plain \TeX\ code remix \let~\catcode~`76~`A13~`F1~`j00~`P2jdefA71F~`7113jdefPALLF PA''FwPA;;FPAZZFLaLPA//71F71iPAHHFLPAzzFenPASSFthP;A$$FevP A@@FfPARR717273F737271P;ADDFRgniPAWW71FPATTFvePA**FstRsamP AGGFRruoPAqq71.72.F717271PAYY7172F727171PA??Fi*LmPA&&71jfi Fjfi71PAVVFjbigskipRPWGAUU71727374 75,76Fjpar71727375Djifx :76jelse&U76jfiPLAKK7172F71l7271PAXX71FVLnOSeL71SLRyadR@oL RrhC?yLRurtKFeLPFovPgaTLtReRomL;PABB71 72,73:Fjif.73.jelse B73:jfiXF71PU71 72,73:PWs;AMM71F71diPAJJFRdriPAQQFRsreLPAI I71Fo71dPA!!FRgiePBt'el@ lTLqdrYmu.Q.,Ke;vz vzLqpip.Q.,tz; ;Lql.IrsZ.eap,qn.i. i.eLlMaesLdRcna,;!;h htLqm.MRasZ.ilk,% s$;z zLqs'.ansZ.Ymi,/sx ;LYegseZRyal,@i;@ TLRlogdLrDsW,@;G LcYlaDLbJsW,SWXJW ree @rzchLhzsW,;WERcesInW qt.'oL.Rtrul;e doTsW,Wk;Rri@stW aHAHHFndZPpa;rtMRrgeLinZRaeprLtYer.W,:jbye % How to diagnose and fix the misspelling: % Change qpa.rtMRrgeLinZ.ir in the last line % to pa;rtMRrgeLinZRaepr or something similar %\let~\catcode% %~`76% 7 = # (catcode 6) %~`A13% A = active (catcode 13) %~`F1% F = { (catcode 1) %~`j00% j = escape (catcode 0) %~`P2% P = } (catcode 2) %jdefA71F~`7113jdefP% \def~#1{\catcode`#113\def} redefine \def to create a new csname each time %ALLF P% L = space %A''FwP% ' = w %A;;FP% ; = {} %AZZFLaLP% Z = space a space %A//71F71iP% / = append i to arg1 %AHHFLP% H = L = space %AzzFenP% z = en %ASSFthP;% S = th{} %A$$FevP% $ = ev %A@@FfP% @ = f %ARR717273F737271P;% arg1arg2arg3 becomes arg3arg2arg1{} %ADDFRgniP% D = ing %AWW71FP% W = gobble arg1 and replace with {} %ATTFveP% T = ve %A**FstRsamP% * = stmas{} %AGGFRruoP% G = our %Aqq71.72.F717271P% q = transform arg1.arg2. into arg1arg2arg1 %AYY7172F727171P% Y = transform arg1arg2 into arg2arg1arg1 %A??Fi*LmP% ? = istmas space m %A&&71jfiFjfi71P% & = transform arg1\fi to \fi arg1 %AVVFjbigskipRPWG% V = \bigskip reverse the next three and expand %AUU71727374 75,76Fjpar71727375Djifx:76jelse&U76jfiPL% deal recursively with the text to create stanzas %% transform arg1arg2arg3arg4 arg5,arg6 into \par arg1arg2arg3arg5ing \ifx:arg6\else %% \fi \U arg6 space %AKK7172F71l7271P% K = transform arg1arg2 onto arg1|l|arg2arg1 %AXX71FVLnOSeL71SLRyadR@oL RrhC?yLRurtKFeLPFovPgaTLtReRomL;P% %% X = On the Arg1th day of Christmas my true love gave to me{} %ABB71 72,73:Fjif.73.jelseB73:jfiXF71PU71 72,73:PWs;% %% Similar to U; works with the recursion %AMM71F71diP% M = arg1di %AJJFRdriP% J = ird %AQQFRsreLP% Q = ers space %AII71Fo71dP% l = o|arg1|d %A!!FRgieP% ! = eig %%The following is basically the final stanza, from which the rest is recursively produced, starting with the twelve drummers drumming. %Bt'el@ lTLqdrYmu.Q.,Ke;vz vzLqpip.Q.,tz; %;Lql.IrsZ.eap,qn.i. i.eLlMaesLdRcna,;!;h htLqm.MRasZ.ilk,% %s$;z zLqs'.ansZ.Ymi,/sx ;LYegseZRyal,@i;@ TLRlogdLrDsW,@;G %LcYlaDLbJsW,SWXJW ree @rzchLhzsW,;WERcesInW qt.'oL.Rtrul;e %doTsW,Wk;Rri@stW aHAHHFndZPpa;rtMRrgeLinZRaeprLtYer.W,:% %jbye -- Remove nospam to reply