Here is the problem:
Neither functional programming languages nor logic programming languages are thought of as 'practical' programming languages. Choose either Lisp or Prolog and recommend changes to the language which you think would increase acceptance of the language in mainstream programming.
Justify your recommendations
1) Imperative model
You are acquainted with the imperative model - a statement like
pay = hours * 6.65;
changes the state of the processor. In this case, the memory location referenced by the variable pay has its content changed to the result of fetching the content of the memory address referenced by hours and multiplying it by the constant. A program is a sequence of changes of state.Much of the course will be devoted to pointing out variations in the imperative model.
2) Logic-oriented model
You are not so familiar with the logic-oriented model. Our example language will be Prolog. In Prolog we can write databases of facts, like
Then we can add some intelligence to our database. It ought to be easy to figure out from the facts when a person Y is a grandmother of a person X, so we write
grandmother(X,Y) :- mother(X,Z), mother(Z,Y).
grandmother(X,Y) :- father(X,Z), mother(Z,Y).
Instead of writing a procedure to figure out when Y is a grandmother of X, as we would in an imperative language, we define what it means to be a grandmother in terms of the facts we have. The symbol ":-" means "if". Now we can write a query like
and we expect ...