|
From: | Emanuel Berg |
Subject: | negative subtraction |
Date: | Mon, 27 Sep 2021 03:33:43 +0200 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
;;; -*- lexical-binding: t -*- ;;; ;;; this file: ;;; http://user.it.uu.se/~embe8573/emacs-init/negative-subtraction.el ;;; https://dataswamp.org/~incal/emacs-init/negative-subtraction.el (require 'cl-lib) (require 'parse-time) (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 8888 7777) ; (1 1 1 1) (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) -- underground experts united https://dataswamp.org/~incal
[Prev in Thread] | Current Thread | [Next in Thread] |