4 ms·
The quote says functional programming is a type of declarative programming, not the other way around. Prolog is irrelevant. Backing up to equality as an aside,
by minitech 10y ago
The quote says functional programming is a type of declarative programming, not the other way around. Prolog is irrelevant.
Backing up to equality as an aside, is there any language that will let you determine whether two functions are equal? If the functions that can be compared aren’t restricted to some silly level and the language is Turing-complete, I can’t imagine any better behaviour than Haskell’s that you already mentioned, which you can bring to JavaScript pretty easily.
- catnaroek 10y ago> The quote says functional programming is a type of declarative programming, not the other way around. Well, your quote doesn't even provide a full definition, sooo... > Backing up to equality as an aside, is there any language that will let you determine whether two functions are equal? No, that's obviously undecidable. (Rice's theorem.) But read what I said more carefully. Did I ever say “A functional language lets you determine whether two functions are equal?” I didn't! What I said is “A functional language doesn't let you distinguish equal functions.” Not letting you test functions for equality is a perfectly valid (and, in fact, the only valid) approach in a higher-order language. > which you can bring to JavaScript pretty easily. Not really. I can't undefined JavaScript's existing equality operator.
- minitech 10y ago> a perfectly valid (and, in fact, the only valid) approach I thought as much and it would really help if you would just say these sorts of things outright so the comments are actually useful instead of deeply nested wording quibbles. With that out of the way: you can define a subset of JavaScript that satisfies your third condition by saying “don’t compare functions”. That’s why I didn’t consider it a meaningful condition. Functional programming works best as a paradigm and then we can just call languages where it’s standard “functional languages”. Much simpler.
- catnaroek 10y ago> I thought as much and it would really help if you would just say these sorts of things outright so the comments are actually useful instead of deeply nested wording quibbles. I find it absolutely essential to make perfectly clear what exactly I'm refuting. > With that out of the way: you can define a subset of JavaScript that satisfies your third Second. > condition by saying “don’t compare functions”. That's a different language. Do you know of any implementation of it? > Functional programming works best as a paradigm and then we can just call languages where it’s standard “functional languages”. Much simpler. Nope. A functional language is one that makes it easy to write functional programs, by satisfying the conditions I gave above. A programming language is first and foremost its semantics, whatever the culture of its users.
- minitech 10y ago> Nope. A functional language is one that makes it easy to write functional programs, by satisfying the conditions I gave above. Except you’ve still given no source for the conditions, condition -1 (“a functional language is a procedural language”) is wrong, and a language satisfying the conditions in no way makes it easier to write a functional program just by virtue of satisfying the conditions (because they can be satisfied entirely by removing features you don’t have to use). Maybe you meant “harder to write non-functional programs”. > Second. The last item in a list of three items is not the second item.
- catnaroek 10y ago> condition -1 (“a functional language is a procedural language”) is wrong It's correct. In a procedural language, computations are structured as procedures that may call each other. In a functional language, that condition (plus three additional ones) hold. > and a language satisfying the conditions in no way makes it easier to write a functional program just by virtue of satisfying the conditions Removing pointer arithmetic makes it easier to write programs that don't contain memory errors. Removing spurious distinctions between memory blobs that hold the same value makes it easier to program with mathematical functions. > (because they can be satisfied entirely by removing features you don’t have to use) Removing features creates a different language. Often a nicer one! > Maybe you meant “harder to write non-functional programs”. Nope. That would exclude any general-purpose programming language. Lest you think otherwise: it's very easy to write imperative programs in Haskell and ML. > The last item in a list of three items is not the second item. Zeroth, first, second.