About
2. def replaceThird(lst1, lst2):
result = []
for i in range(len(lst1)):
tpl = lst1[i]
new_tpl = tpl[:2] + (lst2[i],)
result.append(new_tpl)
return result
1. runningTotal :: [Int] -> [Int]
runningTotal [] = []
runningTotal (x:xs) = scanl (+) x xs
2. replaceThird :: [(String, String, String)] -> [Double] -> [(String, String, Double)]
replaceThird [] [] = []
replaceThird ((a,b,_):xs) (y:ys) = (a,b,y) : replaceThird xs ys
1. (define (running-total lst)
(let loop ((lst lst) (acc 0) (result '()))
(if (null? lst)
(reverse result)
(let ((new-acc (+ acc (car lst))))
(loop (cdr lst) new-acc (cons new-acc result))))))