2014年11月25日星期二

Week 11 Nov 17

Lists of Lists of Lists of 


Firstly, we should know what recursion means "A common method of simplification is to divide a problem into subproblems of the same type. As a computer programming technique, this is called divide and conquerand is key to the design of many important algorithms. Divide and conquer serves as a top-down approach to problem solving, where problems are solved by solving smaller and smaller instances. A contrary approach is dynamic programming. This approach serves as a bottom-up approach, where problems are solved by solving larger and larger instances, until the desired size is reached".(http://en.wikipedia.org/wiki/Recursion#Recursion_in_computer_science)

In last few weeks, we already learn the recursion tree, 
today I learn the recursion number lists
From notes there is an example:

>depth (list (list (list 1
                         2)
                   3)
             (list 4)))
>3

The answer is 3 that because:

*(list 1 2) and (list 4) is one 

(list(list 1 2) 3 (list 4 ))is two

(list (list (list 1 2) 3 (list 4 ))) is three

* importantly: lists of lists of lists… are a inclusion relation and not a coordinating relation

Also, we have other method to get the answer 3 that is:
(define (depth lol)
  (cond [(list? lol) (+ 1
                        (apply max
                               (map depth lol)))]
        [else 0]))

By the way, we have a second project in this week and due in early december.
I will know the second term test marks in Friday and I think I will not get a high mark TT



week 2 suptember 16

Lets introduce some basic knowledges :
  • Flip-horizontal: a picture change from left to right 
  • Flip-vertical: a picture change from top to bottom 
  • above: this is hard to describe so I give you a example : 
>(Above  ♠  )
  
  
 
  • beside:   
>(beside  ♠  )
   
  • add:
>(+ 10 2)
  12
  • minus:
>(- 10 2)
  8
  • times:
>(* 1 2 3 4)
  24



Sorry I'm late to write earliest blog ^^



2014年11月17日星期一

Week 10 Nov 10

Last week we have a term test 2 so I prepare for this term test.

Decimal notation and Binary represention :

Decimal notation- It's a math system about 10

I find decimal notation's history on Wikipedia:

Eg: Lbn Laban addition
6425
839

Eg: Sun Zi division

Binary represention-

I recall the term test 2 question and there is a calculation method:
Add: 
00+00=00
00+01=01
01+00=01
01+01=10

When we meet 01+01 we need to carry a 1.

Such as:

To summary, there are the decimal and the binary but there still has an interesting rule that are 
from decimal to binary and from binary to decimal.


Eg: 

Eg: 


All the picture are from internet 






2014年11月9日星期日

Nov 3 week 9

In the first term test, there is a kind of built-in values:
Number-Boolean 
Image-image

Now I know that called The DATA-TYPES

  • Number
  • Image
  • Boolean
  • String
  • List
  • Color
I guess it Will appear in the second term test too!!!


Here is an example,

There are two people 

Lucy LuLu 1990
George Brown 1991

(define Lucy ( list "Lucy LuLu" 1990))
(define George (list "George Brown" 1991))

(Define person-name first)
(define person-birth-year second)

Lucy
"Lucy LuLu" 1990





Define-strict
I find a picture that about check-expect


2014年11月4日星期二

Week-October 27

Last week we learn how to make some beautiful colours for a picture.

Firstly,
The range among red green and blue are (range 0 256 1)


such as:

So… Here is a question, why?
Prof. give us a website and that says:"Additive color is color created by mixing light of two or more different colors. Redgreen, and blue are the additive primary colors normally used in additive color system. "(https://en.wikipedia.org/wiki/Additive_color)

Example 1:
(square 50 "solid" (make-color 255 255 0))
We can get a yellow square
There are all the possibilities


I think these just a warm up for colour - -
By the way, I do not know how to write last week quiz, I feel so sad.
I will learn PDF 1 2 as soon as possible.