What do we call this (new?) higher-order function?

后端 未结 16 1973
盖世英雄少女心
盖世英雄少女心 2021-02-05 23:44

I am trying to name what I think is a new idea for a higher-order function. To the important part, here is the code in Python and Haskell to demonstrate the concept, which will

16条回答
  •  自闭症患者
    2021-02-06 00:36

    this seems like ruby's each_cons

    ruby-1.9.2-p0 > (1..10).each_cons(2).to_a
    
    => [[1, 2], [2, 3], [3, 4], [4, 5], [5, 6], [6, 7], [7, 8], [8, 9], [9, 10]] 
    

提交回复
热议问题