From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: New library num-base-converters Date: Mon, 14 Aug 2017 22:25:18 -0700 (PDT) Message-ID: <84387000-0545-4a51-8644-772b6b53165c@default> References: <87r2wem462.fsf@lifelogs.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1502774744 6015 195.159.176.226 (15 Aug 2017 05:25:44 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 Aug 2017 05:25:44 +0000 (UTC) Cc: Emacs developers To: Tino Calancha , raman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 15 07:25:35 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dhUM6-0000vd-RK for ged-emacs-devel@m.gmane.org; Tue, 15 Aug 2017 07:25:31 +0200 Original-Received: from localhost ([::1]:38428 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhUMC-0003z0-NB for ged-emacs-devel@m.gmane.org; Tue, 15 Aug 2017 01:25:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhUM5-0003vS-9y for emacs-devel@gnu.org; Tue, 15 Aug 2017 01:25:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhUM1-0001Gr-9V for emacs-devel@gnu.org; Tue, 15 Aug 2017 01:25:29 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:47436) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dhUM1-0001GS-39 for emacs-devel@gnu.org; Tue, 15 Aug 2017 01:25:25 -0400 Original-Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v7F5PLmJ008699 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Aug 2017 05:25:21 GMT Original-Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v7F5PKUI018983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 15 Aug 2017 05:25:21 GMT Original-Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v7F5PKSq025784; Tue, 15 Aug 2017 05:25:20 GMT In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6774.5000 (x86)] X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] [fuzzy] X-Received-From: 141.146.126.69 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:217557 Archived-At: > > this functionality is present in calculator.el -- > Sure, you can get this functionality with calc.el as well: > indeed num-base-converters.el internally calls `calc-number-radix'. >=20 > One point of this library is the convenience of not having to > know anything about neither calculator.el nor calc.el to get > the answer with easy. >=20 > Every Emacs user will understand the following: > M-x nbc-hex2dec ff RET > "ff hexadecimal =3D 255 decimal" >=20 > M-: (nbc-oct2dec "644") RET > =3D> 420 >=20 > ;; Or just `hex2dec' and `oct2dec' if you customize > ;; `nbc-define-aliases' to non-nil. (format "%d" #xff) ; hex to decimal --> "255" (format "%x" 255) ; decimal to hex --> "ff" (format "%d" #o644) ; octal to decimal --> "420" (format "%o" 420) ; decimal to octal --> "644" And didn't Pascal B. point this out in the thread previously cited? (format "#8r%o #10r%d #16r%x" 42 42 42) --> "#8r52 #10r42 #16r2a" https://lists.gnu.org/archive/html/help-gnu-emacs/2011-03/msg00531.html