Live data from Hacker News

When I say “alphabetical order”, I mean “alphabetical order”

sebastiano.tronto.net

341–350 of 385 posts

Re: When I say “alphabetical order”, I mean “alphabetical order”

#341
post #107

Earlier quoted context omitted.

That's why we have all this LC_* stuff in Linux, which you can configure to your needs: export LC_MEASUREMENT="de_DE" export LC_MONETARY="de_DE" export LC_PAPER="de_DE" export LC_CTYPE=de_DE.UTF-8 export LC_MESSAGES="en_US.UTF-8" export LC_RESPONSE="en_US.UTF-8" export LC_TIME=en_US.UTF-8 Mix in your Swedish or Swaheli, maybe even the Vatican State: e.g. de_DE, sw_TZ, it_VA (not guaranteed ;-).

How does this work if you're a multi-lingual person and you have files with names in different languages?

I'm multi-lingual but try to separate business stuff for example (multi-lingual) from private stuff (mostly one language), so clashes between languages rarely happen.

But if it gets complicated I'll usually resort to Perl scripts to take care of pesky details. Sorting an associative array where the key is a string in unified form and the value is the multi-lingual target is rather easy in a script language which one is fluent in.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#342
post #327
post #189

Earlier quoted context omitted.

The issue at hand is how numbers are sorted. That has nothing to do with unicode.

You're wrong about that. See UTS #10 § 1.4. (I did not downvote you.)

"Numbers. A customization may be desired to allow sorting numbers in numeric order. If strings including numbers are merely sorted alphabetically, the string “A-10” comes before the string “A-2”, which is often not desired. This behavior can be customized, but it is complicated by ambiguities in recognizing numbers within strings (because they may be formatted according to different language conventions). Once each number is recognized, it can be preprocessed to convert it into a format that allows for correct numeric sorting, such as a textual version of the IEEE numeric format."

Re: When I say “alphabetical order”, I mean “alphabetical order”

#343
post #331

Earlier quoted context omitted.

It has nothing to do with decimal points. It just looks at any contiguous sequence of digits and treats it as a single character for the purposes of sorting. The decimal point could be any other character and the behavior would be the same.

So only whole numbers are sorted as numbers then. Decimal numbers are treated as strings and will have a completely different order, with digits after the decimal point sorted differently to whole numbers without fractions? Or you mean every set of continuous digits within the same string are considered as individual whole number? Depending on the decision, either lists of decimal numbers or lists of version numbers…

>Depending on the decision, either lists of decimal numbers or lists of version numbers will be sorted wrong.

Yes. I don’t see why this is a big deal.

I didn’t suggest adjusting the logic based on the number of decimal points.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#344
I feel like it's not intelligence or lack there of, it's that implementing sort with a[i] < b[i] is the simplest way to do it. Putting 9 before 10 would require some kind of windowing since otherwise you'd be comparing 9 and 1, and of course 1 is smaller.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#345

Earlier quoted context omitted.

> Yes, have you never edited the metadata? I don't even know what that means. And just because some OS's copy the creation date doesn't mean all of them do. Specifically, the most popular desktop OS -- Windows -- doesn't. (And it has nothing to do with your filesystem. It's your OS.)

> I don't even know what that means Obviously something like: touch -t 202309271530 myfile.txt

And I'm supposed to do that manually for each of the couple hundred photos I copy...?

I'm sorry if I have a hard time taking that suggestion seriously.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#346
post #343

Earlier quoted context omitted.

So only whole numbers are sorted as numbers then. Decimal numbers are treated as strings and will have a completely different order, with digits after the decimal point sorted differently to whole numbers without fractions? Or you mean every set of continuous digits within the same string are considered as individual whole number? Depending on the decision, either lists of decimal numbers or lists of version numbers…

>Depending on the decision, either lists of decimal numbers or lists of version numbers will be sorted wrong. Yes. I don’t see why this is a big deal. I didn’t suggest adjusting the logic based on the number of decimal points.

Ah ok.

I understand that you found your perfect trade-off for sorting based on longer considerations. But it will be difficult to communicate such a concept to a user.

Applying partial rules to improve sorting in one direction is not a lossless activity, it makes the UX actually worse in other scenarios as the user is first guided to assume a certain behavior, but then learns that his expectation is broken in adjacent scenarios (Which is more or less the bottom-line of that article to begin with).

In the end it'll be just "another standard" for sorting [0]

[0] https://xkcd.com/927/

Re: When I say “alphabetical order”, I mean “alphabetical order”

#347
post #143

Earlier quoted context omitted.

> The sort rules are simple In considering the simplicity of the rule, I think you're using a developers perspective here where we automatically classify numbers and have a clear mental model of the separation between value and representation. But I'm not sure how simple it would be to explain to a non-technical user why size_5, size_10 and size_15 are in order but size_0.25, size_0.5 and size_0.75 are out-of-order.…

> I'm regularly amazed at how little non-developer/technical users complain about strange and confusing behavior. Because EVERYTHING a computer does to non-developer/technical users is "strange and confusing". With few exceptions, most people have no idea why their computer does something the way it does, or how they could make it do something different even if they wanted it to. And most of the time, when they compl…

And if you explain in detail about how it works, a lot of people (not all, but quite of few of the more obstreperous types who raise these as CRITICAL BUGS with solutions apparently SO SIMPLE MY DOG COULD IMPLEMENT IT) will then say "I don't know why you have to make it all so complicated, things were simpler and better in v(n-12) in 1997".

If you add an option you're making it more complicated, harder to document and less discoverable, if you don't it's "useless", if you use a heuristic it's "too magical". Eventually someone has to be unhappy.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#348
post #332
post #309

Earlier quoted context omitted.

I was with you until this point, but 1.2 is bigger than 1.10, because 1.2 is a shortened version of writing 1.20 _unless_ you explicitely want these to be version numbers or something like that. The normal expectation would be to treat numbers as, well, mathematical numbers, and not SemVer, especially if we only have one decimal point, don't you think?

As I said, the sorting rule won’t always give pleasing results, but it seems to me like a simple and reasonable modification of lexicographic ordering.

It is neither simple, nor reasonable.

1.10, the number, is equivalent to 1.1. It is less than 1.2. You say you want numbers to sort as numbers, but you want 1.10 to be greater than 1.2.

Do you consider '1/4' to be a number? Should it come before or after '1/3'?

I'm guessing that you don't want to sort one character at a time if you encounter one of [0-9]. Instead, you want to group all consecutive [0-9] as a single sortable number. But aren't characters '.', ',', '/', '-' also part of numbers?

What about numbers like ↋, 五, π, B, ⅔, or -1?

Re: When I say “alphabetical order”, I mean “alphabetical order”

#349
post #257

Earlier quoted context omitted.

> I agree with Microsoft/Google/KDE's order. I don't. I want string sorting to be string sorting. Filenames are strings. I wouldn't mind if there was an option to tell the file manager to do this "wrangle numbers out of strings and treat them as numbers" thing--so that I could turn that option off, and others who want that behavior could turn it on. But for this to be the default, without even a way to change it (exc…

I generally agree with your points (and love TDE) but > I don't use autosave either. I don't want the computer to assume when I want to save a file. The computer is too stupid to know that. That’s why, with auto save systems, you flag/name a version as your canonical save point. Rather like a video game, I’d rather have the autosaves and not need them, because I generally save the game myself, than not have them at a…

> with auto save systems, you flag/name a version as your canonical save point.

You mean each saved version is stored separately, like a version control system?

A system like that would be fine (in fact I use version control all the time for this kind of thing). But that's often not how auto save is implemented; the auto save just clobbers the last version you saved. That's the kind I don't use.

Re: When I say “alphabetical order”, I mean “alphabetical order”

#350
post #295

Earlier quoted context omitted.

Would you sort 1.10 1.2 or 1.2 1.10 ? I would not know how an OS treats those if we do not assume mindreading vs proper lexicographic order. Why would we need to substitute precision with vagueness for something that simply taking care of proper naming would suffice?

Ah yes sorry, 1.10 comes after 1.2 because 10 is bigger than 2 (so in fact different from your example). But assuming your original list is a list of versions (which seems reasonable given the presence of multiple decimal points for some cases), then that’s the order you’d want. If you have non-integer numbers in your filenames then it won’t give the order you want, but there isn’t going to be a rule that works for a…

There is a rule that works for all cases. It's lexicographical sorting.

Simple. Consistent. Easy to manipulate to get what you want.

Post reply on HN