3 ms·
It’s more than that. ChatGPT actually gave the right answer but they chose not to use it to make a point.
by Aurornis 1y ago
It’s more than that. ChatGPT actually gave the right answer but they chose not to use it to make a point.
- tracker1 1y agoNot 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
- whbrown 1y agoTo be fair, you'd have to also import this crate to get the result he wanted: https://docs.rs/unicode-segmentation/latest/unicode_segmentation/ https://docs.rs/unicode-segmentation/latest/unicode_segmenta...