What is referential transparency?
What does the term referential transparency mean? I've heard it described as "it means you can replace equals with equals" but this seems like an inadequate explanation. ...
What does the term referential transparency mean? I've heard it described as "it means you can replace equals with equals" but this seems like an inadequate explanation. ...
I need small lists of gaussian random numbers for a simulation and so I tried the following: import System.Random seed = 10101 gen = mkStdGen seed boxMuller mu sigma (r1,r2) = mu + sigma * sqrt (-2 * log r1) * cos (2 * pi * r2) This is just the Box-Muller algorithm - given r1, r2 uniform random numbers in the [0,1] interval it ret...
My understanding is that the term "referential transparency" can really only be applied to functional code. However, a method call on an object in object-oriented code can have a similar property, which is that the return value of the method, and the state of the object after a method call depends only on the state of the object before ...
Generally, I have a headache because something is wrong with my reasoning: For 1 set of arguments, referential transparent function will always return 1 set of output values. that means that such function could be represented as a truth table (a table where 1 set of output parameters is specified for 1 set of arguments). that makes the...
Since side-effects break referential transparency, don't they go against the point of functional languages? ...
Hello. I was reading a Haskell tutorial (Learn You a Haskell) in which the author said that laziness goes well with referential transparency. After more reading and some searching, I still don't understand why. Note that I do understand what's great about referential transparency and laziness, but it's them together that's troubling me....