Write a scheme function that computes the volume of a


1. Find definitions of the scheme function EVAL and APPLY and explain their actions.

2. What does the following Scheme function do?

(define (y s lis)

(cond

((null? Lis' () )

((equal? s (car lis)) Hs)

(else (y s (cdr lis)))

) )

3. What does the following Scheme function do?

(define (x lis)

(cond

((null? lis) 0)

((not (list? (car lis)))

(cond

((eq? (car lis) #f) (x (cdr lis)))

(else (+ 1 (x (cdr lis))))))

(else (+ (x (car lis)) (x (cdr lis))))

4. Write a Scheme function that computes the volume of a sphere, given its radius.

5.  Write a Scheme function that takes a simple list of numbers as a parameter A and B and returns a list with the largest and smallest numbers in the input list.

6. Write a Scheme function that takes a list as a parameter and returns a list identical to the parameter except the last element has been deleted.

7. Describe how a multiple-processor machine could be used to implement - resolution. Could Prolog, as currently defined, use this method?

8. Write a set of rules for family relationships, including all relationships from grandparents through two generations. Now add these to the facts of Problem 3, and eliminate as many of the facts as you can.

9. Write the following English conditional statements as prolog-headed Horn clauses:

a. If Fred is the father of Mike, then Fred is an ancestor of Mike

b. If Mike is father of Joe and Mike is the father of Mary, then Mary is the sister of Joe.

c. If Mike is the brother of Fred and Fred is the father of Mary, then Mike is the uncle of Mary.

10. Using the structures parent (X, Y), male (x), and female (X) , write a structure that defines mother (X,Y).

11. Using the structures parent (X, Y), male (x), and female (X) , write a structure that defines sister (X,Y).

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a scheme function that computes the volume of a
Reference No:- TGS01698667

Expected delivery within 24 Hours