Skip Menu |
Report information
Id: 132156
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: alex.jakimenko [at] gmail.com
Cc:
AdminCc:

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)



Subject: [LTA] Suggest polymod for bases > 36 (9123607.base(37))
Download (untitled) / with headers
text/plain 246b
Code: say 9123607.base(37) Result: base argument to base out of range. Is: 37, should be in 2..36 in block <unit> at <tmp> line 1 The error message can suggest .polymod, here is an example: 9123607.polymod(37 xx *).reverse # (4 32 4 15 36)
Date: Mon, 25 Sep 2017 11:01:02 +0200
Subject: Re: [perl #132156] [LTA] Suggest polymod for bases > 36 (9123607.base(37))
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
To: "Aleks-Daniel Jakimenko-Aleksejev (via RT)" <perl6-bugs-followup [...] perl.org>
Download (untitled) / with headers
text/plain 686b
Show quoted text
> On 25 Sep 2017, at 08:21, Aleks-Daniel Jakimenko-Aleksejev (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev > # Please include the string: [perl #132156] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=132156 > > > > Code: > say 9123607.base(37) > > Result: > base argument to base out of range. Is: 37, should be in 2..36 > in block <unit> at <tmp> line 1 > > > The error message can suggest .polymod, here is an example: > > 9123607.polymod(37 xx *).reverse # (4 32 4 15 36)
Perhaps .base(37) should just use .polymod under the hood?
Download (untitled) / with headers
text/plain 415b
On Sun, 24 Sep 2017 23:21:11 -0700, alex.jakimenko@gmail.com wrote: Show quoted text
> Code: > say 9123607.base(37) > > Result: > base argument to base out of range. Is: 37, should be in 2..36 > in block <unit> at <tmp> line 1 > > > The error message can suggest .polymod, here is an example: > > 9123607.polymod(37 xx *).reverse # (4 32 4 15 36)
For what it's worth, my module Number::More currently provides bases 37..64.
RT-Send-CC: liz [...] dijkmat.nl
Download (untitled) / with headers
text/plain 858b
On Mon, 25 Sep 2017 02:01:55 -0700, elizabeth wrote: Show quoted text
>
> > On 25 Sep 2017, at 08:21, Aleks-Daniel Jakimenko-Aleksejev (via RT) > > <perl6-bugs-followup@perl.org> wrote: > > > > # New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev > > # Please include the string: [perl #132156] > > # in the subject line of all future correspondence about this issue. > > # <URL: https://rt.perl.org/Ticket/Display.html?id=132156 > > > > > > > Code: > > say 9123607.base(37) > > > > Result: > > base argument to base out of range. Is: 37, should be in 2..36 > > in block <unit> at <tmp> line 1 > > > > > > The error message can suggest .polymod, here is an example: > > > > 9123607.polymod(37 xx *).reverse # (4 32 4 15 36)
> > Perhaps .base(37) should just use .polymod under the hood?
For what it's worth, my module Number::More currently provides bases 37..64.
:S let's please not. See also this discussion: https://irclog.perlgeek.de/perl6/2017-09-25#i_15211785

I'm strongly against making .base return garbage for bases >36. Polymod returns a list of integers, .base returns a *string* with the number using some alphabet. I don't understand why we want to break this simple stuff so much.

However, there are other options:
* use some unicode characters. Sadly, circled numbers only go up to ㊿, which is just yet another arbitrary limit. I don't think there are commonly accepted characters beyond 36, so maybe we can …
* add a named arg for the alphabet, so that the user can provide any character set he wants

On 2017-09-25 02:01:55, elizabeth wrote:
Show quoted text
>
> > On 25 Sep 2017, at 08:21, Aleks-Daniel Jakimenko-Aleksejev (via RT)
> > <perl6-bugs-followup@perl.org> wrote:
> >
> > # New Ticket Created by Aleks-Daniel Jakimenko-Aleksejev
> > # Please include the string: [perl #132156]
> > # in the subject line of all future correspondence about this issue.
> > # <URL: https://rt.perl.org/Ticket/Display.html?id=132156 >
> >
> >
> > Code:
> > say 9123607.base(37)
> >
> > Result:
> > base argument to base out of range. Is: 37, should be in 2..36
> > in block <unit> at <tmp> line 1
> >
> >
> > The error message can suggest .polymod, here is an example:
> >
> > 9123607.polymod(37 xx *).reverse # (4 32 4 15 36)
>
> Perhaps .base(37) should just use .polymod under the hood?


Subject: Re: [perl #132156] [LTA] Suggest polymod for bases > 36 (9123607.base(37))
From: Brandon Allbery <allbery.b [...] gmail.com>
Date: Mon, 25 Sep 2017 11:00:18 -0400
To: Carl Mäsak via RT <perl6-bugs-followup [...] perl.org>
Download (untitled) / with headers
text/plain 932b
On Mon, Sep 25, 2017 at 10:53 AM, Aleks-Daniel Jakimenko-Aleksejev via RT <perl6-bugs-followup@perl.org> wrote:
Show quoted text
* add a named arg for the alphabet, so that the user can provide any character
set he wants

I'm in favor of the original suggestion: point the user to polymod. One way that is used in the wild for this is space separated and 37 => AA; I don't think you will fit that kind of scheme (and note that there are still questions as to where to go after AZ!) into a single simple interface. Moreover, anyone faced with this will likely need to customize to match whatever they are working with that requires it anyway, so they would probably end up punting to polymod regardless. 

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org