38 ms·
Calling them 'pure' may be incorrect depending on how high your standards are. Rust functions (which don't take mutable references) are incapable of modifying
by TwentyPosts 2y ago
Calling them 'pure' may be incorrect depending on how high your standards are.
Rust functions (which don't take mutable references) are incapable of modifying anything you pass into them, and any sort of global state is heavily discouraged.
This is pretty good as far as "pure" goes, but of course, they can perform I/O. (Then again, without any side effects a program would do nothing at all behind heating up your CPU, so this seems like a fair trade-off.)
What makes Rust functional are the patterns you can use in the language, though. A lot ot of maps, a lot of filters, a lot of iterators and algebgaic data types and pattern matching.