What's the Same
什么是公平? 没有人知道公平是什么,all atoms create equal!
eq?
比较两个字符是否相等=
比较两个数字是否相等eqan?
比较两个字符或者数字是否相等,需要借用`eq?`和`=`(define eqan?
;; only evaluate atoms of number and character
(lambda (n1 n2)
(cond
((and (number? n1) (number? n2))
(= n1 n2))
((or (number? n1) (number? n2))
#f)
(else
(eq? n1 n2)))))
eqlist?
比较两个list是否相等,需要借用eqan?
(define eqlist?
;; only anlysis list argument
(lambda (l1 l2)
(letrec ((atom? (lambda (a1)
(and (not (pair? a1)) (not (null? a1))))))
(cond
((and (null? l1) (null? l2)) #t)
((or (null? l1) (null? l2)) #f)
((and (atom? (car l1)) (atom? (car l2)))
(and (eqan? (car l1) (car l2)) (eqlist? (cdr l1) (cdr l2))))
((or (atom? (car l1)) (atom? (car l2))) #f)
(else
(and (eqlist? (car l1) (car l2))
(eqlist? (cdr l1) (cdr l2))))))))
equal?
比较两个字符或者数字或者list是否相等,更加普遍些
(define equal?
;; accept s-expressions as arguments( atoms 、lat and lists)
(lambda (s1 s2)
(letrec ((atom? (lambda (x)
(and (not (null? x)) (not (pair? x))))))
(cond
((and (atom? s1) (atom? s2))
(eqan? s1 s2))
((or (atom? s1) (atom? s2))
#f)
(else
(eqlist? s1 s2))))))
过去的yzl和现在的yzl是否相同
(define yzl
(lambda (things)
(letrec ((atom? (lambda (thing)
(and (not (pair? thing)) (not (null? thing))))))
(cond ((null? things) (quote 'nervous))
((atom? (car things))
(cons (quote 'done) (yzl (cdr things))))
(else
(cons (yzl (car things)) (yzl (cdr things))))))))
;;; (yzl '(get learn study buy travel do wash eat create))
;;; '('done 'done 'done 'done 'done 'done 'done 'done quote nervous)
- Are we finish?
- Do you have any other questions?
- what’s the meaning of that?
- I regret that I cannot recall who remarked the computation is the art of carefully throwing away information, while Computer science deals with information and with complexity: give an overwhelming collection of data, you reduce it to useable result by discarding most of its content(进行边缘计算,只取回特征值)
抽象很重要。计算科学面临的最大的问题就是计算复杂度;随着程序变大的,计算复杂度极具增大,abstraction is the primary tool or technique for managing complexity. 因为An abstraction hides unnecessary detail and allow recurring patterns to be expressed concisely(递归表达), less is more(少就是多) 我们面临的最大的挑战就是how to convey the necessary details without losing the overall structure(不失全局)
- Abstract mean you give sth a name; Abstraction is the most important concept in all of the computer science Abstraction consists in treating sth complex as if they were simpler, throwing away details.
- Reference means you call sth by name
- While Synthesis means you combine two of the things(Abstract and Reference) From 《scheme and art of programming》(抽象的反义词 合成 抽象为简单、合成为复杂)
Solve problems not only for their solutions but also or an understanding of how the solutions were obtained(也许背后的求解思路更重要)
The task that confronts you is not only to learn a programming language but to learn to think as a computer scientist and develop an aesthetic about computer programs( make them become elegant
Related