Professional Documents
Culture Documents
09 Functional Programming in Common LISP
09 Functional Programming in Common LISP
Topics Covered
Functional Programming
Instructions
1. The problem. This program will add two fractions, possibly improper, and display the sum of
these fractions in proper and simplest format.
2. Input. The input for this program is a simple call to the predicate addFraction(N1, D1, N2,
D2). The function has seven (7) arguments:
a. N1 – the numerator of the first fraction
b. D1 – the denominator of the first fraction
c. N2 – the numerator of the second fraction
d. D2 – the denominator of the second fraction
3. Output. When the function is called, the program simply outputs the sum of the fractions
added in simplest form.
4. Sample Input and Output.
Input Output
(addFraction 1 2 1 4) 0 3 4
(addFraction 3 8 1 2) 0 7 8
(addFraction 7 2 1 4) 3 3 4
This problem is the same with that of the problem given in the previous activities. However,
this solution needs a functional programming approach. Copy and paste your code in the
submission link provided in eLearn.
Deadline
Scoring Tool