Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggest polymod for bases > 36 (9123607.base(37)) #6547

Open
p6rt opened this issue Sep 25, 2017 · 7 comments
Open

Suggest polymod for bases > 36 (9123607.base(37)) #6547

p6rt opened this issue Sep 25, 2017 · 7 comments
Labels
LTA Less Than Awesome; typically an error message that could be better

Comments

@p6rt
Copy link

p6rt commented Sep 25, 2017

Migrated from rt.perl.org#132156 (status was 'open')

Searchable as RT132156$

@p6rt
Copy link
Author

p6rt commented Sep 25, 2017

From @AlexDaniel

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)

@p6rt
Copy link
Author

p6rt commented Sep 25, 2017

From @lizmat

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-archive.perl.org/perl6/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?

@p6rt
Copy link
Author

p6rt commented Sep 25, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Sep 25, 2017

From @tbrowder

On Sun, 24 Sep 2017 23​:21​:11 -0700, alex.jakimenko@​gmail.com wrote​:

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.

@p6rt
Copy link
Author

p6rt commented Sep 25, 2017

From @tbrowder

On Mon, 25 Sep 2017 02​:01​:55 -0700, elizabeth wrote​:

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-archive.perl.org/perl6/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.

@p6rt
Copy link
Author

p6rt commented Sep 25, 2017

From @AlexDaniel

: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​:

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-archive.perl.org/perl6/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?

@p6rt
Copy link
Author

p6rt commented Sep 25, 2017

From @geekosaur

On Mon, Sep 25, 2017 at 10​:53 AM, Aleks-Daniel Jakimenko-Aleksejev via RT <
perl6-bugs-followup@​perl.org> wrote​:

* 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

@p6rt p6rt added the LTA Less Than Awesome; typically an error message that could be better label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTA Less Than Awesome; typically an error message that could be better
Projects
None yet
Development

No branches or pull requests

1 participant