Differences between revisions 3 and 4
Revision 3 as of 2009-11-28 14:41:12
Size: 2281
Editor: Elias
Comment: 删除对PageComment2组件的引用
Revision 4 as of 2009-12-25 07:15:55
Size: 2289
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 4: Line 4:
[[TableOfContents]] <<TableOfContents>>
Line 6: Line 6:
[[Include(ZPyUGnav)]] <<Include(ZPyUGnav)>>
Line 14: Line 14:
[http://groups.google.com/group/python-cn/browse_thread/thread/6d100ad6ef9feecf 突然抽风了——如何让一个程序打印出亲本身?] - python-cn`CPyUG`华蟒用户组(中文Py用户组) | Google Groups [[http://groups.google.com/group/python-cn/browse_thread/thread/6d100ad6ef9feecf|突然抽风了——如何让一个程序打印出亲本身?]] - python-cn`CPyUG`华蟒用户组(中文Py用户组) | Google Groups
Line 17: Line 17:
[http://blog.sigfpe.com/2008/02/third-order-quine-in-three-languages.html third-order-quine-in-three-languages]
 * http://t.douban.com/view/note/large/public/p43129024-2.jpg
[[http://blog.sigfpe.com/2008/02/third-order-quine-in-three-languages.html|third-order-quine-in-three-languages]]
 * {{http://t.douban.com/view/note/large/public/p43129024-2.jpg}}
Line 55: Line 55:
创建 by -- ZoomQuiet [[[DateTime(2009-09-07T06:28:33Z)]]] 创建 by -- ZoomQuiet [<<DateTime(2009-09-07T06:28:33Z)>>]

haskell->Py->Ruby->

问题

突然抽风了——如何让一个程序打印出亲本身? - python-cnCPyUG华蟒用户组(中文Py用户组) | Google Groups

最NB!

third-order-quine-in-three-languages

  • http://t.douban.com/view/note/large/public/p43129024-2.jpg

`这是一个 Haskell 程序,运行它会输出一个 Python 程序,再运行这个 Python 程序会输出一个 Ruby 程序,再运行这个 Ruby 程序会得到一个 Haskell 程序,对了!就和最开始那个 Haskell 程序一模一样的! `

$ runghc prself.hs
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 ++ [')']")

$ runghc prself.hs  | python
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)+')'")

$ runghc prself.hs  | python | ruby
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" 


反馈

创建 by -- ZoomQuiet [2009-09-07 06:28:33]

MiscItems/2009-08-28 (last edited 2009-12-25 07:15:55 by localhost)