【发布时间】:2014-05-30 04:01:15
【问题描述】:
这两天我一直对完成这类问题感到困惑。
生成的函数(由 makeMixer)将整数 N 作为输入,并输出原始列表中的第 N 项。例如,如果 makeListPickerFor 被调用如下:
(makeListPickerFor '(4 0 -2 -3 5))
将生成一个函数,该函数将整数作为输入,例如 3, 并返回列表中的那个项目(对于 3,它会输出 -2,因为 -2 是原始列表中的第 3 项)。
因此,如果原始调用如下:
(define S (makeListPickerFor '(4 0 -2 -3 5)))
那么生成的函数 S 的行为如下:
(S 4) *** would return -3, because -3 is the 4th item in the original list
(S 2) *** would return 0, because 0 is the 2nd item in the original list
任何对正确方向的帮助都会大有帮助。
【问题讨论】: