随笔分类 - sicp
摘要:
Exercise 2.41 Write a procedure to find all ordered triples of distinct positive integers i, j, and k less than or equal to a given integer n that sum
阅读全文
![sicp每日一题[2.41]](https://img2024.cnblogs.com/blog/3223467/202410/3223467-20241011082340154-1765540272.png)
摘要:
Exercise2.40 Define a procedure unique-pairs that, given an integer n, generates the sequence of pairs (i, j) with 1 < j < i < n. Use unique-pairs to
阅读全文
![sicp每日一题[2.40]](https://img2024.cnblogs.com/blog/3223467/202410/3223467-20241010083804698-527601139.png)
摘要:
Exercise 2.38 The accumulate procedure is also known as fold-right, because it combines the first element of the sequence with the result of combining
阅读全文
![sicp每日一题[2.38-2.39]](https://img2024.cnblogs.com/blog/3223467/202410/3223467-20241009090134536-1115269468.png)
摘要:
果然习惯不能停,就两天没学,昨天就忘的干干净净了。。今天把昨天的补上 Exercise 2.36 The procedure accumulate-n is similar to accumulate except that it takes as its third argument a sequ
阅读全文
![sicp每日一题[2.36-2.37]](https://img2024.cnblogs.com/blog/3223467/202410/3223467-20241008112514593-1989310994.png)
摘要:
十一去喀纳斯玩了2天,今天恢复,才几天没看书再看到代码就感到有点陌生了。。 Exercise 2.35 Redefine count-leaves from Section 2.2.2 as an accumulation: (define (count-leaves t) (accumulate
阅读全文
![sicp每日一题[2.35]](https://img2024.cnblogs.com/blog/3223467/202410/3223467-20241006213004536-1580057846.png)
摘要:
Exercise 2.34 Evaluating a polynomial in x at a given value of x can be formulated as an accumulation. We evaluate the polynomial an x^n + a{n-1} x^(n
阅读全文
![sicp每日一题[2.34]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240930170414764-154995728.png)
摘要:
Exercise 2.33 Fill in the missing expressions to complete the following definitions of some basic list-manipulation operations as accumulations: ; p 表
阅读全文
![sicp每日一题[2.33]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240929082716814-128536759.png)
摘要:
上一道题没什么改动,再来一道 Exercise 2.32 We can represent a set as a list of distinct elements, and we can represent the set of all subsets of the set as a list o
阅读全文
![sicp每日一题[2.32]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240928083955373-851547907.png)
摘要:
Exercise 2.31 Abstract your answer to Exercise 2.30 to produce a procedure $tree-map$ with the property that $square-tree$ could be defined as (define
阅读全文
![sicp每日一题[2.31]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240928083654072-1169250715.png)
摘要:
Exercise 2.30 Define a procedure square-tree analogous to the square-list procedure of Exercise 2.21. That is, square-tree should behave as follows: (
阅读全文
![sicp每日一题[2.30]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240927081350110-1693270007.png)
摘要:
Exercise 2.29 A binary mobile consists of two branches, a left branch and a right branch. Each branch is a rod of a certain length, from which hangs e
阅读全文
![sicp每日一题[2.29]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240926120700836-1806787036.png)
摘要:
Exercise2.28 Write a procedure fringe that takes as argument a tree (represented as a list) and returns a list whose elements are all the leaves of th
阅读全文
![sicp每日一题[2.28]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240925112144268-406400325.png)
摘要:
2.24-2.26没什么代码量,所以跟 2.27 一起发吧。 Exercise 2.24 Suppose we evaluate the expression (list 1 (list 2 (list 3 4))). Give the result printed by the interpret
阅读全文
![sicp每日一题[2.24-2.27]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240924104048409-1964759034.png)
摘要:
Exercise2.22 Louis Reasoner tries to rewrite the first square-list procedure of Exercise 2.21 so that it evolves an iterative process: (define (square
阅读全文
![sicp每日一题[2.22-2.23]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240923105908135-1388987017.png)
摘要:
Exercise 2.21 The procedure square-list takes a list of numbers as argument and returns a list of the squares of those numbers. (square-list (list 1 2
阅读全文
![sicp每日一题[2.21]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240922083411098-1922685940.png)
摘要:
Exercise 2.20 The procedures +, *, and list take arbitrary numbers of arguments. One way to define such procedures is to use define with dotted-tail n
阅读全文
![sicp每日一题[2.20]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240921114008793-98463270.png)
摘要:
Exercise 2.19 Consider the change-counting program of Section 1.2.2. It would be nice to be able to easily change the currency used by the program, so
阅读全文
![sicp每日一题[2.19]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240920080320913-807229981.png)
摘要:
Exercise 2.18 Define a procedure reverse that takes a list as argument and returns a list of the same elements in reverse order: (reverse (list 1 4 9
阅读全文
![sicp每日一题[2.18]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240919102621791-1952515045.png)
摘要:
Exercise 2.17 Define a procedure last-pair that returns the list that contains only the last element of a given (nonempty) list: (last-pair (list 23 7
阅读全文
![sicp每日一题[2.17]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240918140211845-31386677.png)
摘要:
Exercise 2.13 Show that under the assumption of small percentage tolerances there is a simple formula for the approximate percentage tolerance of the
阅读全文
![sicp每日一题[2.13-2.16]](https://img2024.cnblogs.com/blog/3223467/202409/3223467-20240917132015203-2120725620.png)