diff options
-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" |