From 1b6aac9169e2b7fb7cee64ba29348b8eb0b0bcb3 Mon Sep 17 00:00:00 2001 From: Daniel Santos Date: Fri, 13 Jan 2023 10:59:16 +0000 Subject: rename to implode and explode --- plus-inc.lisp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/plus-inc.lisp b/plus-inc.lisp index 4fb07bb..dbad909 100644 --- a/plus-inc.lisp +++ b/plus-inc.lisp @@ -12,11 +12,11 @@ "Given a string, it returns a list of the symbol of this string" (loop for letter across string collect (intern (string letter)))) -(defun explode-to-symbol (number) +(defun explode (number) "Given a number (which can have letters), it returns a list of the symbols of this number" (loop for letter across (prin1-to-string number) collect (intern (string letter)))) -(defun implode-from-symbol (number) +(defun implode (number) "Given a list of the symbols of a number (which can have letters), it returns the symbol of this number" (intern (apply #'concatenate 'string (mapcar #'symbol-name number)))) @@ -75,12 +75,12 @@ (defun plus (numerals a b) "Given a list of a numeral system and 2 numbers, it returns the list of it's sum." - (may-reverse (plus-args-list numerals (may-reverse (explode-to-symbol a)) (may-reverse (explode-to-symbol b))))) + (may-reverse (plus-args-list numerals (may-reverse (explode a)) (may-reverse (explode b))))) (defun plus-decimal (&rest args) "Given decimal numbers, it returns the symbol it's sum." - (nth-value 0 (implode-from-symbol (may-reverse (reduce (lambda (a b) (plus-args-list '(|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) a b)) (mapcar #'may-reverse (mapcar #'explode-to-symbol args))))))) + (nth-value 0 (implode (may-reverse (reduce (lambda (a b) (plus-args-list '(|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) a b)) (mapcar #'may-reverse (mapcar #'explode args))))))) (defun plus-earth (&rest args) "Give earthal numbers, it returns it's sum." - (symbol-to-number (nth-value 0 (implode-from-symbol (may-reverse (reduce (lambda (a b) (plus-args-list '(|1| |2| |3| |4| |5|) a b)) (mapcar #'may-reverse (mapcar #'explode-to-symbol args)))))))) + (symbol-to-number (nth-value 0 (implode (may-reverse (reduce (lambda (a b) (plus-args-list '(|1| |2| |3| |4| |5|) a b)) (mapcar #'may-reverse (mapcar #'explode args)))))))) -- cgit 1.4.1-2-gfad0