• <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
            數據加載中……

            一晃一年過去了

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

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

            In the USA - 4

            已經回到深圳一個月了,去美國的事情幾乎記不起來了,感覺好像做了一場夢似的,還是這里更真實,更喜歡中國。SICP學習已經中斷了好久了,也該重新撿起來了。

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

            In the USA - 3

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

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

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

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


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

            In the USA - 2

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

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

            In the USA - 1

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

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

            posted @ 2008-08-13 09:13 cuigang 閱讀(1445) | 評論 (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 閱讀(1130) | 評論 (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 閱讀(726) | 評論 (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 閱讀(1321) | 評論 (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 閱讀(633) | 評論 (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 閱讀(877) | 評論 (2)編輯 收藏

            僅列出標題
            共8頁: 1 2 3 4 5 6 7 8 
            久久婷婷五月综合97色直播| 久久久久久九九99精品| 狠狠精品干练久久久无码中文字幕| 久久狠狠一本精品综合网| 国产精品99久久99久久久| 国产成人无码精品久久久性色| 久久久久久久亚洲精品| 久久婷婷五月综合国产尤物app| 一级做a爰片久久毛片免费陪| 久久伊人中文无码| 亚洲精品无码久久久| 97久久久精品综合88久久| 久久线看观看精品香蕉国产| 99热成人精品热久久669| 中文成人无码精品久久久不卡| 国产精品久久久久无码av| 97精品伊人久久大香线蕉| 亚洲乱码中文字幕久久孕妇黑人| 99久久国产精品免费一区二区| 久久久久国产精品| 久久精品无码专区免费青青| 久久人人爽人人爽人人爽| 理论片午午伦夜理片久久| 国产精品成人精品久久久| 亚洲欧美国产日韩综合久久| 精品综合久久久久久97超人 | 伊人色综合久久天天网| 久久久久婷婷| 久久久黄色大片| 精品免费久久久久久久| 亚洲精品乱码久久久久久自慰| 国产精品久久新婚兰兰| 久久精品国产亚洲AV蜜臀色欲| 伊人久久一区二区三区无码| 一级女性全黄久久生活片免费| 久久久无码精品午夜| 久久精品亚洲男人的天堂| 日韩精品无码久久一区二区三| 少妇熟女久久综合网色欲| 亚洲精品tv久久久久| 久久人人爽人人爽人人片AV东京热|