a) Explain the terms pure function and referentially transparent expression. Give an example of each. 


b) Explain the terms domain and range, as they pertain to functions in functional programming. Choose a programming language that has a square root function. What is the domain and range of the square root function? Is this a partial function or not? Explain your answer.

c) Using a functional language of your choice, write a recursive function duplicate which duplicates every item in a list. For example, applying duplicate to the list [3,5,6,8] should give the result [3,3,5,5,6,6,8,8].

Leave an answer

Sorry, you do not have permission to answer to this question .