diff options
author | Daniel Santos <dacs.git@brilhante.top> | 2023-01-13 10:59:16 +0000 |
---|---|---|
committer | Daniel Santos <dacs.git@brilhante.top> | 2023-01-13 10:59:16 +0000 |
commit | 1b6aac9169e2b7fb7cee64ba29348b8eb0b0bcb3 (patch) | |
tree | ccb0b7305185ca7070f6d8e1866ad2bb7f359b9b | |
parent | 248dad4c85fa32a27890a738cf67d8ec8c845104 (diff) | |
download | cl-math-1b6aac9169e2b7fb7cee64ba29348b8eb0b0bcb3.tar.gz |
rename to implode and explode
-rw-r--r-- | plus-inc.lisp | 10 |
1 files 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)))))))) |