m-ender / retina

A regex-based programming language.
MIT License
231 stars 10 forks source link

Add case swap option to Transliterate mode #28

Closed m-ender closed 6 years ago

m-ender commented 9 years ago

An advanced case-insensitive mode for Transliterate would be useful for case-swapping applications. It's tricky to put the exact feature into words, but if the option was ~, I'd imagine that both of the following stages would swap the case of all letters:

T~`A-Z`a-z
T~`a-z`A-Z

If a letter is not mapped to another letter, then ~ would simply make the transliteration case insensitive, so the following stages would be equivalent:

T`A-Za-z`dd0-5dd0-5
T~`A-Z`dd0-5
T~`a-z`dd0-5

And by extension also

T~`A-Z`ddd
T~`a-z`ddd
m-ender commented 6 years ago

I don't think this will happen. In Retina 1.0 this option would need two bytes, and in the most common use case it would save... two bytes, so nothing overall:

T!~`L`l
T`Ll`lL

It would probably also wreak havoc with the new cyclic transliteration, but I haven't thought about that in detail.