Question: Please answer the following questions in scheme programming language You can only define one method pre question(no helper function is allowed). I will be really
Please answer the following questions in scheme programming language
You can only define one method pre question(no helper function is allowed). I will be really appreciated if you can help me.
1.everyother* takes a list that may contain sublists. The function returns a list that contains every other element of the input list, and if the element is also a list, then every other element of that sublist is included in the returned list, and so on for each sublists it contains.
> (everyother* '(a (b c (d)) ((e f g) h (((i)) () (j k)) (l m n)))) '(a ((e g) (((i)) (j))))
2.samestructure takes two lists that may contain sublists. The function should return #t if the two lists have the same structure of sublists even if the atoms and number of atoms of each sublist is different. (This is equivalent to asking whether two lists are the same if we first empty both lists of atoms. However, write this list using a single pass through the data.)
> (samestructure '((a) b c ((d) e)) '(a b (c) d e (f g (h (i))) k)) #f > (samestructure '((a) b c ((d) e)) '(a b (c) d e (f g (h i)) k)) #t
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
