All Questions
3 questions
17
votes
5
answers
6k
views
Is there a non-deterministic function without side effects?
By definition, a pure function is deterministic + no side effect.
Is there any example for a function which has no side effects, but is non-deterministic? I.e., a function without side effects, but ...
48
votes
7
answers
27k
views
What do you call a function where the same input will always return the same output, but also has side effects?
Say we have a normal pure function such as
function add(a, b) {
return a + b
}
And then we alter it such that it has a side effect
function add(a, b) {
writeToDatabase(Math.random())
return a +...
8
votes
2
answers
2k
views
Alternative to language purity
Purity
One of the interesting concepts in Haskell is the purity. However, I am wondering what the pragmatic reasons behind this is - let me explain a bit more before you reject my question.
My main ...