04 2023 档案

摘要:内容参照 相关阅读推荐 首先是递归获得阶乘的例子 (define f (lambda (x) (cond ((= x 1) 1) (else (* x (f (- x 1))))))) 对应的lambda (f): (lambda (f) (lambda (x) (cond ((= x 1) 1) 阅读全文
posted @ 2023-04-27 15:34 哎呦_不想学习哟~ 阅读(16) 评论(0) 推荐(0) 编辑
摘要:(define (list-change total denoms) (define (cons-all num ls) (let ((num-val num)) (cond ((null? ls) nil) (else (cons (cons num (car ls)) (cons-all num 阅读全文
posted @ 2023-04-26 08:04 哎呦_不想学习哟~ 阅读(81) 评论(0) 推荐(0) 编辑
摘要:def mutate_reverse(link): """Mutates the Link so that its elements are reversed. >>> link = Link(1) >>> mutate_reverse(link) >>> link Link(1) >>> link 阅读全文
posted @ 2023-04-22 20:13 哎呦_不想学习哟~ 阅读(35) 评论(0) 推荐(0) 编辑
摘要:(define-macro (switch expr cases) (cons 'cond (map (lambda (case) (cons (eq? (eval expr) (car case)) (cdr case))) cases)) ) 这段代码是一个用于 Scheme 语言的宏定义,可以 阅读全文
posted @ 2023-04-21 21:43 哎呦_不想学习哟~ 阅读(100) 评论(0) 推荐(0) 编辑
摘要:(define-macro (def func args body) `(define ,(cons func args) ,body)) 分析: 定义一个万能的函数定义,那就要模拟函数定义的样子。ok,函数定义是什么样子的呢? eg: (define (filter-lst fn lst) (if 阅读全文
posted @ 2023-04-21 10:14 哎呦_不想学习哟~ 阅读(24) 评论(0) 推荐(0) 编辑
摘要:#lang sicp (define (unique s) (if (null? s) nil (cons (car s) (unique (filter (lambfa (x) (not (eq? x (car s)))) (cdr s))) ) ) ) 这是一个Scheme函数,名为unique 阅读全文
posted @ 2023-04-19 18:58 哎呦_不想学习哟~ 阅读(32) 评论(0) 推荐(0) 编辑
摘要:1.list quote quasiquote The list procedure takes in an arbitrary amount of arguments. Because it is a procedure, all operands are evaluated when list 阅读全文
posted @ 2023-04-18 18:18 哎呦_不想学习哟~ 阅读(30) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2023-04-17 18:57 哎呦_不想学习哟~ 阅读(41) 评论(0) 推荐(0) 编辑
摘要:item 1: 使用断言 item 2: Just end all of your lines with a comma 阅读全文
posted @ 2023-04-15 16:43 哎呦_不想学习哟~ 阅读(7) 评论(0) 推荐(0) 编辑
摘要:def reduce_armor(self, amount): """Reduce armor by AMOUNT, and remove the FireAnt from its place if it has no armor remaining. Make sure to damage eac 阅读全文
posted @ 2023-04-14 15:38 哎呦_不想学习哟~ 阅读(79) 评论(0) 推荐(0) 编辑
摘要:题目: def is_bst(t): """Returns True if the Tree t has the structure of a valid BST. >>> t1 = Tree(6, [Tree(2, [Tree(1), Tree(4)]), Tree(7, [Tree(7), Tr 阅读全文
posted @ 2023-04-13 08:29 哎呦_不想学习哟~ 阅读(86) 评论(0) 推荐(0) 编辑
摘要:重点:: 观察到:在带入函数之后,没有任何返回值,是直接对参数本身进行作用。遇到这种情况就必须在基线条件下多加一个 【return】语句 why? 其实就是人为两种情况,第一种就是t是节点,此时只需要将节点平方就可以了。第二种情况就是有分支,首先呢就将root平方,再将分支进行处理。 1 def l 阅读全文
posted @ 2023-04-10 15:35 哎呦_不想学习哟~ 阅读(51) 评论(0) 推荐(0) 编辑
摘要:#include<iostream> using namespace std; int f(int** r, int ** s){ int temp= **r; int temp2=**s; int * z=*r; *r=*s; *s=z; printf("**r= %d\n",**r); prin 阅读全文
posted @ 2023-04-08 11:09 哎呦_不想学习哟~ 阅读(16) 评论(0) 推荐(0) 编辑
摘要:题目:about generator Write the generator function make_generators_generator, which takes a zero-argument generator function g and returns a generator th 阅读全文
posted @ 2023-04-06 19:55 哎呦_不想学习哟~ 阅读(57) 评论(0) 推荐(0) 编辑
摘要:def close(n, smallest=10, d=10): """ A sequence is near increasing if each element but the last two is smaller than all elements following its subsequ 阅读全文
posted @ 2023-04-05 15:43 哎呦_不想学习哟~ 阅读(75) 评论(0) 推荐(0) 编辑
摘要:pre_old_time: /*** 然后按下enter按键,就可以用n来跳转 N回跳 编辑模式下 输入 【 :noh 】 可以取消高亮 从当前行开始进入编辑模式 vim f命令可以定位到指定字符,;右重复,,向左重复 移动到前一个单词的末尾:ge d0:删除当前位置到行开头的所有内容,不会删除光标 阅读全文
posted @ 2023-04-04 21:00 哎呦_不想学习哟~ 阅读(71) 评论(0) 推荐(0) 编辑
摘要:Problem 2 题目描述: 代码: 1 def inc_subseqs(s): 2 """Assuming that S is a list, return a nested list of all subsequences 3 of S (a list of lists) for which 阅读全文
posted @ 2023-04-03 16:54 哎呦_不想学习哟~ 阅读(42) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示