Haskell function composition

后端 未结 6 1487
梦如初夏
梦如初夏 2021-02-01 14:42

I am reading this tutorial on Haskell. They define function composition as the following:

(.)                     :: (b->c) -> (a->b) -> (a-         


        
6条回答
  •  再見小時候
    2021-02-01 15:10

    From the HaskellWiki page on function composition:

    desort = (reverse . sort)
    

    Now desort is a function that sorts a list in reverse. Basically, desort feeds it's arguments into sort, and then feeds the return value from sort into reverse, an returns that. So it sorts it, and then it reverses the sorted list.

提交回复
热议问题