(define (sum l) (foldl (lambda(x acc) (+ acc (if (pair? x) (sum x) x))) 0 l))> (sum '(1 2 3 (1 2 3)))12> (sum '(1 2 3))6
↧
Answer by alinsoar for How to add in a list in racket
↧