DEV Community

Discussion on: What's a Pure Function?

 
phantas0s profile image
Matthieu Cneude

More recently we have programming languages which can reason effectively about functions, which is why functional programming is becoming more popular.

Do you think about Haskell? The only functional programming languages I used are Scheme and Clojure.

Thread Thread
 
pentacular profile image
pentacular

I think that Haskell is a good example, Miranda and Clean also.

Prolog and Mercury also, although things like the cut operator make it a bit more complicated.

Scheme and clojure are both procedural languages, with good support for function composition.
Clojure has good support for immutable data structures, but that's not quite what we're after here.

The ACL2 theorem prover is probably the closest in the lisp family.

C++ is gradually trying to get its toes wet with things like constexpr functions, and templates, but ... :)

Which is not to say that procedures and algorithms are bad, and functions are good -- it's just that procedures are easy to execute and functions involve harder proof-work -- there are good economic reasons for the bias toward procedures in programming languages.