Javascript是一种函数式编程语言吗? [英] Is Javascript a Functional Programming Language?
问题描述
仅仅因为函数是第一类对象,有闭包和高阶函数,Javascript是否应该称为函数式编程语言?我认为它缺乏的主要是纯函数,它不像'lisp'等其他函数式语言'感觉'(尽管这不是一个真正的理由,它不是一个功能语言......)
重复 没有可接受的$定义b $ b函数式编程语言。 如果将函数式语言定义为 如果您还考虑像 我建议您阅读相关博客文章中的 Just because functions are first class objects, there are closures, and higher order functions, does Javascript deserve to be called a Functional Programming language? The main thing I think it lacks is Pure Functions, and it doesn't 'feel' like other functional languages, like lisp (although thats not really a good reason for it not to be a functional langauge...) Repeating my own answer to a similar question, There's no accepted definition of
functional programming language. If you define functional language as
the language that supports first class
functions and lambdas, then yes, JavaScript *is* a
functional language. If you also consider the factors like
support for immutability, algebraic
data types, pattern matching, partial
application etc then no, JavaScript
*is not* a functional language. I'd encourage you to read the
following related blog posts (and also
the comments below them):
这篇关于Javascript是一种函数式编程语言吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
,那么支持第一类
函数和lambdas的语言,那么是的,JavaScript *是*
函数式语言。
这样的因素支持不变性,代数
数据类型,模式匹配,部分
应用等,然后不,JavaScript
*不是一种功能语言。
(以及
下方的注释):