3 ms·
But that's precisely the point of functions (not methods, not procedures).
by mrkeen 7y ago
But that's precisely the point of functions (not methods, not procedures).
- AnimalMuppet 7y agoCould you be a bit more specific here? So far, your statement seems like a complete non sequitur.
- mrkeen 7y agoabsolutely! > I don't even know what "based on mathematics" means. Sure - it's too broad to be a useful definition. Perhaps it would be better to say "based on mathematical functions". Function outputs depend only on their inputs. So you can take f(x) == f(x) as true. > Nothing that's nondeterministic can be expressed Sweet! This way my production code can do the same thing as my test code. My job is to know what my code will do. I'll take all the determinism I can get.
- pron 7y ago> Perhaps it would be better to say "based on mathematical functions" OK, and imperative code is "based on mathematical predicate transformers." My point is that some FP advocates use the "based on mathematics" as some marketing tagline that mostly shows they understand neither mathematics nor FP. > Sweet! This way my production code can do the same thing as my test code. My job is to know what my code will do. I'll take all the determinism I can get. That wasn't my point. The expression x ∈ ℕ ∧ x > 10 ∧ x < 12 is perfectly deterministic, but because its components are nondeterministic it cannot be expressed in FP, even though it is very convenient to do so (and commonly done in mathematics).
- deleted 7y ago[deleted]
- pron 7y agoYou are correct that the semantics (meaning) of subroutines in pure functional languages resembles mathematical functions more than their semantics in imperative languages (which is a different mathematical object [1]). But so what? [1]: https://en.wikipedia.org/wiki/Predicate_transformer_semantics https://en.wikipedia.org/wiki/Predicate_transformer_semantic...