otobrglez / compression-puzzle

Attempts to crack the "compression puzzle".
15 stars 47 forks source link

Add crystal solution using a lexer pattern #64

Closed grepsedawk closed 2 years ago

grepsedawk commented 2 years ago

In the majority of real life scenarios I'd likely just use a more simple solution, such as the solution @robcole presented earlier, but this is over 4x faster and uses a Lexer pattern to seek through the string, so it is interesting and could be a better pattern to use in real life, but practical scenarios (seeking through strings at a framework level, for instance)

Definitely an interesting solution, and while the solution doesn't look the most elegant, this pattern would look a lot more coarse in other languages and that makes the outcome interesting to me!

robcole commented 2 years ago

Damn you, I was gonna try this approach next. Beautiful. ❤️