Currying subtraction

后端 未结 4 1091
礼貌的吻别
礼貌的吻别 2020-11-27 20:17

If we want to map a function that increases every element of a range by 1, we could write

map (\\x -> x + 1) [1..5]

but I guess most peo

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-27 20:43

    You can use the subtract function instead of - if you want to right-section subtraction:

    map (subtract 1) [1..5]
    

提交回复
热议问题