You are on page 1of 1

9.

Functional Programming in Common LISP


Learning Outcomes

By the end of this activity, the students should be able to:


1. Program a solution to a simple programming problem in Common LISP using functional
programming approach.

Topics Covered

Functional Programming

Prior Knowledge Required


Basics of Common LISP Programming

Materials and Resources


Steel Bank Common LISP

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

August 10, 2019

Scoring Tool

10 pts correct I/O, follows all required specifications


8 pts minor negligible error(s)
4 pts major non-negligible error(s)
1 pt there is an attempt
0 pt no attempt

You might also like