From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: C-x C-e on numbers Date: Fri, 05 Dec 2014 15:53:36 +0900 Message-ID: <877fy6lh8v.fsf@uwakimon.sk.tsukuba.ac.jp> References: <85oarjnyzx.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: ger.gmane.org 1417762454 13249 80.91.229.3 (5 Dec 2014 06:54:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2014 06:54:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 05 07:54:06 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XwmmD-0003FF-P9 for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 07:54:05 +0100 Original-Received: from localhost ([::1]:49050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XwmmD-0000zx-Ez for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2014 01:54:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33269) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwmm2-0000sS-Om for emacs-devel@gnu.org; Fri, 05 Dec 2014 01:54:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xwmlt-0001tG-0l for emacs-devel@gnu.org; Fri, 05 Dec 2014 01:53:54 -0500 Original-Received: from shako.sk.tsukuba.ac.jp ([130.158.97.161]:41829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xwmls-0001os-M4 for emacs-devel@gnu.org; Fri, 05 Dec 2014 01:53:44 -0500 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by shako.sk.tsukuba.ac.jp (Postfix) with ESMTPS id 6B5411C393A; Fri, 5 Dec 2014 15:53:36 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 5061E1A2CFC; Fri, 5 Dec 2014 15:53:36 +0900 (JST) In-Reply-To: <85oarjnyzx.fsf@stephe-leake.org> X-Mailer: VM undefined under 21.5 (beta34) "kale" acf1c26e3019 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 130.158.97.161 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:178884 Archived-At: Stephen Leake writes: > M-: (show-binary 42) (defun show-binary (n) "Documentation left as exercise for the reader." ;; hexadecimal version also an exercise (let ((s (format "%o" n))) ;; loop unrolled for creativity conservation (setq s (replace-in-string s "0" "000")) (setq s (replace-in-string s "1" "001")) (setq s (replace-in-string s "2" "010")) (setq s (replace-in-string s "3" "011")) (setq s (replace-in-string s "4" "100")) (setq s (replace-in-string s "5" "101")) (setq s (replace-in-string s "6" "110")) (setq s (replace-in-string s "7" "111")) ;; stripping leading zeros or padding to wordsize, more homework (concat "#b" s))) Seriously, does this function really need to be particularly efficient?