;;; -*- lexical-binding: t -*- ;; ;; this file: ;; https://dataswamp.org/~incal/emacs-init/negative-subtraction.el (require 'cl-lib) (defun number-to-list (n) (cl-loop for d across (prin1-to-string n) collect (cl-digit-char-p d) )) ;; (number-to-list 1234) ; (1 2 3 4) (defun negative-subtract (a b) (let*((a-nums (number-to-list a)) (b-nums (number-to-list b)) ) (cl-loop for i in a-nums for j in b-nums collect (- i j) ))) ;; (negative-subtract 256 118) ; (1 4 -2) ;; (- 256 118) ; 138 (provide 'negative-subtraction)