WHAT IS REFERENTIAL TRANSPRENCY IN ERLANG

Mayank Tripathi

Total Post:807

Points:4035
Posted by  Mayank Tripathi
 556  View(s)
Ratings:
Rate this:
  1. Mayank Tripathi

    Post:807

    Points:4035
    What is Referential Transprency in Erlang

    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.

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!