From 8be733f5ae19d06c0972b30925f16f0ca2687d77 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Mon, 9 Jan 2023 22:14:25 +0000 Subject: plus-decimal and plus-earth sums many numbers The functions plus-decimal and plus-earth now supports many arguments to do it's sum. It uses the &rest argument. --- cl-math.lisp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cl-math.lisp b/cl-math.lisp index 61a8e26..a217df4 100644 --- a/cl-math.lisp +++ b/cl-math.lisp @@ -85,10 +85,10 @@ (plus numerals number1 number2) :initial-value 0)) -(defun plus-decimal (a b) - "Given 2 decimal numbers, it returns it's sum." - (plus-number '(0 1 2 3 4 5 6 7 8 9) a b)) +(defun plus-decimal (&rest args) + "Given decimal numbers, it returns it's sum." + (reduce (lambda (a b) (plus-number '(0 1 2 3 4 5 6 7 8 9) a b)) args)) -(defun plus-earth (a b) - "Give 2 earthal numbers, it returns it's sum." - (plus-number '(1 2 3 4 5) a b)) +(defun plus-earth (&rest args) + "Give earthal numbers, it returns it's sum." + (reduce (lambda (a b) (plus-number '(1 2 3 4 5) a b)) args)) -- cgit 1.4.1-2-gfad0