• <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 
            精品久久久久久国产| 久久无码人妻一区二区三区午夜| 久久精品视频网| 午夜精品久久久久久影视riav| 亚洲va久久久噜噜噜久久| 久久亚洲高清综合| 久久国产精品成人影院| 久久夜色撩人精品国产| 亚洲人成无码网站久久99热国产| 久久精品人人做人人爽电影| 国产精品午夜久久| 99久久国产综合精品五月天喷水| 97久久精品人妻人人搡人人玩| 国产成人久久精品一区二区三区| 久久天天躁狠狠躁夜夜2020| 99精品久久精品一区二区| 国产成人综合久久久久久| 亚洲AV无一区二区三区久久| 国产日韩久久久精品影院首页| 精品无码久久久久国产动漫3d| 国产香蕉97碰碰久久人人| 国产精品青草久久久久福利99| 欧洲人妻丰满av无码久久不卡| 久久久久黑人强伦姧人妻| 亚洲色欲久久久久综合网| 久久精品免费观看| av国内精品久久久久影院| 亚洲国产精品久久久久婷婷软件| 亚洲精品美女久久777777| 亚洲精品午夜国产va久久| 久久狠狠一本精品综合网| 久久99国产精品久久99| 国产人久久人人人人爽| 人妻精品久久久久中文字幕69| 亚洲综合伊人久久综合| 久久久无码精品亚洲日韩蜜臀浪潮 | 日批日出水久久亚洲精品tv| 国产69精品久久久久99尤物| 久久久久久久97| 久久精品国产99国产电影网| 国产美女久久精品香蕉69|