Skip to content

Fix format/convert ops #6

Open
ig-ra wants to merge 6 commits into
knu:masterfrom
ig-ra:fix-format-ops
Open

Fix format/convert ops #6
ig-ra wants to merge 6 commits into
knu:masterfrom
ig-ra:fix-format-ops

Conversation

@ig-ra

@ig-ra ig-ra commented Apr 8, 2025

Copy link
Copy Markdown
  • distinguish between arithmetical operations on numbers (add/sub/mul/divide/shift etc) and format ops (change base, decimal/hex/binary etc).
  • fix handling of format ops

ig-ra added 5 commits April 8, 2025 18:37
- distinguish between
  - arithmetic op, which should return new number and
  - format op, which returns a string, representing the same number
- add those ops for hydra and smartrep
@ig-ra

ig-ra commented Apr 14, 2025

Copy link
Copy Markdown
Author

hey @knu , could u plz take a look?

@knu knu left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Looks good. Let me try this locally.

@ig-ra

ig-ra commented Apr 20, 2025

Copy link
Copy Markdown
Author

one more question - is there a need for '#' operator?
the most common conversions (e.g. hex, octal, binary and back to decimal are already handled via designated commands (h/o/b/d) and via format instead of math-format-radix). So it feels for me a bit redundant and maybe worth removing.

@knu

knu commented May 5, 2025

Copy link
Copy Markdown
Owner

Ah, # and % are currently broken, but I'd like to fix them. I added them because I thought they might be useful when playing with things like Base36-style encodings.

@ig-ra

ig-ra commented May 12, 2025

Copy link
Copy Markdown
Author

Ah, # and % are currently broken, but I'd like to fix them. I added them because I thought they might be useful when playing with things like Base36-style encodings.

I see. Interesting.. I suggest to open a new PR/enhancement ticket to discuss whether base-36 style encoding conversion is something that people would like to have. For me the major value of this lib is to inc/dec ops and conversion back/forth to hex/binary/dec, but if there will be a ticket/votes then we could know whether this is something that worth (re)implementing.

If you think that # and % are currently broken, then maybe it's better to comment them out for now to stabilize version or at least to add a note in the code.

@ig-ra

ig-ra commented May 12, 2025

Copy link
Copy Markdown
Author

Looks good. Let me try this locally.
any bugs/issues found in your check? Should I fix anything or we may merge?

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.

2 participants