• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            CG@CPPBLOG

            /*=========================================*/
            隨筆 - 76, 文章 - 39, 評論 - 137, 引用 - 0
            數(shù)據(jù)加載中……

            一晃一年過去了

            一晃一年多過去了,公司項目很緊張,沒什么時間學習,scheme學習扔了將近兩年,曾經(jīng)的SICP學習計劃嚴重延期了。期間有朋友給我留言都沒有時間回復,或許忙已經(jīng)成為借口了,還是回來再繼續(xù)吧。

            posted @ 2010-02-07 15:11 cuigang 閱讀(733) | 評論 (1)編輯 收藏

            In the USA - 4

            已經(jīng)回到深圳一個月了,去美國的事情幾乎記不起來了,感覺好像做了一場夢似的,還是這里更真實,更喜歡中國。SICP學習已經(jīng)中斷了好久了,也該重新?lián)炱饋砹恕?/span>

            posted @ 2008-10-26 15:28 cuigang 閱讀(561) | 評論 (3)編輯 收藏

            In the USA - 3

            轉眼就好幾周過去了,整天無所事事的不知道干啥,語言是最大的障礙,學了十年的英文仍然跟白癡一般。

            頓頓都吃著麥當勞、肯德基、必勝客類似的東西,搞得惡心透頂了,能吃碗面或者炒個菜就好了,不用整天跟牛一樣啃生菜。

            沒有車在美國寸步難行,幾乎沒有公共交通工具,1個小時一班的bus坐滿了黑人和墨西哥人,火車稍微好點,但我這地方太偏僻了,要走一個小時才到火車站。

            去了紐約,大瀑布,不是很激動,比較沉默。


            posted @ 2008-09-12 23:24 cuigang 閱讀(529) | 評論 (0)編輯 收藏

            In the USA - 2

            沒地方抽煙,幾乎所有的室內(nèi)都 No smoking,大街上找不到垃圾桶,煙頭不知道往哪扔。
            美國人不睡午覺,我中午就犯困。
            他們對棒球的興趣看來比奧運會大。
            上班不打卡,公司沒有保安,人很少,地方很大,幾乎每個人一個房間。
            干什么都要付小費。

            posted @ 2008-08-15 01:30 cuigang 閱讀(509) | 評論 (1)編輯 收藏

            In the USA - 1

            象折磨一般,填表填表、安檢安檢,斷斷續(xù)續(xù)持續(xù)了一個月,終于踏上了美利堅合眾國的土地,16個小時的飛機比坐硬座痛苦多了,坐在酒店來接機的小車里,整個人象磕了藥一樣,恍恍惚惚的看著窗外的紐約,Big 是唯一的感受,車大、路寬、交通指示牌牌大字大,連到處懸掛的美國國旗都碩大無比,在國內(nèi)從來沒有見過如此尺寸的旗子。

            用西北人的話來說,這里野哄哄的。

            posted @ 2008-08-13 09:13 cuigang 閱讀(1436) | 評論 (3)編輯 收藏

            我的SICP習題答案(2.36~2.39)

            2.36
            (define s (list (list 1 2 3)(list 4 5 6)(list 7 8 9)(list 10 11 12)))
            (define (accumulate-n op init seqs)
              (if (null? (car seqs)) null
                  (cons (accumulate op init (map# (lambda(x) (car x)) seqs))
                        (accumulate-n op init (map# (lambda(x) (cdr x)) seqs)))))

            2.38
            ;> (fold-right / 1 (list 1 2 3))
            ;
            3/2
            ;
            > (fold-left / 1 (list 1 2 3))
            ;
            1/6
            ;
            > (fold-right list null (list 1 2 3))
            ;
            (1 (2 (3 ())))
            ;
            > (fold-left list null (list 1 2 3))
            ;
            (((() 1) 2) 3)

            ; (fold-right op i (a b c)) = (op a (op b (op c i)))
            ;
             (fold-left op i (a b c))  = (op (op (op i a) b) c)

            要 fold-right 和 fold-left 得到相同的結果,顯然需要 op 滿足交換律。

            2.39
            (define (reverse-1 seqs)
              (fold-right (lambda(x y) (append y (list x))) null seqs))
            (define (reverse-
            2 seqs)
              (fold-left (lambda(x y) (cons y x)) null seqs))


            posted @ 2008-07-02 00:08 cuigang 閱讀(1119) | 評論 (1)編輯 收藏

            我的SICP習題答案(2.33~2.35)

            2.33

            (define (map+ p seque)
              (accumulate (lambda(x y) (cons (p x) y)) null seque))

            (define (append seq1 seq2)
              (accumulate cons seq2 seq1))

            (define (length seque)
              (accumulate (lambda(x y) (+ 
            1 y)) 0 seque))

            2.34

            (define (horner-eval x coeff-seque)
              (accumulate (lambda(this-coeff higher-coeff) 
                            (+ this-coeff (* x higher-coeff)))
                          
            0 coeff-seque))

            2.35

            (define (count-leaves+ t)
              (accumulate + 
            0 (map (lambda(x)
                                     (if (pair? x) (count-leaves+ x) 
            1))
                                   t)))


            posted @ 2008-06-24 00:21 cuigang 閱讀(718) | 評論 (0)編輯 收藏

            我的SICP習題答案(2.27~2.32)

            2.27
            (define (deep-reverse lst)
              (define (iter lst-o lst-d)
                (cond ((null? lst-o) 
                       lst-d)
                      ((not (pair? (car lst-o))) 
                       (iter (cdr lst-o)
                             (cons (car lst-o) lst-d)))
                      (else 
                       (iter (cdr lst-o) 
                             (cons (deep-reverse (car lst-o))
                                   lst-d)))))
              (iter lst null))

            2.28
            (define (fringe x)
              (define (iter tree lst)
                (cond ((null? tree) lst)
                      ((not (pair? tree)) (cons tree lst))
                      (else (iter (car tree) (iter (cdr tree) lst)))))
              (iter x null))

            2.30
            (define (square-tree- x)
              (cond ((null? x) null)
                    ((not (pair? x)) (* x x))
                    (else (cons (square-tree- (car x))
                                (square-tree- (cdr x))))))
            (define (square-tree x)
              (map (lambda(subtree)
                     (if (pair? subtree)
                         (square-tree subtree)
                         (* subtree subtree)))
                   x))

            2.31
            (define (tree-map proc tree)
              (map (lambda(subtree)
                     (if (pair? subtree)
                         (tree-map proc subtree)
                         (proc subtree)))
                   tree))
            (define (square-tree+ tree)
              (tree-map (lambda(x) (* x x)) tree))

            2.32
            (define (subsets s)
              (if (null? s)
                  (list null)
                  (let ((rest (subsets (cdr s))))
                    (append rest (map (lambda(x) (cons (car s) x)) rest)))))

            和換零錢問題的思路是一樣的,對于一個集合的所有子集的集合,可以分為兩部分,含有第一個元素和不含第一個元素的集合。而且含第一個元素的所有子集除去第一個元素,恰好正是所有不含第一個元素的子集。

            也可以換個思路,對于集合A,設它可以表示為 (a1)∪(a2,...,an) ,而 (a2,...,an) 的所有子集的集合是 B=(B1,...Bm),那么可以證明A的所有子集的集合 C=B∪((A1)∪B1,(A1)∪B2,...,(A1)∪Bm);
            證明:設 X 是 A 的一個子集,那么如果 a1∈X,那么 X
            ((A1)∪B1,(A1)∪B2,...,(A1)∪Bm),否則X∈B,所以
               
            X∈C



            posted @ 2008-06-17 23:48 cuigang 閱讀(1307) | 評論 (4)編輯 收藏

            我的SICP習題答案(2.24~2.26)

            2.24



            2.25

            (car (cdaddr (list 1 3 (list 5 79)))
            (caar (list (list 
            7)))
            (cadadr (cadadr(cadadr (list 
            1 (list 2 (list 3 (list 4 (list 5 (list 6 7)))))))))

            2.26

            (1 2 3 4 5 6)
            ((
            1 2 34 5 6)
            ((
            1 2 3) (4 5 6))




            posted @ 2008-06-11 23:39 cuigang 閱讀(623) | 評論 (0)編輯 收藏

            我的SICP習題答案(2.17~2.23)

            2.17

            (define (last-pair lst)
              (if (null? (cdr lst))
                  (cons (car lst) ())
                  (last-pair (cdr lst))))

            2.18


            (define (reverse lst)
              (define (iter lst-o lst-d)
                (if (null? lst-o)
                    lst-d
                    (iter (cdr lst-o) (cons (car lst-o) lst-d))))
              (iter lst null))

            2.20

            (define (same-parity x . lst)
              (define (filter lst ok?)
                (if (null? lst)
                    ()
                    (if (ok? (car lst))
                        (cons (car lst) (filter (cdr lst) ok?))
                        (filter (cdr lst) ok?))))
              (if (even? x)
                  (cons x (filter lst (lambda(x) (= 0 (remainder x 2)))))
                  (cons x (filter lst (lambda(x) (= 1 (remainder x 2)))))))

            2.21

            (define (square-list- items)
              (if (null? items)
                  ()
                  (cons (* (car items) (car items))
                        (square-list- (cdr items)))))

            (define (square-list items)
              (map (lambda(x) (* x x)) items))

            2.22

            第一種每次取出首元素平方后前插到新表,象reverse過程類似,所以是反的。
            第二種只不過是把新表前插到元素前,得到的甚至不是一個list,而是
              ((((() . 1) . 4) . 9) . 16)

            2.23

            (define (for-each proc items)
              (if (not (null? items))
                  ((lambda() (proc (car items))
                   (for-each proc (cdr items))))))

            posted @ 2008-06-11 22:56 cuigang 閱讀(867) | 評論 (2)編輯 收藏

            僅列出標題
            共8頁: 1 2 3 4 5 6 7 8 
            人妻无码中文久久久久专区| 99久久国产综合精品麻豆| 久久天天躁狠狠躁夜夜avapp | 亚洲一区二区三区日本久久九| 国产精品久久成人影院| 996久久国产精品线观看| 国产精品美女久久久久AV福利| 久久国产免费直播| 久久久久久久免费视频| 久久精品国产亚洲一区二区三区| 久久伊人亚洲AV无码网站| 久久综合给久久狠狠97色| 国产精品va久久久久久久| 97久久国产综合精品女不卡| 国产成人无码精品久久久免费| 久久天天躁狠狠躁夜夜av浪潮| 亚洲色欲久久久综合网| 精品国产乱码久久久久久浪潮 | 亚洲午夜精品久久久久久app| 久久亚洲精品无码观看不卡| 久久久久se色偷偷亚洲精品av| 久久国产成人亚洲精品影院| 久久丫精品国产亚洲av| 狠狠色丁香久久婷婷综合_中| 久久伊人中文无码| 国产A级毛片久久久精品毛片| 色欲综合久久躁天天躁蜜桃| 久久久久99精品成人片直播| 国内精品久久久久伊人av| 久久亚洲中文字幕精品有坂深雪| 久久影视综合亚洲| 人人狠狠综合88综合久久| 香蕉久久AⅤ一区二区三区| 亚洲国产精品久久久久| 精品少妇人妻av无码久久| 无码精品久久久久久人妻中字| 久久久国产精华液| 伊人久久大香线蕉AV色婷婷色| 亚洲人成无码www久久久| 久久亚洲欧洲国产综合| 亚洲国产成人久久综合一区77|