Home > DeveloperSection > Interviews > What is Referential Transprency in Erlang

Posted on    June-24-2015 1:47 AM

 erlang Functional Programming  Concurrent Programming  erlang 
Ratings:
 1 Answer(s)
  298  View(s)
Rate this:

Mayank Tripathi
Mayank Tripathi

Total Post:807

Points:4035
Posted on    June-24-2015 1:47 AM

A function with the same parameter should always return the same result:

x = add_two_to(3) = 5
∴ x = 5
Functions always returning the same result for the same parameter is called referential transparency. It's what lets us replace add_two_to(3) with 5, as the result of 3+2 will always be 5.

Don't want to miss updates? Please click the below button!

Follow MindStick