isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
263 stars 57 forks source link

Switch `."` to bijective base. #198

Open isaacg1 opened 8 years ago

Maltysen commented 8 years ago

What do you mean by bijective base?

isaacg1 commented 8 years ago

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

Maltysen commented 8 years ago

Would this be a form of compression?

isaacg1 commented 8 years ago

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.

Maltysen commented 8 years ago

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

kckennylau commented 8 years ago

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

andersk commented 8 years ago

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.

DonaldTsang commented 7 years ago

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

andersk commented 7 years ago

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