Question: Scheme programming Question, I need to construct this function. partialsums* takes a list that may contain sublists. The output should have the same list structure

Scheme programming Question,

I need to construct this function.

partialsums* takes a list that may contain sublists. The output should have the same list structure as the input, but the car of each list (and each sublist) should be the sum of all numbers in that list. There should be no other values in the list. You can write this function without any helper functions.

Example output:

> (partialsums* '(1 a 2 b)) (3) > (partialsums* '((1) (2) (3))) (6 (1) (2) (3)) > (partialsums* '((1 2) (10 20) (100 200))) (333 (3) (30) (300)) > (partialsums* '(1 a (10 20 x y) c 2 (x y z) (a b 1 (c 200 d)))) (234 (30) (0) (201 (200)))

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!