How do these 'reverse' and 'twist' functions work in Ruby? (functional programming)

后端 未结 0 1505
感情败类
感情败类 2020-12-02 14:08

I redefined function fold using reduce method in Ruby.

def fold(f, init, lst)
    lst.reduce(init){|w, a| f.call(w, a)}
end
<         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题