scanSum x = scanSum' 0 x scanSum' n [] = n scanSum' n (x:xs) = n + x : scanSum' (n -1) xs