Posts

What is binary number?

ohwo  What is binary number? It  is a number  expressed in the  base-2 numeral system  or  binary numeral system . I have an example, how to transfer 63 into binary number? we 63/2 = 31 --------1 31/2 = 15 --------1 15/2 = 7 ---------1 7/2 = 3 -----------1 3/2 = 1 -----------1 1/2 = 0 -----------1 and we just write the residuals 1 from bottom to to. We have the answer 111111.

How to use range?

How to use range? I have an example here, (range 0 4 1) This function means counts from 0 to 4 but not including 4, the range is 1. The answer is (list 0 1 2 3) Obviously the first and second number give me a limit and the third number is the range. We should all noticed that the second number doesn’t count in the answer.

How to use map and apply

How to use map? For example, I have a function (map string-length (list “cat” “dog” “fish” “banana”)) I simply do (list (string-length “cat”) (string-length “dog”) (string-length “fish”) (string-length “banana”)) The answer will be (list 3 3 4 6) This is how we use map, we bring all the listed elements into the function and return a new list. How to use apply? For example, I have a function, (apply string-append (list “cat” “dog” “fish” “banana”)) I simply do (apply string-append   “cat” “dog” “fish” “banana”) The answer will be (catdogfishbanana) This is how we use apply, we bring all the elements into one function and return it together.