Are closures a violation of the functional programming paradigm?

前端 未结 4 1483
伪装坚强ぢ
伪装坚强ぢ 2021-01-31 18:32

Functional programming \"avoids state and mutable data\".

Closures hide state by binding their lexical environment and are thus closed over their free variables

4条回答
  •  半阙折子戏
    2021-01-31 18:50

    In Haskell, closures have free variables in the same way that in math you can write f x = x^2 - it doesn't mutate state.

    I would say that Haskell avoids mutable state.

提交回复
热议问题