From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: Re: New library num-base-converters Date: Tue, 15 Aug 2017 18:49:45 +0900 (JST) Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1502790610 5559 195.159.176.226 (15 Aug 2017 09:50:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 15 Aug 2017 09:50:10 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: Tino Calancha , Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 15 11:50:06 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 1dhYU2-0000iv-8I for ged-emacs-devel@m.gmane.org; Tue, 15 Aug 2017 11:49:58 +0200 Original-Received: from localhost ([::1]:49369 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhYU6-00057M-Vu for ged-emacs-devel@m.gmane.org; Tue, 15 Aug 2017 05:50:03 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dhYU0-000578-O2 for emacs-devel@gnu.org; Tue, 15 Aug 2017 05:49:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dhYTv-0002Eb-Ps for emacs-devel@gnu.org; Tue, 15 Aug 2017 05:49:56 -0400 Original-Received: from mail-pg0-x22a.google.com ([2607:f8b0:400e:c05::22a]:35656) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dhYTv-0002E4-KE for emacs-devel@gnu.org; Tue, 15 Aug 2017 05:49:51 -0400 Original-Received: by mail-pg0-x22a.google.com with SMTP id v189so3104870pgd.2 for ; Tue, 15 Aug 2017 02:49:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=rIm4SU6O/B9BZrrXOI/sVJmhfjcZWqqUcp2k5QrNSno=; b=iy/R49esxzGyf6/LdV8H3E2f2Uz5QpFpgthErPd2xGTyzzv+hyemq2OG6vWF+54ZBY g8RO0jMpBLtOxkylUVr/TOvVj1qLUdfZteWtQpQE2cYkwhWbDGudcuYPejt4v7Tm+Ux4 mnSgk2ulZbASqcCxEPSWZYn4mlAlJdzQADLb/SgD19izZZy6ZofuGQvDXWyAC44fwH5q uamrXN++mWgGclBksePRTLKNur8rs1mcf6gJaGJcIR8A5bB57QH/dPgCamY6AlhPd2sq sLl1CQodUKNtK/4qw2HE+k50mLUYVlTMRZZxAyhLR/cCl/2/BgY8HMlntTgx5w4+BkNt DScA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=rIm4SU6O/B9BZrrXOI/sVJmhfjcZWqqUcp2k5QrNSno=; b=KS/bgvamlWqpqg8/IUXHCmSLJOAXwyKNsKzCbuBPFYARZyiGCcg5aOiQ/HWBCpDvGo htM4c2FHVGDGqEm4r38stLo8tX/q2afLnAtk4tv8kkfZDKLloRqgFYGtiL1VI2Bt5iQX 9Yauz/we+yXUg2kwCXIP2zF/yy/PCIsDMCWikDA4hMBmFJMzFtrT3+q+RIfiJHxgswUU kASBCKTKoViKHR8KlbIwxVU8aswTt/KJvzmorrCLRyK65OCyoAdtXpzDmPq+G+GE+qA8 tpUK169yeBjHLnOOL0YYsjkzagXk/qYI2fDWIRm9dF8q1MqzJFnXPRSWOc1cxr32xLOR T/zw== X-Gm-Message-State: AHYfb5i8MsmgFEgdtawZv6/bIsIcwBvvQpPgcDmnHRWD/qM+xNSmeSPj soAY1ji8MaD1Rw== X-Received: by 10.84.218.68 with SMTP id f4mr30532849plm.214.1502790590535; Tue, 15 Aug 2017 02:49:50 -0700 (PDT) Original-Received: from calancha-pc ([103.5.140.154]) by smtp.gmail.com with ESMTPSA id r87sm17804659pfb.112.2017.08.15.02.49.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Aug 2017 02:49:49 -0700 (PDT) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::22a 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:217563 Archived-At: On Tue, 15 Aug 2017, Stefan Monnier wrote: >> +(defun nbc-number-base-converter (num base-in base-out) >> + "Translate NUM, a string representing an integer, to a different base. >> +BASE-IN, an integer, is the basis of the input NUM. >> +BASE-OUT, an integer, is the basis to display NUM." > > Having a string as both input and output is a bad API, I think. It's better API than not having API at all; it provides me the flexibility to handle input as '0xff', '#xff' or 'ff'. Not that bad. > All one needs is basically to add a `base` arg to number-to-string > (there's already one for string-to-number). Then we are again limited to 2 < b < 16 bases. In the old thread the OP asking for this feature wanted to use base 36. The presented lib can handle 2 <= b <= 36.