Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) What is the output of the following s-expression? (1) (cons (6) (135) (2) (append (6) (1 3 5) (3) (list (6) (13 5)) 2)

image text in transcribed
image text in transcribed
1) What is the output of the following s-expression? (1) (cons (6) (135) (2) (append (6) (1 3 5) (3) (list (6) (13 5)) 2) Find the sequence of CARs and CDRs that return X when applied to he following S-expressions. (1 (AB) (AX C) D) (2 A((CDC (x) D))) (4) (AB)CDXD) (6) (A((CD (x)D)) 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)) returns3. 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) ) 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 [ 56936)) will result in 9 6) Write a Scheme program for Fibonacci numbers. The Fibonacci numbers are defined as follows: Fibonacci(OL-0 if n=1 1 if n = 2 Fibonaccifn-1) + Fibonacci(n-2) if n >2 7) Write a recursive function to get the minimum number from a sequence of numbers. Please name the function as min. This function should tell the minimum number in a given list. For example, (max (5 79 3 6)) will result in 3

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

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions