3 ms·
Not quite right... as there would still be 3 failures in the tests, like Haskel. Realistically, I would expect to have a couple different methods available...
by tracker1 1y ago
Not quite right... as there would still be 3 failures in the tests, like Haskel.
Realistically, I would expect to have a couple different methods available... one that split a string into groups of code segments that represent a single unit, and a display width of units (0-2). Alternatively another method that just counted the display width in numbers of character spaces (assuming mono-spacing). Then you could apply the padding more naturally.
The grouping of characters would be more for other tests for display beyond left padding.
- IshKebab 1y agoThey were definitely trying to make Rust look worse than it is. They even sarcastically acknowledge that: > I didn’t deliberately pick the one which made Rust look even worse than all the others, out of peevish resentment for every time someone has rewritten some Python code (my go-to language) in Rust and made it a million times faster – that’s a ridiculous suggestion. And > Rust, as expected, gets nul points. What can I say?
- tracker1 1y agoFound it... Counting display width[1], getting unicode segments[2]. 1. https://crates.io/crates/unicode-display-width 2. https://crates.io/crates/unicode-segmentation