2009/10/7 王孝 <
wangx...@gmail.com>:
> 真恐怖! 楼主验证过了吗?
>
没法检验哪,哪儿有那么多环境哪,,,
果然只有宅男才可能整出来>...
> 2009/10/7 Haibin <
lee.b...@gmail.com>
>>
>>
>>
>>
>> Sent to you by Haibin via Google Reader:
>>
>>
>>
>>
>> 小日本太变态了:11门语言的quine接力
>>
>> via est's blog by electronixtar on 9/28/09
>>
>> A Neighborhood of Infinity当年的牛逼之作A Third Order Quine in Three
>> Languages可以说已经是惊为天人了。什么东西呢?
>> 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"
>>
>>
>> 这是一个Haskell程序源码,运行一下可以得到一个Python程序源码,再运行一下这个Python程序,可以得到一个Ruby程序源码,再运行一下这个Ruby程序可以得到最开始的Haskell程序源码。这就是triple
>> quine
>>
>> 今天在proggit上看到更加变态的:11们语言的quine接力。。。。orz。。。小日本果然变态。。。
>>
>> 原文在:
http://d.hatena.ne.jp/ku-ma-me/20090916/p1
>>
>> 代码是:
>> # ruby
>> l=92.chr;eval
>> s="s=s.dump[r=1..-2].gsub(/("+l*4+"){4,}(?!\")/){|t|'\"+l*%d+\"'%(t.size/2)};5.times{s=s.dump[r]};puts\"#
>> python\\nprint(\\\"# perl\\\\nprint(\\\\\\\"# lua"+l*4+"nprint("+l*7+"\"(*
>> ocaml *)"+l*8+"nprint_endline"+l*15+"\"-- haskell"+l*16+"nimport
>> Data.List;import Data.Bits;import Data.Char;main=putStrLn("+l*31+"\"/* C
>> */"+l*32+"n#include<stdio.h>"+l*32+"nint
>> main(void){char*s[501]={"+l*31+"\"++intercalate"+l*31+"\","+l*31+"\"(c(tail(init(show("+l*31+"\"/*
>> Java */"+l*32+"npublic class QuineRelay{public static void
>> main(String[]a){String[]s={"+l*31+"\"++intercalate"+l*31+"\","+l*31+"\"(c("+l*31+"\"brainfuck"+l*64+"n++++++++[>++++<-]+++++++++>>++++++++++"+l*31+"\"++(concat(snd(mapAccumL
>> h 2("+l*31+"\"110"+l*31+"\"++g(length
>> s)++"+l*31+"\"22111211100111112021111102011112120012"+l*31+"\"++concatMap("+l*32+"c->let
>> d=ord c in if
>> d<11then"+l*31+"\"21002"+l*31+"\"else"+l*31+"\"111"+l*31+"\"++g
>> d++"+l*31+"\"22102"+l*31+"\")s++"+l*31+"\"21002111010120211222211211101000120211021120221102111000110120211202"+l*31+"\"))))))++"+l*31+"\","+l*63+"\""+l*64+"n"+l*63+"\"};int
>> i=0;for(;i<94;i++)System.out.print(s[i]);}}"+l*31+"\")))))++"+l*31+"\",0};int
>> i=0;for(;s[i];i++)printf("+l*63+"\"%s"+l*63+"\",s[i]);puts("+l*63+"\""+l*63+"\");return
>> 0;}"+l*31+"\");c
>> s=map("+l*32+"s->"+l*31+"\""+l*63+"\""+l*31+"\"++s++"+l*31+"\""+l*63+"\""+l*31+"\")(unfoldr
>> t s);t[]=Nothing;t s=Just(splitAt(if length s>w&&s!!w=='"+l*31+"\"'then
>> 501else w)s);w=500;f 0=Nothing;f x=Just((if x`mod`2>0then '0'else
>> '1'),x`div`2);g x= reverse (unfoldr f x);h p c=let d=ord
>> c-48in(d,replicate(abs(p-d))(if d<p then '<'else
>> '>')++"+l*31+"\"."+l*31+"\");s="+l*31+"\"#
>> ruby"+l*32+"n"+l*31+"\"++"+l*31+"\"l=92.chr;eval
>> s=\"+(z=l*31)+\"\\\"\"+s+z+\"\\\""+l*31+"\"++"+l*31+"\""+l*32+"n"+l*31+"\""+l*15+"\""+l*7+"\")"+l*4+"n\\\\\\\")\\\")\"###########
>> (c) Yusuke Endoh, 2009 ###########\n"
>> 当然自己试的时候需要处理好缩进和换行问题。
>>
>> 是这11门语言的quine:
>>
>> ruby 1.8.7-p72
>> Python 2.5.2
>> perl v5.10.0
>> Lua 5.0.3
>> OCaml 3.10.2
>> ghc-6.8.2
>> gcc 4.3.2
>> java "1.5.0_17"
>> beef 0.0.6-2
>> whitespace 0.3-2
>> unlambda 2.0.0-5
>>
>> 卧槽。。。。HOLYFUCK!
>>
>>
>>
>>
>> Things you can do from here:
>>
>> Subscribe to est's blog using Google Reader
>> Get started using Google Reader to easily keep up with all your favorite
>> sites
>>
>>
>>
>
>
>
> --
> Focus on Your Dreams! ------王孝
>
> >
>
--
http://zoomquiet.org 人生苦短? Pythonic!
向靠谱,反脑残! Kaopulity,小白退散! [Kaopulity~= Keep all processes usablity!]