fork download
  1. (defun boba (s)
  2. (let ((n (parse-integer s))
  3. (l (length s))
  4. (ds (map 'list #'digit-char-p s)))
  5. (unless #1=(first ds)
  6. (setf ds (rest ds) #1# (- #1#)))
  7. (values (apply '+ n l ds) n l ds)))
  8.  
  9. (defun yoba (s)
  10. (multiple-value-bind (r n len ds) (boba s)
  11. (format t "~&~d + ~d + (~{~d~^ + ~}) = ~d" n len ds r)))
  12.  
  13. (print (boba "-42"))
  14.  
  15. (dolist (x '("-123" "99"))
  16. (yoba x))
Success #stdin #stdout 0.01s 10520KB
stdin
Standard input is empty
stdout
-41 
-123 + 4 + (-1 + 2 + 3) = -115
99 + 2 + (9 + 9) = 119