Apply sum-of-squares to multiple numbers with reduce reddit / emacs ---------------------------------------------------------------------- AbstProcDo · 2022-03-05 08:21 ---------------------------------------------------------------------- priority_deque · 2022-03-05 08:26 2^2 + 2^2 = 8 8^2 + 2^2 = 68 I am more acquainted with Haskell, so I would rather map the list to make all elements squares and then fold(reduce) them with (+) function, guess it works same way in lisp ---------------------------------------------------------------------- ieure · 2022-03-05 16:44 Traditional approach: (reduce #'+ (mapcar (lambda (n) (* n n)) '(2 2))) cl-loop approach: (cl-loop for n in '(8 2) sum (* n n))