handysort
handysort copied to clipboard
All Good Except For One
It looks like end-of-string is sorting after numbers, rather than before. []string{"", "1", "a", "a1"] ==> [1 a1 a]
:stuck_out_tongue_winking_eye::gun:
Consider using https://github.com/fvbommel/util/tree/master/sortorder though :)
I’m sorry to have so much bad news. J
John
John Souvestre - New Orleans LA
From: Maxim Kupriianov [mailto:[email protected]] Sent: 2015 April 21, Tue 14:14 To: xlab/handysort Cc: JohnRS Subject: Re: [handysort] All Good Except For One (#5)
:stuck_out_tongue_winking_eye: https://assets-cdn.github.com/images/icons/emoji/unicode/1f61c.png :gun: https://assets-cdn.github.com/images/icons/emoji/unicode/1f52b.png
— Reply to this email directly or view it on GitHub https://github.com/xlab/handysort/issues/5#issuecomment-94910038 . https://github.com/notifications/beacon/AFaoap5Fr2wrT-8MGBExShGTpWIrxJtEks5oBpjcgaJpZM4EFYgs.gif
Unfortunately, something else is wrong now.
[]string{"#", "1"} è [# 1]
Everything else looks good. Including {"a#", "a1"} which sorts correctly as [a1 a#].
John
John Souvestre - New Orleans LA
From: Maxim Kupriianov [mailto:[email protected]] Sent: 2015 April 21, Tue 14:22 To: xlab/handysort Cc: JohnRS Subject: Re: [handysort] All Good Except For One (#5)
Closed #5 https://github.com/xlab/handysort/issues/5 via https://github.com/xlab/handysort/commit/fb3537ed64a14615a020f0fe8dc08424233d491f fb3537e.
— Reply to this email directly or view it on GitHub https://github.com/xlab/handysort/issues/5#event-286545322 . https://github.com/notifications/beacon/AFaoaoQsWZuTgpPNyfyVQ4UGA5IXRyqyks5oBprEgaJpZM4EFYgs.gif
Yes, it is nice. I have given him a few minor improvements. I’m working to add handling all of the Unicode 0 digits to it now, but it slows it down.
John
John Souvestre - New Orleans LA
From: Maxim Kupriianov [mailto:[email protected]] Sent: 2015 April 21, Tue 14:23 To: xlab/handysort Cc: JohnRS Subject: Re: [handysort] All Good Except For One (#5)
Consider using https://github.com/fvbommel/util/tree/master/sortorder though :)
— Reply to this email directly or view it on GitHub https://github.com/xlab/handysort/issues/5#issuecomment-94911710 . https://github.com/notifications/beacon/AFaoakcscebFdnrXyjoYBiVV15mNMKQOks5oBpr6gaJpZM4EFYgs.gif
I wonder why OS X does that
So I'm expecting #
< 1
but then it's not clear why a1
> a#
.
Probably because it’s easy to do, since that is how the characters are ordered. But in a natural sort the idea is that “numbers are different”. So it doesn’t make much sense that a number would sort between two non-number characters.
A better visual example would be a “space” character instead of the “#”. The way it sorts now: [ 1 _]. The number is sorting between two non-numbers. What I think it should be: [1 _].
Imagine filenames, some with space separators and others with underscore separators. Shouldn’t they sort adjacently, without numbers between them?
Given this, should numbers sort before or after non-numbers? Either way seems OK to me, but every implementation I’ve looked at has them first.
John
John Souvestre - New Orleans LA