4 ms·
Pure functions, i.e. that are 1) idempotent 2) have all their arguments passed in 3) cause no side effects as a by product of evaluating the function are fundam
by markfsharp 10y ago
Pure functions, i.e. that are 1) idempotent 2) have all their arguments passed in 3) cause no side effects as a by product of evaluating the function are fundamental to functional programming.
- louthy 10y agoBut not fundamental to the definition of a functional language. F# isn't pure, but most would call it a functional language - so purity is surely not 'fundamental' - in fact most functional languages aren't pure. That's why I prefer to stick to the 'expression oriented' concept, it seems to be the thing that captures most, if not all, functional languages. But I guess just like there are plenty of people that wouldn't call Java OO (and would prefer the Alan Kay definition), there are plenty that will disagree with any definition of 'functional' (preparing for the inevitable 'functional first' comment).
- markfsharp 10y agoYeah, I could go along with that.
- vram22 10y agoAre there any terms/concepts in math/CS that are related to or similar to "idempotence"?
- phyllostachys 10y agoI think in this case, referential transparency means the same thing. That is, produce the same output given the same input, every time.
- vram22 10y agoGot it, thanks.