Seasoned Schemer一书中,第12页的scramble函数,描述是什么意思?

函数描述:
The function scramble takes a non-empty tup in which no number is greater than its own index, and returns a tup of the same lenght. Each number is the argument is treated as a backward index from its own position to a point earlier in the tup. The result at each position is found by counting backward from the current position according to this index.

What's the value of (scramble tup) where tup is (1 1 1 3 4 2 1 1 9 2)

Answer: (1 1 1 1 1 4 1 1 1 9)


MMTTMM
浏览 750回答 1
1回答

杨__羊羊

一开始我也没看懂,后来看了函数的定义才弄明白了,新的列表的每个子元素是原来每个对应子元素的向前追溯其值个.1就代表本身,2就是前一个.
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Html5