5 ms·
Rust isn't a functional programming language. You could try OCaml, it's kind of a halfway point between Go and Haskell.
by yawaramin 5y ago
Rust isn't a functional programming language. You could try OCaml, it's kind of a halfway point between Go and Haskell.
- int_19h 5y agoRust has first-class functions. Not only that, but it also has immutability by default, and ADTs with pattern matching. If OCaml is functional, why wouldn't Rust be?
- chombier 5y agoBecause of lifetime of captured variables in closures, mostly. You can't really pass around functions freely like you would in Haskell/ML unless you start Box-ing/Rc-ing everything. But then it's not really idiomatic Rust anymore, IIUC.
- lmm 5y agoRust doesn't really have first-class functions - you can't take an arbitrary snippet of code and turn it into a function value, because sometimes it will no longer pass the borrow checker.
- yawaramin 5y agoWell, one big one is lack of tail call elimination. If you can't write even a simple tail-recursive algorithm in the language, it's not a functional programming language.