• Wren
    link
    fedilink
    44 days ago

    So that’s the joke then? That someone chose to alphabetically sort numbers?

    • @Buffalox@lemmy.world
      link
      fedilink
      5
      edit-2
      4 days ago

      Not just someone. It’s the default when numbers are in text strings, they are treated as text, not as numerical values.
      To account for numbers in text strings in any text listing system, requires quite a bit of extra work when programming it.
      So the joke is that computers are pretty dumb in this regard, and they need a lot of help to do it right.

    • knightly the Sneptaur
      link
      fedilink
      4
      edit-2
      4 days ago

      Basic sorting is always like this, the joke is that way too many people still number things badly. Alphanumerically sorting variable-length numbers without normalizing the number of digits will always result in situations like 02 < 1 < 109 < 11 < 2

      • Wren
        link
        fedilink
        44 days ago

        I’m assuming that normalizing digits is similar to normalizing audio? Where you take the numbers and assigning them all a blanket set of instructions?

        Normalization in mixing audio essentially takes a track and adjusts the volume of the track’s peaks to keep them from clipping the volume threshold.

        Is it like this?

        • knightly the Sneptaur
          link
          fedilink
          3
          edit-2
          4 days ago

          Yeah! In general, Normalization refers to adjusting values measured on different scales to a common scale.

          Consider 1 and 10. The value of the first digit of both numbers is 1, so a scale-invariant numerical sort sees both numbers as coming before 2.

          Normalizing both numbers to a two digit scale gives us 01 and 10, which sort as expected with 02.

          • Wren
            link
            fedilink
            24 days ago

            Ahhh. So you have automated processes that will handle it as well. Just plug in the ranges and it does its thing.

            • knightly the Sneptaur
              link
              fedilink
              14 days ago

              Indeed! That kind of scale-sensitive value-based sort requires the data to be invariant in other ways, though. For example, “Episode Three” has 13 charachters, so it would come after “Episode Four” which only has 12 and therefore must be smaller.

              Turns out that sorting things is way more complicated than it seems. The wikipedia page on sorting algorithms in computer science lists 37 different ways to sort numbers and it is far from an exhaustive list.

              • Wren
                link
                fedilink
                34 days ago

                Seems like programming isn’t too dissimilar to giving a child instructions.

                • knightly the Sneptaur
                  link
                  fedilink
                  3
                  edit-2
                  4 days ago

                  It definitely feels like that!

                  Have a classic joke on the subject:

                  A software tester walks into a bar.

                  Runs into a bar.

                  Crawls into a bar.

                  Dances into a bar.

                  Flies into a bar.

                  Jumps into a bar.

                  And orders a beer.

                  2 beers.

                  0 beers.

                  99999999 beers.

                  a lizard in a beer glass.

                  -1 beer.

                  “qwertyuiop” beers.

                  Testing complete.

                  A real customer walks into the bar and asks where the bathroom is.

                  The bar goes up in flames.

                  • Wren
                    link
                    fedilink
                    24 days ago

                    I really wish I knew what the joke was. 🥺

      • Wren
        link
        fedilink
        1
        edit-2
        4 days ago

        Me? Not at all. Unless you meant the comic strip thing, then yeah. I suppose I could see that.

        Being bad at a lot of things doesn’t bother me a bit. I’m good at other things. And some of those things, I’m even great at!

        • @Klear@sh.itjust.works
          link
          fedilink
          24 days ago

          No, I did not mean you.

          I found it especially overblown since I ran into a very similar issue recently. I actually laughed at myself when I saw the mangled list and fixed the names (it helped that the list was something I generated with a script and adding leading zeroes was a simple matter).