Question: 1-Draw the internal representation for the following lisp list(s). (cons 40 apple orange ((grape)) banana)) '0) (cons '(Red (Yellow Blue)) '(Yellow Orange)) (cons '((((apple )

 1-Draw the internal representation for the following lisp list(s). (cons 40

1-Draw the internal representation for the following lisp list(s). (cons 40 apple orange ((grape)) banana)) '0) (cons '(Red (Yellow Blue)) '(Yellow Orange)) (cons '((((apple ) orange (grape ()) banana)) '(apple)) 2-Determine the output of the following functions (You must show your works) (caaar '(c) apple ()) orange (grape) banana)) apple)) caddr '(((Green Blue)) Red (Yellow () Blue)) (cadadr'( orange (O) (grape () (apple)) banana))) 3-Give combinations of cars and cars that will pick 7 from each of the following lists, (1 (23) 7), (((1 (7)))), and 1(2(3(4(5(6(7))))))) 4-Fully explain the following scheme procedure. (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)))) 5-Write a Scheme procedure that takes a list and returns the sum of the even numbers in the list. For example, (sumeven ' 1 2 6 4 5)) returns 12 and (sumeven ( 1 2 6 (45)) returns 12. Trace the function with one of the provided examples. 6-Write a Scheme procedure that takes a list as a parameter and returns a list identical to the parameter except the last three elements has been deleted. For example,(new-list '(a b c d e)) returns '(a b): (new-list '(a b (cd) e)) returns '(a). Trace the function with one of the provided examples. 7-Define a scheme procedure that returns the length of a given list. Then, define a scheme procedure returns a list that contains only the last two elements of a given list. For example, (last- two' a b c d)) returns '(cd); (last-two (ab (cd)) returns '(b (cd)). Trace the function with one of the provided examples. 8-Write a procedure that takes a tree (represented as a list) and returns a list whose elements are all the leaves of the tree arranged in right to left order. For example, (leaves '((1 2) (34)) ((1 2) (3 4)))) returns (4 3 2 1 4 3 2 1). Trace the function with the provided example. 9-Define a scheme procedure that takes a list and returns the depth of the most nested parentheses in a list. For example, (EXP-DEPTH '(I J ((K)L) M)) returns 3. 10-Define a scheme procedure that takes a set (a list of distinct elements) and generates a list of all subsets of the set. For example, (subsets '(a b c )) returns (a bc)(b c)(a c) (C) (a b)(b)(a) (). Trace the function with the provided example

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!