3 ms·
None of these are examples of lack of purity. Maybe they are examples of lack of portability. But not of lack of purity. Purity means that the result of an exp
by hristov 16y ago
None of these are examples of lack of purity. Maybe they are examples of lack of portability. But not of lack of purity.
Purity means that the result of an expression is the same while the program is running. These calculations may differ if run on different computers or sometimes even if run at different times on the same computer, but once you run them you can be reasonably sure that they return the same result while the program is running.
- ezyang 16y agoOne of the things I want out of pure programs is reproducibility. If a pure fragment of code doesn't give the same result over multiple executions, that's not very reproducible. Maybe that's OK, but it does make my ears twitch.