A_lab
CS61A_lab14_macro
(define-macro (switch expr cases) (cons 'cond (map (lambda (case) (cons (eq? (eval expr) (car case)) (cdr case))) cases)) ) 这段代码是一个用于 Scheme 语言的宏定义,可以 ......
CS61A_lab12_macro
(define-macro (def func args body) `(define ,(cons func args) ,body)) 分析: 定义一个万能的函数定义,那就要模拟函数定义的样子。ok,函数定义是什么样子的呢? eg: (define (filter-lst fn lst) (if ......
CS_61A_lab10
Write sub-all, which takes a list s, a list of old words, and a list of new words; the last two lists must be the same length. It returns a list with ......
CS_106A_lab_09
重点:: 观察到:在带入函数之后,没有任何返回值,是直接对参数本身进行作用。遇到这种情况就必须在基线条件下多加一个 【return】语句 why? 其实就是人为两种情况,第一种就是t是节点,此时只需要将节点平方就可以了。第二种情况就是有分支,首先呢就将root平方,再将分支进行处理。 1 def l ......
CS61A_lab08
题目: Write the generator function make_generators_generator, which takes a zero-argument generator function g and returns a generator that yields gener ......