Question
Implement the following functions in Scheme using fold-left and map. DO NOT use recursive definition for this problem. 1.Define a function addOne, which takes a
Implement the following functions in Scheme using fold-left and map. DO NOT use recursive definition for this problem.
1.Define a function addOne, which takes a list of numbers and returns a list where each number in the input list is increased by one. For example, (addOne (1 2 3 4)) should return (2 3 4 5), and (addOne (2 4 6 8)) should return (3 5 7 9).
2. Define a function lstOR, which takes a list of Booleans and returns #f if and only if all of the Booleans are false. For example, (lstOR (#t #f)) should return #t, and (lstOR (#f #f)) should return #f. For your convenience, (lstOR ()) is defined as #f (functions and, or implement logical , in Scheme).
3. Define a function removeDup, which takes a list of ordered numbers, and returns a list that is identical to the input except that duplicated numbers are removed. For example, (removeDup (1 1 2)) should return (1 2); (removeDup (3 5 5 7 7 7 9)) should return (3 5 7 9).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started