Question 2
The functional paradigm has been described as one response to the challenge of developing alternative models to the imperative paradigm for dealing with different types of problem. Examples of such problems may be found in natural language processing, rule based systems, theorem proving and symbolic computation.
In your own words, explain the difference between a functional paradigm and an imperative paradigm. Include in your discussion, the concept of state, assignment, referential transparency, source, domain, target, codomain and range.
(7 Marks)
The foundation of the functional paradigm is the λ – calculus developed by Alonzo Church in 1941.
Give an example of a lambda expression for a function that gives the cube of a real number. Is your function total or partial? Justify your answer. Hence define a pure (or uninterpreted) λ – calculus in terms of identifier, application and abstraction. Include examples for each and a set of BNF grammar rules for the syntax of the pure λ – calculus.
(6 Marks)
Using an example of your own describe how either Lisp or Haskell could be used to accomplish a task incorporating conditionals and recursion.
(4 Marks)
What is the difference between static and dynamic type checking and what are the relative advantages and disadvantages