pyth icon indicating copy to clipboard operation
pyth copied to clipboard

Switch `."` to bijective base.

Open isaacg1 opened this issue 8 years ago • 9 comments

isaacg1 avatar Jun 11 '16 23:06 isaacg1

What do you mean by bijective base?

Maltysen avatar Jun 12 '16 04:06 Maltysen

https://en.wikipedia.org/wiki/Bijective_numeration

isaacg1 avatar Jun 12 '16 04:06 isaacg1

Would this be a form of compression?

Maltysen avatar Jun 12 '16 04:06 Maltysen

Sorry, I should explain more. ." currently has a bug, where it can't encode anything where the leading character is the lowest character. Bijective numeration would fix this.

isaacg1 avatar Jun 12 '16 05:06 isaacg1

oh, I see what you mean, the things goes to a 0, which disappears when you store it as a number.

Maltysen avatar Jun 12 '16 21:06 Maltysen

Looks like I started this issue. I also provided a compressor and a decompressor.

kckennylau avatar Jun 13 '16 07:06 kckennylau

What happens if the compressed string includes " or a carriage return (#186)? We probably want to exclude those bytes and use base-254.

By the way, last month I came up with a neat alternative to bijective numeration that’s way more golfable.

andersk avatar Jun 29 '16 03:06 andersk

Also: https://en.wikipedia.org/wiki/Negative_base

DonaldTsang avatar Jul 08 '17 10:07 DonaldTsang

@DonaldTsang I don’t see how negative bases help here; they need a nonzero leading digit the same way positive bases do.

andersk avatar Jul 09 '17 05:07 andersk