6 ms·
The article is silly, and so is your response. Functional programming most usually, the vast amount of time, refers to a declarative style of programming which
by Dewie 12y ago
The article is silly, and so is your response. Functional programming most usually, the vast amount of time, refers to a declarative style of programming which involves using functions in the more mathematical sense, which means that one tries to avoid state and side effects. Not necessarily as a compiler-mandated thing, but as a convention. Does one still make "functions" from time to time which are really about mutating state and/or side effects? Yes, but then you would say that they are doing a more procedural/imperative style at that point in time. Like java can be procedural, if you try hard enough.
"[...], and all other languages do not." - Demanding that other languages - which might not self-identify as 'functional' - not have something seems like a futile demand. Are those languages just gonna be banned by the almighty FP wizards? :)
I've never seen things like the syntax of lisp, the homoiconicity of lisp, the lazy evaluation of Haskell, be equated with functional programming as a whole.
- munificent 12y ago> The article is silly, and so is your response. Guilty as charged, though I fear the original article doesn't realize it's silly too. > Functional programming most usually, the vast amount of time, refers to a declarative style of programming which involves using functions in the more mathematical sense, which means that one tries to avoid state and side effects. Maybe it's just me, but I've never found most functional code I've seen to be particularly declarative. I certainly like purity and immutability, but much of it still reads imperatively to me, just in a slightly more abstract style. But, then, that's true of OOP code that I like too. I find method calls (in good APIs) just as declarative because there I'm describing what I want the object to do and not how to do it. > Are those languages just gonna be banned by the almighty FP wizards? :) I think they prefer the term "smug Lisp weenies", but they probably wouldn't turn down that title either. :) I think arguments like this are silly because I don't really like any single-paradigm languages. I think functional, object-oriented, imperative, declarative, etc. are all styles and each of those styles has its place, often all within the same program. People (like the author of this post I suspect) like FP because it rejects OOP, but I like OOP because it doesn't reject other styles. Mainstream OOP languages have no qualms about adopting higher-order functions, closures, immutability, and all sorts of different concurrency models. I like simplicity, of course, but I also like having a lot of tools at my disposal and not rejecting some for religious reasons.
- eru 12y ago> Maybe it's just me, but I've never found most functional code I've seen to be particularly declarative. I certainly like purity and immutability, but much of it still reads imperatively to me, just in a slightly more abstract style. How much have you seen? If you can understand Haskell, the ideas in http://gergo.erdi.hu/blog/2012-12-01-static_analysis_with_applicatives/ http://gergo.erdi.hu/blog/2012-12-01-static_analysis_with_ap... are pretty neat and directly exploit declarations.
- sireat 12y agoProlog is the poster child for declarative languages. To some extent SQL and Excel fall into declarative language camp. Functional programming is as you say using functions and avoiding side effects. See Haskell, see ML, see LISP, I do not see declarative languages among them. Two completely different animals.
- Dewie 12y agoYeah, prolog. The declarative language where you just specify what you want, and still have to learn the underlying unification algorithm to use it[1], and sprinkle very procedural cuts around your code in order to keep the algorithm from taking unnecessary paths. > Functional programming is as you say using functions and avoiding side effects. See Haskell, see ML, see LISP, I do not see declarative languages among them. Heh, so you're saying that functional programming is not declarative because it is not prolog et al.? No, functional programming is also considered a declarative style of programming. It doesn't matter that it isn't logical programming, or excel. (If you think this argument is a bit just-so, well it's a reply to the same style of "argument". If you want to claim that FP is not declarative, please argue why it is not declarative.) [1] Which is often more effort to learn compared to the conceptual evaluation model of FP, since the FP evaluation model can often be viewed as a more restricted version of evaluation used in imperative languages.