2012年12月5日星期三

Last week of csc

    Finally we finish our class and start to prepare for our fanal exam. I study a lot about C language since the first class of csc104. This is the first time that I use Dr. Racket and I have to take courage to face a lot of challenges.I really prove a lot about the usage of Dr. Racket and C language.  I hope that I can study hard for our final exam and get a satisfied score. Thank you, our TA and professor!~~~

2012年11月30日星期五

Project 2

I don't feel too difficult of project 2 but I have to work hard for it. For instance, I have to figure out how to write two more check-expect expressions for strict-interpolate.
(define (strict-interpolate f n1 n2)
  (min (max n1 n2)
       (max (min n1 n2) (interpolate f n1 n2))))
(check-ecpect (strict-interpolate 3/2 0 5) 5)
(check-expect (strict-interpolate 3/2 5 0) 5)


To fix interpolate-color(find the minimum or maximum number),we need to write like that:
(define (interpolate-color f c1 c2) c1)
(make-color (interpolate f (color-red c1) (color-red c2))
            (interpolate f (color-green c1) (color-green c2))
            (interpolate f (color-blue c1) (color-blue c2))
            (interpolate f (color-alpha c1) (color-alpha c2)))


To fix  arrow-event:
fix arrow-event
(define (arrow-event n k)
   (cond [(enqual? k "left") (sub1 n)]
   [(equal? k "right") (add1 n)]
   [else n]))

In  conclusion, it looks like that it is shorter than project 1 but we still need to understand the codes and use them in Dr. Racket.

2012年11月23日星期五

Week 11: wikipedia part 3 "koch" "sprial"

This week we study two main orders: koch and sprial.
For the second part of "koch", we need to write one check-expect
(check-expect (koch-snowflake 2)
(above
(beside
(rotate 60 (koch 2))
(rotate -60 (koch 2)))
(rotate 180 (koch 2))))
Then difine it:
(define (koch-snowflake d)
  (above
   (beside
    (rotate 60 (koch d))
    (rotate -60 (koch d))
 )
   (rotate 180 (koch d))))

For "sprial" ,we need to use substring and string-append to finish it.

We have to understand it and practice more to prepare for the quiz~~@-@

For the third part of wikipedia, I change the grammer and spelling for two articles. It is really hard to find mistakes from wikipedia because it has been changed for a lot of times bu other users.I hope that I can do it well~~

2012年11月16日星期五

week 10: Test 2 and gtree

This week we study hor to wtire the oder about the gthree. Basically, we need to difine tree nodes and small trees. After that we should write the list the labels from a gtree. We also have to noice flatten and depth.
For flatten (just a part of it)
; If L is a list, flatten (un-nest) it, otherwise
; make it a list
(check-expect (flatten 5) (list 5))
(check-expect (flatten L1)
              (list 1 2 3 4 5 6 7 8 9 1 2 3))
For depth( just a part of it)
(check-expect (depth 3) 0)
(check-expect (depth (list 3)) 1)
(check-expect (depth (list 1 (list 2) 3))2)  -----> may test on quiz
;
(define (depth L)
  (cond
    [(not (list? L)) 0]
    [else (add1 (apply max (map depth L)))]))

2012年11月9日星期五

Project 1

    I have few tests this week and  I feel a little bit exhausted...Today is the due day of project one and I still have few things to do. I hioe that I can do it well~~

    I find that the second question of project 1 is really hard for me. We need to fix the definition of clarify-image.It is related to map and map image.  Our TA helped us a little and the solution is
(check-expect (clarify-image (circle 10 "solid" (make-color 250 250 250 255)))
              (circle 10 "solid" (make-color 250 250 250 0)))
;
(define (clarify-image im) (map-image clarify-color im)).
W also need to create two (check-expect ...) expressions for set-up-hand. To make it move , we should write like that:
(check-expect (set-up-hand BAR 90)
               (overlay/align
                "middle" "top"
                (rotate -90 BAR)
                (circle
                 (image-width BAR)
                 "solid"
                 (color 255 255 255 0))))
;
(define (set-up-hand im deg)
  (overlay/align
   "middle" "top"
   (rotate (* -1 deg) im)
   (circle
    (image-height (rotate (* -1 deg) im))
    "solid" (make-color 255 255 255 0))))
 I think I should practice more...

2012年11月3日星期六

Week 8

     For the lecture, we study rot13 as algorithm. For example: what is a really simple rule (or set of rules) for (rot13 c), where c is some character? The answer is if c is in a-m, add 13. It c is in n-z,  sub 13.
     For Dr,Racket, I have to understand some orders, for example: to produce string with characters in opposite order from s
     (check-expect (string-reverse "string") "gnirts")
;
(define (string-reverse s)
  (cond
    [(zero? (string-length s)) s]
    [else (string-append (string-reverse (substring s 1)) (substring s 0 1))]))

Also, I have to figure out how to explain whether it is a palindrome or not. Firstly I have to write two check-expect steps.
(check-expect (palindrome? "aa") true)
(check-expect (palindrome? "ab") false)

Then define
(define (palindrome? s)
  (cond
    [(< (string-length s) 2) true]
    [else
     (and
      (palindrome? (substring s 1 (sub1 (string-length s))))
      (equal? (string-ref s 0) (string-ref s (sub1 (string-length s)))))]))

Now I have to prepare for project 1 because it will due next week.


 


2012年10月27日星期六

Week 7

 For this week's lecture, we study what von neumann looks like, input, output, shorage and the protection from machine.
    We study some simple orders in Dr.Racket.
For example, if we put this oder in Dr.Racket:
; number-hunch : number -> string
; Is n really, really big?
; that is, is it more than 101
(define (number-hunch n)
  (cond
    [(> n 101) "Oh, it's *really* big"]
    [else "Not so big"]))
(number-hunch 5)
(number-hunch 102)
(define (GCD m n)
  (cond
    [(zero? n) m]
    [else (GCD n (remainder m n))]))
(GCD 35 15)
(GCD 15 35)
To run this one, we can get " Not so big" if numer-biunch is 5. The result of both (GCD 35 15) and (GCD 15 35) are 5.

2012年10月19日星期五

Wikipedia Part II

  This is my plan for wikipedia part 2~~

 For the second part of wikipedia assignment, I choose to learn how to fix spelling and grammer. Here is my plan to fix spelling and grammer.

   For the spelling, I will correct spelling mistakes and typos carefully.(As wikipedia said I can use spell-checking software.) Also, it is better to write in the form of English. I will check the talk page(Some talk pages may have banners that indicate which spelling is used throughout the article).
  
   For the grammer, I will check the article really carefully and try not to change the meaning when I change the grammer mistake.

   Here are some specific things that I will do during fixing spelling and grammer:

*Check that some words which are defined or described should be italicized.

*The head should be noun phrases

*The heading should begin with a single capital letter.

*Check titles of works of art, literature, etc., should be italicized rather than in quotation marks. For example, Zen and the Art of Motorcycle Maintenance.

*Notable exceptions are song titles, short stories, or brief poems, e.g. "Skyfall" or "Someone like you". I will notice that individual episode titles of television series need quotation marks and published works' names should be spelled exactly as published, using symbols and any in-word capitalization as in the original.

*I will check the confusion between its and it's.

*I will check the confusion betwenn their and there

*I will check the confusion between lose and loose.

*Except at the end of a sentence, location constructions such like Toronto, call for a comma after the second element.

*The month day, year, style of writing dates punctuates after the year, which is parenthetical.

*Fuzzy language is not necessary.

*Check unnecessary words and redundant phrases.

*Decade names should not include an apostrophe before the s:

*See also notices should be in a section titled "See also" if relevant to most of the article.

*I will not change the wording, spelling of literal quotations should. However, I can mark clear errors in the original with [sic].

*Items in a list should have no blank lines between the bullet points.
  
Secondly, we should edit summaries. Summary notes for copy edits should be simple and clear. We should write down whether the edit is correct or we should increase some imformation in it. I can show the small spelling and grammer mistakes by checking the box labeled "This is a minor edit". But for stylistic corrections I will call for written summaries. (Generally, we don't have to write the detailed indormation in edit summaries.)

Further more, I will not use uncivil edit summaries and I can use abbreviated summaries sometimes.

I will also ask people who is good at spelling and grammer to help me check the mistake anmd make it better.

( I learn how to fix the spelling and grammer miskake by http://en.wikipedia.org/wiki/Wikipedia:Basic_copyediting .It writes down some specific imformation about how to change the mistake and teach me a lot. All above shows both my plan and what I have learned from wikipedia "Help Out")

2012年10月13日星期六

Week 5

   We had the first term test on Wednesday. I felt ok about this test but I still have to pay more effort on it.I have studied computer science for almost a month so far. At the beginning it is a little bit difficult for me to use Dr.Racket to do some orders like how to define a function using design recipe. I felt better after practicing more and learn some basic ideas like Boolean logic and binary system. Specifically,  I have to study how to multipy the binary representations of 15 and 19. After the class I know that we can turn 15 to 1111 and turn 19 to 10011.We can multiple 1111 * 10011 to get the result.
                                    
      I hope that I can have more improvement  about compuer by having this class.