3 ms·
I believe the best definition of a functional programming language is a language that uses lambda calculus as its evaluation model. In that sense, we can inclu
by ilovecaching 8y ago
I believe the best definition of a functional programming language is a language that uses lambda calculus as its evaluation model.
In that sense, we can include languages like Erlang and Ocaml that are not purely functional (not functional in the mathematical sense), but are expression based in their form of computation.
We can also exclude languages Python and JavaScript, which technically allows functions as first order objects, but are decidedly not expression based (statements and control flow do not produce values).
As for Rust, it is primarily expression based, and even things that seem like statements, such as return, secretly produce a value that is part of an expression. Like Erlang, it allows for sequenced expressions with multiple expression statements in a single function body, which is odd, but necessary if the goal is to sidestep purity. It also has a let syntax, but this is different from Haskell's let which is simply a way of introducing a sub-expression to be applied in a primary expression. One could use the Rust let in this way, but it can also be used for statement based programming, such as let x = x + 1;
Therefore, since it is primarily expression based, I would say that Rust is functional. Stylistically it can look very imperative, but so can Haskell, as the article points out.