Question: 1A.) In Racket define your own function that takes a single integer as an argument and returns a Boolean that indicates whether the number is

1A.) In Racket define your own function that takes a single integer as an argument and returns a Boolean that indicates whether the number is divisible by 5. You do not have to perform error checking on the input.

Input: An integer

Output: A Boolean

Examples:

> (divisible-by-5 14)

#f

> (divisible-by-5 25)

#t

> (divisible-by-5 30)

#t Function 2: function-7 a. In CLISP define a function that takes a function as an argument and passes the number 7 to that function. The function argument must be able to accept a single integer as its argument. b. In Racket define a function that takes a function as an argument and passes the number 7 to that function. The function argument must be able to accept a single integer as its argument.

Input: A named function which takes a single number as an argument.

Output: The value returned by applying the name function to the number 7.

Examples:

> (function-7 sqrt)

2.645751311064591

> (function-7 (lambda (x) (+ x 7)))

14

> (function-7 add1)

8 Function 3: fib a. In CLISP define a function using recursion to compute the Fibonacci number of n (where n is a positive integer)

b. In Racket define a function using recursion to compute the Fibonacci number of n (where n is a positive integer) Fib(n) = 1 for n = 0 or n = 1 Fib(n) = Fib(n-1) + Fib(n-2) for n > 1 Input: A positive integer used to calculate a Fibonacci number

Output: The value returned given the input integer

Examples:

> (fib 1)

1

> (fib 5)

5

> (fib 10)

55

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!