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


Groups > comp.lang.javascript > #35480

Re: Not understanding "sort" with an argument

Newsgroups comp.lang.javascript
Date 2018-08-15 04:20 -0700
References <c3146bef-749a-4881-bd24-62e6a9b8df28@googlegroups.com> <d7kqmdpit250iuia6osb956lgva662k3dn@4ax.com> <7fee9579-fe62-4b1d-ac30-61ca33fe32c9@googlegroups.com> <kt96ndddfmkbn0jcv5anhqgb6vlrn4nai5@4ax.com> <XnsA93EE9FA650D8eejj99@194.109.6.166>
Message-ID <c3034925-bb41-4462-ba92-eb3bd537fa60@googlegroups.com> (permalink)
Subject Re: Not understanding "sort" with an argument
From Julio Di Egidio <julio@diegidio.name>

Show all headers | View raw


On Tuesday, 14 August 2018 23:00:12 UTC+2, Evertjan.  wrote:
> John G Harris <niam@jghnorth.org.uk.invalid> wrote on 14 Aug 2018 in 
> comp.lang.javascript:
<snip>
> > Well, when you want to sort things into order you have to be able to
> > tell whether this thing is before or after that thing. That's what the
> > comparePerson function does. The sort function does many of these
> > comparisons in order to do its job of making earlier things come
> > before later things. 
> 
> Not so.
> 
> In an array, and this is about sorting an array [or a string posing as an 
> array of letters] there is no "earlier" and "later", just difference in 
> element position number.

It's perfectly fine, and not just in English, to say "earlier" and "later"
"position" in some (here spacial) order.

> > That's the help the compare function gives to the sort function.
> 
> No.
> 
> The compare function is not just a helper, it defines the algoritm that acts 
> as the "worker" of the sort

Nope, the compare function just defines the *order relation*.

> Nonsense, methinks.

Think again.

*Plonk*

Julio

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Not understanding "sort" with an argument bit-naughty@hotmail.com - 2018-08-10 01:11 -0700
  Re: Not understanding "sort" with an argument John G Harris <niam@jghnorth.org.uk.invalid> - 2018-08-10 09:47 +0100
    Re: Not understanding "sort" with an argument bit-naughty@hotmail.com - 2018-08-14 11:25 -0700
      Re: Not understanding "sort" with an argument John G Harris <niam@jghnorth.org.uk.invalid> - 2018-08-14 20:04 +0100
        Re: Not understanding "sort" with an argument "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-14 23:00 +0200
          Re: Not understanding "sort" with an argument "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-14 23:02 +0200
          Re: Not understanding "sort" with an argument Julio Di Egidio <julio@diegidio.name> - 2018-08-15 04:20 -0700
          Re: Not understanding "sort" with an argument John G Harris <niam@jghnorth.org.uk.invalid> - 2018-08-15 19:15 +0100
            Re: Not understanding "sort" with an argument "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2018-08-15 21:56 +0200
              Re: Not understanding "sort" with an argument John G Harris <niam@jghnorth.org.uk.invalid> - 2018-08-16 15:24 +0100
                Re: Not understanding "sort" with an argument Julio Di Egidio <julio@diegidio.name> - 2018-08-16 07:51 -0700
                Re: Not understanding "sort" with an argument John G Harris <niam@jghnorth.org.uk.invalid> - 2018-08-16 18:51 +0100
                Re: Not understanding "sort" with an argument Julio Di Egidio <julio@diegidio.name> - 2018-08-16 11:21 -0700
                Re: Not understanding "sort" with an argument John G Harris <niam@jghnorth.org.uk.invalid> - 2018-08-17 10:44 +0100
  Re: Not understanding "sort" with an argument Julio Di Egidio <julio@diegidio.name> - 2018-08-15 03:58 -0700

csiph-web