加载中
【SICP练习】62 练习2.33

 练习2.33 既然要用到accumulate,那么我们先来回顾一下这个函数好了。其有三个参数,一个操作符,一个用来作为初始化的值,一个是需要运算的序列。题目中的map已有的定义如下: (defin...

2015/09/08 21:47
0
【C++注意事项】6 Library string Type

Processing Every Character? Use Range-Based for If we want to do something to every character in a string, by far the best approach is to use a statement introduced by the new s...

【SICP练习】68 练习2.39

 练习2.39 通过前一习题的类比相信已经知道了fold-left和fold-right的内在意义,本题中要求的逆序数可以用cons来构造。具体为,先将list的第一个元素取出用(cons (car list) ‘() )构造,...

2015/09/08 21:47
1
【SICP练习】143 练习3.81

练习3-81 原文 Exercise 3.81. Exercise 3.6 discussed generalizing the random-number generator to allow one to reset the random-number sequence so as to produce repeatable sequen...

【Project Euler】2 第二题

 //Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: //1, 2, 3, 5, 8, 13, 21, 34, ...

2015/09/08 21:48
3
【SICP练习】63 练习2.34

 练习2.34 书中一开始有2个式子,一个是原式,一个根据Horner规则构造出的式子。而我们同样也可以将待求得式子写成这种方式,而且可以更进一步——那就是写成Lisp的前序表示: (+ 1 (* ...

2015/09/08 21:49
1
【SICP练习】67 练习2.38

 练习2.38 这道题比较有意思了,我们先来将fold-left和accumulate类比,accumulate是递归,而fold-left是迭代。前者通过不断地将(op result (car rest)变换成initial,通过将(cdr rest)变...

2015/09/08 21:46
1
【SICP练习】120 练习3.51

练习3-51 原文 Exercise 3.51. In order to take a closer look at delayed evaluation, we will use the following procedure, which simply returns its argument after printing it: (de...

【SICP练习】121 练习3.52

练习3-52 原文 Exercise 3.52. Consider the sequence of expressions (define sum 0) (define (accum x) (set! sum (+ x sum)) sum) (define seq (stream-map accum (stream-enumerate...

【SICP练习】110 练习3.23

练习3-23 原文 Exercise 3.23. A deque (“double-ended queue”) is a sequence in which items can be inserted and deleted at either the front or the rear. Operations on deques are ...

【SICP练习】108 练习3.21

练习3-21 原文 Exercise 3.21. Ben Bitdiddle decides to test the queue implementation described above. He types in the procedures to the Lisp interpreter and proceeds to try them...

【SICP练习】152 练习4.8

练习4-8 原文 Exercise 4.8. “Named let” is a variant of let that has the form (let <var> <bindings> <body>) The and are just as in ordinary let, except that is bound within to ...

没有更多内容

加载失败,请刷新页面

没有更多内容

返回顶部
顶部