发布时间:2014-08-31 21:16:26
Exercise 1.12Write a procedure that computes elements of Pascal's triangle by means of a recursive process. 点击(此处)折叠或打开def elem(n, m) { if (m == 1 || m == n) return 1 else if (m < 1 || .........【阅读全文】
发布时间:2014-08-30 20:52:38
Exercise 1.11. A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n> 3. Write a procedure that computes f by means of a recursive process. Write a procedure that computes f by means of an iterative process.点击(此处)折叠或打开.........【阅读全文】
发布时间:2014-08-21 18:33:45
看《SICP》看得我都快精神分裂了。这书对自己的思维方式,以及对数据,程序的理解,都是种挑战。用groovy重写了一下第二章中对pair的两种特别诡异的实现。法1:def make_pair(x, y) { return { i -> return i?y:x; }}def getx(pair) { return pair(0);}def gety(pair) {.........【阅读全文】