diff options
author | Daniel Santos <dacs.git@brilhante.top> | 2023-01-11 19:20:16 +0000 |
---|---|---|
committer | Daniel Santos <dacs.git@brilhante.top> | 2023-01-12 12:13:52 +0000 |
commit | 74b1bb30dc0afab49eefe97a2022acc3d3c76d6c (patch) | |
tree | 5f4fb6c410969b38e666ea57d9287fe0333cdcd3 | |
parent | fc441a4bb98add59d111aae4de21f508d8fe38ee (diff) | |
download | cl-math-74b1bb30dc0afab49eefe97a2022acc3d3c76d6c.tar.gz |
rename explode-from-symbol and implode-from-symbol
-rw-r--r-- | cl-math.lisp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/cl-math.lisp b/cl-math.lisp index da572de..a022c4d 100644 --- a/cl-math.lisp +++ b/cl-math.lisp @@ -15,17 +15,17 @@ number (reverse number))) -(defun explode (number) - "Given a number (which can have letters), it returns a list of the number" +(defun explode-to-symbol (number) + "Given a number (which can have letters), it returns a list of the symbols of this number" (loop for letter across (write-to-string number) collect (intern (string letter)))) -(defun implode (number) - "Given a list of a number (which can have letters), it returns the number" +(defun implode-from-symbol (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)))) (defun explode-string (number) - "Given a number (which can have letters), it returns a list of the number" - (loop for letter across number collect (intern (string letter)))) + "Given a string of a number (which can have letters), it returns a list of the number" + (loop for letter across number collect (string letter))) (defun next-list-number (numerals number-list) "Given a list of a numeral system and a list of a number, it returns a list of the next number." @@ -71,7 +71,7 @@ (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 a)) (may-reverse (explode b))))) + (may-reverse (plus-args-list numerals (may-reverse (explode-to-symbol a)) (may-reverse (explode-to-symbol b))))) (defun plus-string (numerals a b) "Given a list of a numeral system and 2 strings, it returns the list of it's sum." @@ -83,8 +83,8 @@ (defun plus-decimal (&rest args) "Given decimal numbers, it returns the symbol it's sum." - (nth-value 0 (implode (reduce (lambda (a b) (plus '(|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) a b)) args)))) + (nth-value 0 (implode-from-symbol (reduce (lambda (a b) (plus '(|0| |1| |2| |3| |4| |5| |6| |7| |8| |9|) a b)) args)))) (defun plus-earth (&rest args) "Give earthal numbers, it returns it's sum." - (symbol-to-number (nth-value 0 (implode (reduce (lambda (a b) (plus '(|1| |2| |3| |4| |5|) a b)) args))))) + (symbol-to-number (nth-value 0 (implode-from-symbol (reduce (lambda (a b) (plus '(|1| |2| |3| |4| |5|) a b)) args))))) |