;;; -*- 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* ((an (number-to-list a)) (bn (number-to-list b))) (cl-loop for i in an for j in bn collect (- i j)))) ;; (negative-subtract 256 118) ; (1 4 -2) ;; (- 256 118) ; 138 (provide 'negative-subtraction)