markdown JS:什么是函数式编程?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown JS:什么是函数式编程?相关的知识,希望对你有一定的参考价值。

## What is functional programming?
Functional programming produces programs by composing mathematical functions and avoids shared state & mutable data. Lisp (specified in 1958) was among the first languages to support functional programming, and was heavily inspired by lambda calculus. Lisp and many Lisp family languages are still in common use today.

Functional programming is an essential concept in JavaScript (one of the two pillars of JavaScript). Several common functional utilities were added to JavaScript in ES5.

**Good to hear:**

- Pure functions / function purity.
- Avoid side-effects.
- Simple function composition.
- Examples of functional languages: Lisp, ML, Haskell, Erlang, Clojure, Elm, F Sharp, OCaml, etc…
- Mention of features that support FP: first-class functions, higher order functions, functions as arguments/values.

**Red flags:**

- No mention of pure functions / avoiding side-effects.
- Unable to provide examples of functional programming languages.
- Unable to identify the features of JavaScript that enable FP.
- 

以上是关于markdown JS:什么是函数式编程?的主要内容,如果未能解决你的问题,请参考以下文章

js函数式编程简介

翻译连载 | JavaScript 轻量级函数式编程-第1章:为什么使用函数式编程?|《你不知道的JS》姊妹篇

js函数式编程--函子

JS如何函数式编程?看这就够了!

为什么要函数式编程

js函数式编程基础:高阶函数柯理化函数合成Loadash