Consecutive pairs from list in haskell
问题 How can I get a list of consecutive pairs (tuples) from a list without recursion ? For example : [1, 2, 3, 4] would be [(1, 2), (2, 3), (3, 4)] 回答1: \xs -> zip xs $ tail xs or zip <*> tail . 来源: https://stackoverflow.com/questions/36670539/consecutive-pairs-from-list-in-haskell