3 ms·
Mmm maybe, but none of those languages (afaik) have explicitly pure functions which is the keystone of functional programming.
by IshKebab 7y ago
Mmm maybe, but none of those languages (afaik) have explicitly pure functions which is the keystone of functional programming.
- eru 7y agoOCaml is a functional-enough language. It ain't pure either. A language that can track purity is great, but not absolutely required. Btw, the D language does have facilities to track purity. It's not a functional language, though.
- didibus 7y agoActually it depends who you ask. There's kind of two school of thought. One says FP is about using functions with closures, higher order functions and anonymous functions as the main building blocks for modeling your program logic. This style is championed by Scheme and other Lisps. It is also slowly creeping up in all major languages. The other is about immutable data and pure functions, and modeling your program using those as your main building blocks. Either as much as possible, and sometimes even going as far as restricting yourself only to this.
- dirkt 7y agoIt's really really hard to get things right with pure functions. Haskell struggled with this for decades. You can't expect to be able to import this in some random language and just make it work. So random languages just pick what they like (lambda expressions, weaker forms of algebraic data types, sometimes the complete typeclass concept, various forms of Monads from "unnecessarily specialized because whoever picked it didn't understand it" to "properly done"0. And while having pure functions certainly forces you to get things right, you don't need to do this when copying ideas. And there are functional languages (some very old, like Lisp) that never had pure functions in the first places.