Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started