Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #210843

Re: not wanting to delete somebody's home directory

From "Thomas Schmitt" <scdbackup@gmx.net>
Newsgroups linux.debian.user
Subject Re: not wanting to delete somebody's home directory
Date 2019-07-06 17:40 +0200
Message-ID <ygUX7-6vs-1@gated-at.bofh.it> (permalink)
References <ygTRo-5Vb-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

rhkramer@gmail.com wrote:
> You sometimes will end up with a sort that like this:
> 1 11 12 ... 19 2 21 ... 3
> I'm sort of hoping the reason is easy to spot, as I am fighting a headache

Would the following sequence (and the image of a stern looking librarian)
be more intuitive ?

  A AA AB ... AI B BA ... C

Where in this card index box would you insert "D" or "AAAAA" ?

A human would notice if a set of sorting subjects consists entirely
of numbers and then use a numeric sorting criterion.
But the default criterion with the mentioned Perl code is obviously lexical.

The decision between "19" and "2" is made like this:
The single character '1' has a lower sort rank than '2'. So the decision is
made and the '9' is of no importance. "19" comes before "2".

"11" is lower than "12" because the first characters are equal, and
the second character '1' is lower than the second character '2'.

"1" is lower than "11" because there is no second '1' in "1".
Who quits early has the lower rank.


The classic method to make both sorting criteria match is to prepend
'0' characters to the shorter numbers so that all number texts have the
same length.
Then lexical ordering yields

 01 02 03 11 12 ... 19 21


If you want to intensify your headache, see the mathematical constraints
for a usable sorting criterion at
  http://mathworld.wolfram.com/TotallyOrderedSet.html

Beginning at example line 23 of
  https://perldoc.perl.org/functions/sort.html
you can easily cause great sorting confusion by a self-made non-usable
criterion. The rules of rock-paper-scissors are a good start.


Have a nice day :)

Thomas

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

not wanting to delete somebody's home directory mick crane <mick.crane@gmail.com> - 2019-07-05 17:30 +0200
  Re: not wanting to delete somebody's home directory Greg Wooledge <wooledg@eeg.ccf.org> - 2019-07-05 17:30 +0200
    Re: not wanting to delete somebody's home directory mick crane <mick.crane@gmail.com> - 2019-07-05 17:40 +0200
      Re: not wanting to delete somebody's home directory The Wanderer <wanderer@fastmail.fm> - 2019-07-05 17:40 +0200
        Re: not wanting to delete somebody's home directory Greg Wooledge <wooledg@eeg.ccf.org> - 2019-07-05 17:50 +0200
          Re: not wanting to delete somebody's home directory The Wanderer <wanderer@fastmail.fm> - 2019-07-05 18:20 +0200
            Re: not wanting to delete somebody's home directory Greg Wooledge <wooledg@eeg.ccf.org> - 2019-07-05 19:00 +0200
              Re: not wanting to delete somebody's home directory The Wanderer <wanderer@fastmail.fm> - 2019-07-05 19:30 +0200
      Re: not wanting to delete somebody's home directory mick crane <mick.crane@gmail.com> - 2019-07-05 17:40 +0200
  Re: not wanting to delete somebody's home directory songbird <songbird@anthive.com> - 2019-07-05 18:40 +0200
    Re: not wanting to delete somebody's home directory john doe <johndoe65534@mail.com> - 2019-07-05 19:40 +0200
      Re: not wanting to delete somebody's home directory Greg Wooledge <wooledg@eeg.ccf.org> - 2019-07-05 20:00 +0200
    Re: not wanting to delete somebody's home directory mick crane <mick.crane@gmail.com> - 2019-07-05 19:50 +0200
      Re: not wanting to delete somebody's home directory David Wright <deblis@lionunicorn.co.uk> - 2019-07-05 21:10 +0200
        Re: not wanting to delete somebody's home directory mick crane <mick.crane@gmail.com> - 2019-07-05 23:00 +0200
      Re: not wanting to delete somebody's home directory Curt <curty@free.fr> - 2019-07-06 10:40 +0200
        Re: not wanting to delete somebody's home directory songbird <songbird@anthive.com> - 2019-07-06 13:10 +0200
          Re: not wanting to delete somebody's home directory Curt <curty@free.fr> - 2019-07-06 14:40 +0200
            Re: not wanting to delete somebody's home directory Wolf Halton <wolf.halton@gmail.com> - 2019-07-06 15:10 +0200
            Re: not wanting to delete somebody's home directory rhkramer@gmail.com - 2019-07-06 16:30 +0200
              Re: not wanting to delete somebody's home directory "Thomas Schmitt" <scdbackup@gmx.net> - 2019-07-06 17:40 +0200
                Re: not wanting to delete somebody's home directory "Jeremy Nicoll" <jn.ml.dbn.25@letterboxes.org> - 2019-07-06 18:10 +0200
            Re: not wanting to delete somebody's home directory David Wright <deblis@lionunicorn.co.uk> - 2019-07-06 17:20 +0200
    Re: not wanting to delete somebody's home directory mick crane <mick.crane@gmail.com> - 2019-07-05 20:00 +0200
      Re: not wanting to delete somebody's home directory mick crane <mick.crane@gmail.com> - 2019-07-05 21:10 +0200
  Re: not wanting to delete somebody's home directory David Christensen <dpchrist@holgerdanske.com> - 2019-07-05 22:30 +0200

csiph-web