3 ms·
What kind of mathematical correctness are you getting by using FP? The same kinds that the Rust compiler offers?
by threatofrain 7y ago
What kind of mathematical correctness are you getting by using FP? The same kinds that the Rust compiler offers?
- Filligree 7y agoDifferent, but related. If you call 'map' then you know you're not mutating the values, and you get an output the same size as the input without dropping values, and... It means you operate on a higher level of abstraction, and that inherently makes reading code faster. Not per line of code, but certainly per functional unit. Idiomatic Rust tends to use a lot of functional code, and provides all the tools to make that safe. Its map function could mutate the input -- it would be unidiomatic, but certainly possible -- except that, if you don't pass a mutable reference, then you're safe to assume it won't.