Does functional programming avoid state?

前端 未结 4 1753
死守一世寂寞
死守一世寂寞 2021-02-01 20:44

According to wikipedia: functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state an

4条回答
  •  青春惊慌失措
    2021-02-01 21:14

    The Wikipedia definition is right. Functional programming avoids state. Functional programming means that you apply a function to a given input and get a result. However, it is guaranteed that your input will not be modified in any way. It doesn't mean that you cannot have a state at all. Monads are perfect example of that.

提交回复
热议问题