This project is to write several functions in Clojure. You may find the functions list() and cons(), and/or the empty list-literal '() to be useful in defining these functions.
Each function should be defined within the same file, and show the results of example executions in the same file.
(my-reverse '(a b (c d) (e (f g))))should return:
((e (f g)) (c d) b a)
(super-reverse '(a b (c d) (e (f g))))should return:
(((g f) e) (d c) b a)
(member? '(1 2) '((1 2) 3 (4 (5 6))))
(member? 3 '((1 2) 3 (4 (5 6))))
(member? '(4 (5 6)) '((1 2) 3 (4 (5 6))))
should all return:
true
and
(member? 1 '((1 2) 3 (4 (5 6))))
(member? 2 '((1 2) 3 (4 (5 6))))
(member? 4 '((1 2) 3 (4 (5 6))))
should all return:
false
(subsequence '(1 2 (3 4) (5 (6 7))) 1 2)
should return:
(2 (3 4))
and
(subsequence '(1 2 3 4 5 6 7) 2 4)
should return:
(3 4 5 6)
If there is any issue with the parameters
(e.g., the list is empty, i is an invalid position/index,
or the list contains fewer than n items beyond position i),
your function should return nil.
Grading Rubric. Each function is worth 25 points, broken down as follows:
Turn in. When your functions work and pass all your tests, make a script file proj05-results in which you:
Submit your project by copying that single file into your personal folder in /home/cs/214/current/:
cp proj05-results /home/cs/214/current/yourUserName
replacing yourUserName with your login name.
The grader will access and grade your project results from there.
Calvin > CS > 214 > Projects > 05 > Functional Programming Practice