There is no such thing as a functional language.
You can write functionally in any language.
Also, different languages have different functional features.
Feature | C | C++ | Haskell | Idris | Java | OCaml | Python | Rust | Scala |
---|---|---|---|---|---|---|---|---|---|
Closures | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |||
Downwards Funarg Problem | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
Functions | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
Guaranteed Tail Call Optimization | ✔️ | ✔️ | ❌ | ✔️ | |||||
Lambda Abstraction Syntax | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
Pure Functions | ❌ | ✔️ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | |
Upwards Funarg Problem | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ |
Feature | C | C++ | Haskell | Idris | Java | OCaml | Python | Rust | Scala |
---|---|---|---|---|---|---|---|---|---|
Ad Hoc Polymorphism | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
Algebraic Data Types | ❌ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | ✔️ | ✔️ | |
Dependent Types | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | |
Forces Immutability | ❌ | ❌ | ✔️ | ✔️ | ✔️ | ❌ | ✔️ | ||
Immutable Data | ❌ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
Laziness By Default | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | ❌ | |
Parametric Modules | ❌ | ❌ | ✔️ | ✔️ | ❌ | ❌ | ✔️ | ||
Parametric Polymorphism | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | |
Pattern Matching | ✔️ | ✔️ | ✔️ | ✔️ | |||||
Pattern Matching Alternatives | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ||||
Pattern Matching Variable Introduction | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ||||
Polymorphic Recursion | ❌ | ❌ | ✔️ | ✔️ | ❌ | ✔️ | ✔️ | ||
Referential Transparency | ✔️ | ✔️ | ❌ | ||||||
Row Polymorphism | ❌ | ❌ | ❌ | ✔️ | ❌ | ||||
Static Typing | ✔️ | ✔️ | ✔️ | ✔️ | ✔️ | ❌ | ✔️ | ✔️ | |
Totality Checking | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ | |
Uniqueness Types | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | ✔️ | ❌ | |
Universe Polymorphism | ❌ | ❌ | ❌ | ✔️ | ❌ | ❌ | ❌ | ❌ |
A well implemented feature counts as 1, a hard-to-use one counts as 0.5. Supporting featurues count twice less.
Language | Score |
---|---|
Idris | 15.0 |
Haskell | 13.5 |
OCaml | 11.5 |
Scala | 10.75 |
Rust | 9.25 |
Python | 7.0 |
C++ | 6.75 |
Java | 5.0 |
C | 2.25 |