referential-transparency

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. ...

Sampling sequences of random numbers in Haskell

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...

What to call OOP's equivalent of "referential transparency"?

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 ...

understanding referential transparency

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...

How do functional languages model side-effects?

Since side-effects break referential transparency, don't they go against the point of functional languages? ...

Why does laziness go well with referential transparency?

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....