Write a generic function chainer

Quiz

Write a generic function chainer that takes a starting value, and an array of functions to execute on it (array of symbols for ruby).
The input for each function is the output of the previous function (except the first function, which takes the starting value as it’s input). Return the final value after execution is complete.

我的解答:

大神的解答:

 

此条目发表在算法与数据结构分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

电子邮件地址不会被公开。 必填项已用*标注