Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Scheme Expression 3. Write a recursive function to count the number of the elements of a list. Please name the function as count-elements. This function

Scheme Expression

3. Write a recursive function to count the number of the elements of a list. Please name the function as count-elements. This function should tell how many elements are contained in a list. For example, (count-elements '(a (b c) (d (e) f ))) returns 3.

4. Write a recursive function to count the number of the atoms that appear at all levels of an S-expression. Please name the function as count-atoms. This function should tell how many atoms are contained in a s-expression. For example, (count-atoms '(a (b c) (d (e) f))) returns 6.

5. Write a recursive function to get the maximum number from a sequence of numbers. Please name the function as max. This function should tell the maximum number in a given list.

For example, (max ( 5 6 9 3 6)) will result in 9. 6.

Write a Scheme program for Fibonacci numbers.

The Fibonacci numbers are defined as follows:

Fibonacci(n) = 0 if n = 1

= 1 if n = 2 = Fibonacci(n-1) + Fibonacci(n-2) if n > 2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

The paleolithic age human life, short write up ?

Answered: 1 week ago

Question

3. Existing organizations and programs constrain behavior.

Answered: 1 week ago