The Lumber Room

"Consign them to dust and damp by way of preserving them"

{Haskell,Python,Ruby} quine

leave a comment »

Here.

~$ cat q.hs
q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']
main=q "q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']" "def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'" " def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+ 'main=q '+e(b)+' '+ e(c)+' '+e(a)+' '+ 10.chr end"
~$
~$ runhaskell q.hs | tee q.py
def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'
q("def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'"," def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+ 'main=q '+e(b)+' '+ e(c)+' '+e(a)+' '+ 10.chr end","q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']")
~$
~$ python q.py | tee q.rb
 def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+ 'main=q '+e(b)+' '+ e(c)+' '+e(a)+' '+ 10.chr end
q(" def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+ 'main=q '+e(b)+' '+ e(c)+' '+e(a)+' '+ 10.chr end","q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']","def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'")
~$
~$ ruby q.rb | tee qq.hs
q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']
main=q "q a b c=putStrLn $ b ++ [toEnum 10,'q','('] ++ show b ++ [','] ++ show c ++ [','] ++ show a ++ [')']" "def q(a,b,c):print b+chr(10)+'q('+repr(b)+','+repr(c)+','+repr(a)+')'" " def e(x) return 34.chr+x+34.chr end;def q(a,b,c) print b+10.chr+ 'main=q '+e(b)+' '+ e(c)+' '+e(a)+' '+ 10.chr end"
~$
~$ diff q.hs qq.hs
~$

Written by S

Thu, 2008-02-07 at 03:27:35

Posted in Uncategorized

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s