请问如何实现类似的递归运算,例如表的某一列,X=X.move(1) + a\2,X 的初值为 a
可以使用 accumulate 或 reduce 高阶函数实现递归,两者区别是,前者会输出递归的中间结果,后者只输出最终结果。
a = 1..10x = adef f1(x, a){ return x.move(1) + a\2}print accumulate(f1{, a}, NULL, X)