;;; Hex convertor ;; I can't believe I had to write one of these. ;; I was right in my disbelief... ;;(defvar hexdigits '( "0" "1" "2" "3" "4" "5" "6" "7" "8" "9" "a" "b" "c" "d" "e" "f")) (defun hex( num ) (format "%x" num)) ;;(defun hex( num ) ;; (let ((retval "")) ;; (while (> num 0) ;; (setq retval (concat (nth (% num 16) hexdigits) retval) ;; num (/ num 16))) ;; retval)) ;;(defun dec( num ) ;; (let ((retval 0) ;; (hd (mapconcat 'identity hexdigits ""))) ;; (while (> (length num) 0) ;; (setq retval (+ (* 16 retval) (string-match (substring num ;; 0 1) ;; hd)) ;; num (substring num 1))) ;; retval)) (defun dec( num ) (car (read-from-string (concat "#x" num)))) (provide 'hex)