LibLangly icon indicating copy to clipboard operation
LibLangly copied to clipboard

Glyph Operations in Reverse

Open Entomy opened this issue 5 years ago • 2 comments

As Theo Verweij brought up here, there're some algorithms that are suboptimal because of their need to reverse a glyph sequence then iterating through it. This poses additional work, and an additional allocation. Ideally, we would iterate through in reverse. As I had explained, what he was thinking would absolutely work for Char, but Glyph are sequences of Char that must remain in the same order, even if reversed. For example, consider "\u0041\u0301", which would be a palindrome as it's just a single character, á, but would fail such a check as char-by-char would get U+0041 first forwards, and U+0301 first backwards, which don't equal each other.

Nevertheless, he was still right to point out the concept.

Accomplishing this requires three things. Firstly, is a variant of GetGlyphAt() which operates in reverse. This would walk the sequence, starting at a terminal, and continuing until base character. Secondly, this requires either adding to the existing Trie or creating new Tries to assist with this operation. Thirdly, it requires a reverse enumerator be created, analogous to IEnumerable<> but supporting the reverse.

Entomy avatar Sep 15 '20 11:09 Entomy

Issue-Label Bot is automatically applying the label enhancement to this issue, with a confidence of 0.68. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Sep 15 '20 11:09 issue-label-bot[bot]

This requires #134

Entomy avatar Jan 24 '21 19:01 Entomy