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

add idiom 308 Integer to string in base b #158

Merged
merged 4 commits into from
Jul 12, 2024

Conversation

simonvonhackewitz
Copy link
Contributor

No description provided.

@simonvonhackewitz
Copy link
Contributor Author

Is the output unambiguous? Or would something like "decimal 2 is 10 in base 2" be better?

@@ -0,0 +1,29 @@
ex308 is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have

  # convert this to a number using the given base.  If negative, add "-" as
  # the first character.
  #
  public as_string(base u32) String : character_encodings

in stdlib. Did you see this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no 🙈

It doesn't work for 0 in base 999999 but I guess this is rarely needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For base 999999 you would first need 999999 symbols. So no this is useless.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know, I just thought it would be a nice (but probably useless) optimization, because 0 is the same in every base.

@michaellilltokiwa michaellilltokiwa merged commit 48c3b0e into tokiwa-software:main Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants