diff options
author | Daniel Santos <dacs.git@brilhante.top> | 2023-01-13 12:44:35 +0000 |
---|---|---|
committer | Daniel Santos <dacs.git@brilhante.top> | 2023-01-13 12:44:35 +0000 |
commit | 9514c346af1789f9f26fa23edc555724d9eede87 (patch) | |
tree | 2760ad55badd0d2825c60f63ab5175236aa505d3 | |
parent | 10880fbfb48444923b9c1f7bbc029e2b61f80a31 (diff) | |
download | cl-math-9514c346af1789f9f26fa23edc555724d9eede87.tar.gz |
bug fix: have to add cut-digits
-rw-r--r-- | plus-inc.lisp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/plus-inc.lisp b/plus-inc.lisp index f6988d7..3d85b11 100644 --- a/plus-inc.lisp +++ b/plus-inc.lisp @@ -2,11 +2,18 @@ (defvar *number-units-at-beginning* nil) +(defun cut-digits (number-list-reversed) + "Given a reversed number list it cuts unecessay digits." + (cond + ((eq (car number-list-reversed) '|0|) + (cut-digits (cdr number-list-reversed))) + (t number-list-reversed))) + (defun may-reverse (number) "If units is placed on the end, reverse; else keep it." (if *number-units-at-beginning* - number - (reverse number))) + (reverse (cut-digits (reverse number))) + (reverse (cut-digits number)))) (defun explode-string (string) "Given a string, it returns a list of the symbol of this string" |