Question: Write the following in scheme: split* takes a list, that can contain sublists, and returns a list containing two lists. The first list should contain
Write the following in scheme:
split* takes a list, that can contain sublists, and returns a list containing two lists. The first list should contain the 1st, 3rd, 5th, ... elements, and the second list should contain the 2nd, 4th, 6th, ... elements. However, if any of these elements are also lists, these elements should be split as well.
> (split* '(a b ((c d) e f g) (((h i) j k l (m n o p))))) ((a ((((c) (d)) f) (e g))) (b ((((((h) (i)) k ((m o) (n p))) (j l))) ())))
> (split* '(a b (c d e) f g)) --> ((a ((c e) (d) g) (b f))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
