<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    莊周夢蝶

    生活、程序、未來
       :: 首頁 ::  ::  :: 聚合  :: 管理

    最近的工作

    Posted on 2008-05-21 11:45 dennis 閱讀(1948) 評論(4)  編輯  收藏 所屬分類: 動態語言涂鴉計算機科學與基礎
        轉眼間,來廣州快半年了,感覺還不錯。廣州如死魚所說的那樣,是個包容并且很有活力的城市,習慣了周末煲湯,去天河公園跑跑步,這生活還是挺舒適的,除了比較潮的天氣。
        最近跟公司鬧了點不愉快,在轉正時間上,其實不是多大的事,只是心里不舒服罷了,干起活來也沒什么激情了,呵呵。當然,手頭的工作咱還是要高效率地完成,做完兩個游戲后,現在轉到棋牌類,棋牌類游戲核心就兩個算法:隨機發牌和出牌判斷。隨機發牌算法,學習了云風的blog上提到的方法,感覺還可以接受;出牌規則判斷,倒是沒想象中的復雜,建立牌型的OO模型,一切都很簡單了。另外一個發現,用jdk6跑jruby1.1.1,比用jdk5跑效率(包括內存和CPU)好上很多,例如我們一個游戲進程,在使用jdk5時,CPU穩定在15%,內存85M,而改用jdk6后,cpu降到了%5以下,內存也縮減到70多M。
        搞完了之后,時間有點空閑,就想學點新東西,最后選擇了Prolog。Yep,非常地有趣,真正的聲明式編程語言。Prolog本質上就是兩個東西:規則和事實,由事實和規則出發,Prolog的推理系統將回答你的查詢(query)。有點類似現在流行中的規則引擎的概念,在對效率不是很考慮的場景中,嵌入一個Prolog引擎做規則引擎完全是可以的,java中有個tuProlog項目,可以關注一下。然后就是一直在讀的sicp,延時求值模擬無窮級數實在是相當地cool,大開眼界。這兩天一直在理解continuation這個概念,小有所得。一個表達式的求值可以分為兩個階段:“What to evaluate?”和“What to do with the value”,“What to do with the value”就是計算的Continuation。例如,scheme求值下列表達式:
    (if (null? x) (quote ()) (cdr x))
    先求值表達式(null? x),(null? x)就是“What to evaluate”,當(null? x)求值后,需要根據這個值來決定是執行(quote ())還是(cdr x),這個根據值來決定的過程就是Continuation。如果在每次函數調用時,同時傳入當前的continuation,那么就完全可以不要堆棧。call/cc就提供了這樣的一個語法糖,call/cc全稱就是call-with-current-continuation,要求參數是一個過程,調用這個過程,并且向這個過程傳入當前的continuation(一般稱為k,kont,或者Ruby中一般是c,cont),這就是call/cc為我們做的。call/cc是實現Continuation的方式之一,coroutine/fiber/yield也是實現continuation的方式。《The Scheme Programming Language》給出的輕量級進程機制的例子比較有趣:
    (define lwp-list '())
    (define (lwp thunk)
      (set! lwp
    -list (append lwp-list (list thunk))))
    (define start
      (
    lambda()
        (let ((p (car lwp
    -list)))
          (set! lwp
    -list (cdr lwp-list))
          (p))))
    (define pause
      (
    lambda()
        (callcc (
    lambda(k) 
                   (lwp (
    lambda () (k #f)))
                   (start)))))
    (lwp (
    lambda () (let f () (display "h") (pause) (f))))
    (lwp (
    lambda () (let f () (display "e") (pause) (f))))
    (lwp (
    lambda () (let f () (display "y") (pause) (f))))
    (lwp (
    lambda () (let f () (display "!") (pause) (f))))
    (lwp (
    lambda () (let f () (newline) (pause) (f))))
    (start)
    實現了代碼級的進程調度。


    評論

    # re: 最近的工作  回復  更多評論   

    2009-02-10 11:01 by QQ75902706
    你也在廣州天河.

    # seo11813  回復  更多評論   

    2015-12-28 14:57 by For example in the following example, the rhyme pa
    For example in the following example, the rhyme pattern is ABAB. Articles Writing Services are good for any kind of article that should be well-written. 4) Provide a good attention-grabbing title or header.

    # seo27677  回復  更多評論   

    2016-01-05 21:01 by No matter what product you sell or service you pro
    No matter what product you sell or service you provide, your website needs to cater to your customers. With the advent of Google's stated goal to improve a user's search experience, many websites and articles lost their coveted positions in Search Engine Ranking Positions (SERPs). Your product or service is written about in the form of short articles that usually offer information or some other useful content to readers.

    # bbbergamo92458  回復  更多評論   

    2016-01-19 23:33 by Having read this I thought it was rather enlighten
    Having read this I thought it was rather enlightening. I appreciate you spending some time and effort to put this content together. I once again find myself personally spending a significant amount of time both reading and posting comments. But so what, it was still worthwhile!
    主站蜘蛛池模板: 国产v亚洲v天堂无码网站| 亚洲JIZZJIZZ中国少妇中文| 亚洲情a成黄在线观看动漫尤物| 国产亚洲精品成人久久网站| 情侣视频精品免费的国产| 中文字幕乱码亚洲精品一区| 成人免费a级毛片| 亚洲私人无码综合久久网| 大地资源二在线观看免费高清| 最新亚洲春色Av无码专区| 全免费一级毛片在线播放| 国产精品亚洲片在线花蝴蝶| 亚洲精品尤物yw在线影院| 国产精品美女久久久免费| 亚洲av无码不卡一区二区三区| 99热免费在线观看| 亚洲国产成人综合| 在线看片无码永久免费aⅴ| 免费人成动漫在线播放r18 | 久久精品亚洲一区二区三区浴池 | 久久狠狠躁免费观看2020| 亚洲精品免费视频| 国产成人免费网站| 美美女高清毛片视频黄的一免费 | 国产免费怕怕免费视频观看| a在线视频免费观看在线视频三区| 亚洲日韩一页精品发布| 99久久久国产精品免费牛牛 | 国产精品综合专区中文字幕免费播放| 亚洲综合色自拍一区| 91免费人成网站在线观看18| WWW国产亚洲精品久久麻豆| 国产成人亚洲精品91专区手机| 一个人免费日韩不卡视频| 亚洲精品二三区伊人久久| 亚洲伦乱亚洲h视频| 69国产精品视频免费| 美女被免费网站视频在线| 亚洲狠狠久久综合一区77777| 性盈盈影院免费视频观看在线一区| 伊人久久国产免费观看视频|