Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

A bug in the code is worth two in the documentation.


devel / comp.lang.awk / asort function

SubjectAuthor
* asort functionLaurent MANCHON
+- Re: asort functionEd Morton
`* Re: asort functionKenny McCormack
 +* Re: asort functionLaurent MANCHON
 |`- Re: asort functionBen Bacarisse
 +- Re: asort functionLaurent MANCHON
 `* Re: asort functionLaurent MANCHON
  +* Re: asort functionEd Morton
  |`* Re: asort functionJ Naman
  | `* Re: asort functionLaurent MANCHON
  |  +* Re: asort functionJanis Papanagnou
  |  |+* Re: asort functionLaurent MANCHON
  |  ||`* Re: asort functionJanis Papanagnou
  |  || `* Re: asort functionKenny McCormack
  |  ||  `* Re: asort functionLaurent MANCHON
  |  ||   +* Re: asort functionJanis Papanagnou
  |  ||   |`* Re: asort functionLaurent MANCHON
  |  ||   | `* Use multi-dimensional arrays, Luke! (Was: asort function)Kenny McCormack
  |  ||   |  `* Re: Use multi-dimensional arrays, Luke! (Was: asort function)Laurent MANCHON
  |  ||   |   `* Re: Use multi-dimensional arrays, Luke! (Was: asort function)Kenny McCormack
  |  ||   |    `* Re: Use multi-dimensional arrays, Luke! (Was: asort function)Laurent MANCHON
  |  ||   |     `* Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke! (Was: asort functioKenny McCormack
  |  ||   |      `* Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke!Laurent MANCHON
  |  ||   |       `* Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke!Ed Morton
  |  ||   |        `- Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke!Laurent MANCHON
  |  ||   `- Re: asort functionEd Morton
  |  |`* Re: asort functionKenny McCormack
  |  | `* Re: asort functionJanis Papanagnou
  |  |  `- Re: asort functionKenny McCormack
  |  `- Re: asort functionKenny McCormack
  `* Re: asort functionKenny McCormack
   `- Re: asort functionLaurent MANCHON

Pages:12
asort function

<b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=842&group=comp.lang.awk#842

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:622a:164b:: with SMTP id y11mr18270810qtj.166.1628691610233;
Wed, 11 Aug 2021 07:20:10 -0700 (PDT)
X-Received: by 2002:a25:d052:: with SMTP id h79mr48670824ybg.246.1628691610059;
Wed, 11 Aug 2021 07:20:10 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 11 Aug 2021 07:20:09 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=194.167.33.174; posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 194.167.33.174
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
Subject: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Wed, 11 Aug 2021 14:20:10 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1076
 by: Laurent MANCHON - Wed, 11 Aug 2021 14:20 UTC

--Hi all,

is asort() function exist in TAWK (or only in gawk) ?

thx

Re: asort function

<sf0mtu$p7d$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=843&group=comp.lang.awk#843

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Wed, 11 Aug 2021 09:30:23 -0500
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <sf0mtu$p7d$1@dont-email.me>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Aug 2021 14:30:22 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="7a503d4b4b7c4fd0916c65bdd75ff00c";
logging-data="25837"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bYdulRc8RKpAkMlL4PrUL"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:EsaFIHHK0Ghz/qZWihvHYoAhyoU=
In-Reply-To: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 210811-2, 8/11/2021), Outbound message
 by: Ed Morton - Wed, 11 Aug 2021 14:30 UTC

On 8/11/2021 9:20 AM, Laurent MANCHON wrote:
> --Hi all,
>
> is asort() function exist in TAWK (or only in gawk) ?
>
> thx
>

I don't know the answer to that but I'm curious about why you're asking.
If you have tawk you can just try calling asort() and don't need to ask
so I assume that's not the case. Given that - are you considering trying
to get a copy of tawk if it has asort() instead of just using gawk? If
so - why?

Ed.

Re: asort function

<sf0n17$m9p6$1@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=844&group=comp.lang.awk#844

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Wed, 11 Aug 2021 14:32:07 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf0n17$m9p6$1@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
Injection-Date: Wed, 11 Aug 2021 14:32:07 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="730918"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Wed, 11 Aug 2021 14:32 UTC

In article <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>,
Laurent MANCHON <manchon.lm@gmail.com> wrote:
>--Hi all,
>
>is asort() function exist in TAWK (or only in gawk) ?

Not in TAWK, but not really needed (see below).

However, I'm wondering what the point of the question is. Either you have
access to TAWK - in which case you would know and/or could quickly
determine the answer to the question - or you don't - in which case, the
question is moot. So, which is it?

Anyway, I don't really see the point of asort(), once you have regular
array sorting (see footnote: *) - which TAWK has always had, and GAWK now
has. GAWK's implementation of array sorting is actually quite nice - in
fact, more elaborate and powerful than TAWK's. My sense of the GAWK
development effort is that they put asort()/asorti() in at a point in the
development when they realized that some sort of array sorting was needed,
but they weren't quite ready to do full/regular array sorting.

So, I think asort()/asorti() is now retained mostly for historical reasons.

(*) By "regular" (or "full") array sorting, I mean via the "for (i in A) ..."
syntax.

--
Never, ever, ever forget that "Both sides do it" is strictly a Republican meme.

It is always the side that sucks that insists on saying "Well, you suck, too".

Re: asort function

<f89d5bae-3485-4cab-a334-241afa577045n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=845&group=comp.lang.awk#845

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:620a:2101:: with SMTP id l1mr19585356qkl.104.1628700105033;
Wed, 11 Aug 2021 09:41:45 -0700 (PDT)
X-Received: by 2002:a25:7ec4:: with SMTP id z187mr12309325ybc.35.1628700104839;
Wed, 11 Aug 2021 09:41:44 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 11 Aug 2021 09:41:44 -0700 (PDT)
In-Reply-To: <sf0n17$m9p6$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e34:efc5:49b0:3926:4c06:d70b:773b;
posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 2a01:e34:efc5:49b0:3926:4c06:d70b:773b
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf0n17$m9p6$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f89d5bae-3485-4cab-a334-241afa577045n@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Wed, 11 Aug 2021 16:41:45 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Laurent MANCHON - Wed, 11 Aug 2021 16:41 UTC

Le mercredi 11 août 2021 à 16:32:09 UTC+2, Kenny McCormack a écrit :
> In article <b0a1d496-2fb2-4e79...@googlegroups.com>,
> Laurent MANCHON <manch...@gmail.com> wrote:
> >--Hi all,
> >
> >is asort() function exist in TAWK (or only in gawk) ?
> Not in TAWK, but not really needed (see below).
>
> However, I'm wondering what the point of the question is. Either you have
> access to TAWK - in which case you would know and/or could quickly
> determine the answer to the question - or you don't - in which case, the
> question is moot. So, which is it?
>
> Anyway, I don't really see the point of asort(), once you have regular
> array sorting (see footnote: *) - which TAWK has always had, and GAWK now
> has. GAWK's implementation of array sorting is actually quite nice - in
> fact, more elaborate and powerful than TAWK's. My sense of the GAWK
> development effort is that they put asort()/asorti() in at a point in the
> development when they realized that some sort of array sorting was needed,
> but they weren't quite ready to do full/regular array sorting.
>
> So, I think asort()/asorti() is now retained mostly for historical reasons.
>
> (*) By "regular" (or "full") array sorting, I mean via the "for (i in A) ...."
> syntax.
>
> --
> Never, ever, ever forget that "Both sides do it" is strictly a Republican meme.
>
> It is always the side that sucks that insists on saying "Well, you suck, too".
I expressed badly myself, I wanted to know if there is a function similar to asort(gawk) in TAWK ?
As I have to calculate medians I have to sort the values of the table in increasing order and then compute medians on it.
Hence the need for the asort function. I know I can write my own sort function such as:

function masort(A, hold, i, j, n) {
n = alength(A);
for (i = 2; i <= n ; i++) {
hold = A[j = i];
while (A[j-1] > hold) {
j--;
A[j+1] = A[j];
}
A[j] = hold;
}
delete A[0];
return n;
}

But I think that an embedded function is faster than a function created in the header, don't you ?

Re: asort function

<4f4b4a7f-c8cd-4184-8bec-35f98530dd1dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=846&group=comp.lang.awk#846

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:620a:21d8:: with SMTP id h24mr35060133qka.499.1628700180355;
Wed, 11 Aug 2021 09:43:00 -0700 (PDT)
X-Received: by 2002:a25:d052:: with SMTP id h79mr49600314ybg.246.1628700180206;
Wed, 11 Aug 2021 09:43:00 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 11 Aug 2021 09:42:59 -0700 (PDT)
In-Reply-To: <sf0n17$m9p6$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e34:efc5:49b0:3926:4c06:d70b:773b;
posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 2a01:e34:efc5:49b0:3926:4c06:d70b:773b
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf0n17$m9p6$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4f4b4a7f-c8cd-4184-8bec-35f98530dd1dn@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Wed, 11 Aug 2021 16:43:00 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Wed, 11 Aug 2021 16:42 UTC

I expressed badly myself, I wanted to know if there is a function similar to asort(gawk) in TAWK ?
As I have to calculate medians I have to sort the values of the table in increasing order and then compute medians on it.
Hence the need for the asort function. I know I can write my own sort function such as:

function masort(A, hold, i, j, n) {
n = alength(A);
for (i = 2; i <= n ; i++) {
hold = A[j = i];
while (A[j-1] > hold) {
j--;
A[j+1] = A[j];
}
A[j] = hold;
}
delete A[0];
return n;
}

But I think that an embedded function is faster than a function created in the header, don't you ?

Re: asort function

<6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=847&group=comp.lang.awk#847

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a0c:8122:: with SMTP id 31mr23584627qvc.26.1628700366275;
Wed, 11 Aug 2021 09:46:06 -0700 (PDT)
X-Received: by 2002:a25:2d0:: with SMTP id 199mr3547730ybc.123.1628700366099;
Wed, 11 Aug 2021 09:46:06 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 11 Aug 2021 09:46:05 -0700 (PDT)
In-Reply-To: <sf0n17$m9p6$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e34:efc5:49b0:3926:4c06:d70b:773b;
posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 2a01:e34:efc5:49b0:3926:4c06:d70b:773b
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf0n17$m9p6$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Wed, 11 Aug 2021 16:46:06 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Wed, 11 Aug 2021 16:46 UTC

I expressed badly myself, I wanted to know if there is a function similar to asort(gawk) in TAWK ?
As I have to calculate medians I have to sort the values of the table in increasing order and then compute medians on it.
Hence the need for the asort function. I know I can write my own sort function such as:

function alength(A, n, val) {
n=0;
for (val in A) n++
return n;
}

function masort(A, hold, i, j, n) {
n = alength(A);
for (i = 2; i <= n ; i++) {
hold = A[j = i];
while (A[j-1] > hold) {
j--;
A[j+1] = A[j];
}
A[j] = hold;
}
delete A[0];
return n;
}

But I think that an embedded function is faster than a function created in the header, don't you ?
For exemple in Tawk if i want to compute the length of an array i think *_arr is faster than alength(_arr)

Re: asort function

<sf0vqt$qh$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=848&group=comp.lang.awk#848

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: mortonspam@gmail.com (Ed Morton)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Wed, 11 Aug 2021 12:02:20 -0500
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <sf0vqt$qh$1@dont-email.me>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com>
<6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Aug 2021 17:02:22 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="bb799d02d8692655b608ab4ebbfc73bb";
logging-data="849"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+D5CwnqmhlZH/eKQ5Pa4ts"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.12.0
Cancel-Lock: sha1:j47P9xlXot+0kWhgj3Hhk7gLYUk=
In-Reply-To: <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 210811-2, 8/11/2021), Outbound message
 by: Ed Morton - Wed, 11 Aug 2021 17:02 UTC

On 8/11/2021 11:46 AM, Laurent MANCHON wrote:
> I expressed badly myself, I wanted to know if there is a function similar to asort(gawk) in TAWK ?
> As I have to calculate medians I have to sort the values of the table in increasing order and then compute medians on it.
> Hence the need for the asort function. I know I can write my own sort function such as:
>
> function alength(A, n, val) {
> n=0;
> for (val in A) n++
> return n;
> }
>
> function masort(A, hold, i, j, n) {
> n = alength(A);
> for (i = 2; i <= n ; i++) {
> hold = A[j = i];
> while (A[j-1] > hold) {
> j--;
> A[j+1] = A[j];
> }
> A[j] = hold;
> }
> delete A[0];
> return n;
> }
>
> But I think that an embedded function is faster than a function created in the header, don't you ?
> For exemple in Tawk if i want to compute the length of an array i think *_arr is faster than alength(_arr)
>

Sure but why bother trying to find the equivalent of a gawk function in
tawk (available by word of mouth from individuals with a copy of it,
with people mailing photocopies of documentation to each other and a
small user base) instead of just using gawk (widely/easily available,
thoroughly documented online and in books, with a massive user base)?

Ed.

Re: asort function

<sf11hc$mf32$1@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=849&group=comp.lang.awk#849

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Wed, 11 Aug 2021 17:31:24 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf11hc$mf32$1@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf0n17$m9p6$1@news.xmission.com> <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
Injection-Date: Wed, 11 Aug 2021 17:31:24 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="736354"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Wed, 11 Aug 2021 17:31 UTC

In article <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>,
Laurent MANCHON <manchon.lm@gmail.com> wrote:
>I expressed badly myself, I wanted to know if there is a function similar to
>asort(gawk) in TAWK ?

OK, now I get it. The keyword is "similar". Without that word, it sounded
like you wanted to know if there was literally a function called "asort" in
TAWK. We have, correctly, asserted that it would have been easier to just
test it, then to post to Usenet.

But you want to know how to sort arrays in TAWK. That's the real point
that you are getting at.

The first answer I can give is: No, there is no library function to do it,
such as asort() in GAWK. But as I argue, there doesn't need to be, and
asort() in GAWK is basically an anachronism at this point in time.

To sort arrays in TAWK (and in current/modern versions of GAWK as well),
you build up your array with the keys (indices) being in the order you want
them, then you use: for (i in A) ...
to iterate through the array in the desired order.

I hope this answers your question.

The details are a little different between TAWK and GAWK, but the
underlying idea is pretty much the same.

--
The difference between communism and capitalism?
In capitalism, man exploits man. In communism, it's the other way around.

- Daniel Bell, The End of Ideology (1960) -

Re: asort function

<a166ca37-f57c-4e6d-9cc4-a07c894d42dbn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=850&group=comp.lang.awk#850

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:622a:15c4:: with SMTP id d4mr258755qty.350.1628709365186;
Wed, 11 Aug 2021 12:16:05 -0700 (PDT)
X-Received: by 2002:a25:618f:: with SMTP id v137mr22861538ybb.374.1628709362970;
Wed, 11 Aug 2021 12:16:02 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 11 Aug 2021 12:16:02 -0700 (PDT)
In-Reply-To: <sf11hc$mf32$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e34:efc5:49b0:3926:4c06:d70b:773b;
posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 2a01:e34:efc5:49b0:3926:4c06:d70b:773b
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com> <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
<sf11hc$mf32$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a166ca37-f57c-4e6d-9cc4-a07c894d42dbn@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Wed, 11 Aug 2021 19:16:05 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Wed, 11 Aug 2021 19:16 UTC

not really answered.
Try to calculate the median of the elements of an array and you will understand what I am asking.
You need to sort not the indice of the array but elements.

Re: asort function

<871r6zhcwp.fsf@bsb.me.uk>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=851&group=comp.lang.awk#851

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: ben.usenet@bsb.me.uk (Ben Bacarisse)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Wed, 11 Aug 2021 22:47:18 +0100
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <871r6zhcwp.fsf@bsb.me.uk>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com>
<f89d5bae-3485-4cab-a334-241afa577045n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="5cec1deac9f4bcbbf715d1b469393f55";
logging-data="21493"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4j4WHYZpaunWrZs0R5wLmmJmXrNEuAZs="
Cancel-Lock: sha1:lYyWL9oZXAvAUeWVo7Ka9qUb/gE=
sha1:HvSoHlpovxn+Yo1fZaqBj6Z6K0Y=
X-BSB-Auth: 1.3122b6d8853c20c87832.20210811224718BST.871r6zhcwp.fsf@bsb.me.uk
 by: Ben Bacarisse - Wed, 11 Aug 2021 21:47 UTC

Laurent MANCHON <manchon.lm@gmail.com> writes:

> As I have to calculate medians I have to sort the values of the table
> in increasing order and then compute medians on it.

Technically no. There is an O(1), non-sorting median algorithm, but
it's a bit messy and sorting is so well-understood you are probably
better off doing what you are doing.

--
Ben.

Re: asort function

<bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=852&group=comp.lang.awk#852

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a37:8242:: with SMTP id e63mr2404424qkd.294.1628738343671;
Wed, 11 Aug 2021 20:19:03 -0700 (PDT)
X-Received: by 2002:a25:30d7:: with SMTP id w206mr1645278ybw.182.1628738343239;
Wed, 11 Aug 2021 20:19:03 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Wed, 11 Aug 2021 20:19:03 -0700 (PDT)
In-Reply-To: <sf0vqt$qh$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=96.255.253.97; posting-account=BcR7vAoAAABY9YgIIYIhD68t7wwjMvJW
NNTP-Posting-Host: 96.255.253.97
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com> <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
<sf0vqt$qh$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>
Subject: Re: asort function
From: jnaman2@gmail.com (J Naman)
Injection-Date: Thu, 12 Aug 2021 03:19:03 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: J Naman - Thu, 12 Aug 2021 03:19 UTC

>On Wednesday, 11 August 2021 at 13:02:23 UTC-4, Ed Morton wrote:
> Sure but why bother trying to find the equivalent of a gawk function in
> tawk (available by word of mouth from individuals with a copy of it,
> with people mailing photocopies of documentation to each other and a
> small user base) instead of just using gawk (widely/easily available,
> thoroughly documented online and in books, with a massive user base)?
>
> Ed.

If anyone who REGULARLY CONTRIBUTES to the Gawk community (lang, help) would like my original, NOT A COPY, TAWK Compiler Ver 5.01c, I'll be happy to donate it. I have the original manual, spiral bound, and four 3.5" diskettes for Win 3.1, NT/95, Dos 32-bit, and, drum roll, OS/2. In the original box ... Also have Ver 4 & bound manual-- who would want that? I loved it 20+ years ago, but am firmly Gnu awk now.

Re: asort function

<261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=853&group=comp.lang.awk#853

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a37:9e4f:: with SMTP id h76mr3038230qke.24.1628751749899;
Thu, 12 Aug 2021 00:02:29 -0700 (PDT)
X-Received: by 2002:a25:618f:: with SMTP id v137mr2653843ybb.374.1628751749731;
Thu, 12 Aug 2021 00:02:29 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Thu, 12 Aug 2021 00:02:29 -0700 (PDT)
In-Reply-To: <bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=194.167.33.174; posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 194.167.33.174
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com> <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
<sf0vqt$qh$1@dont-email.me> <bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Thu, 12 Aug 2021 07:02:29 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Thu, 12 Aug 2021 07:02 UTC

on unix machine i don't like gawk i prefer mawk which is faster than gawk.
and on windows, compiled program with Tawk v6.7 are faster than gawk.

Re: asort function

<sf2ide$ab7$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=854&group=comp.lang.awk#854

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 09:25:34 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 16
Message-ID: <sf2ide$ab7$1@news-1.m-online.net>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com>
<6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
<sf0vqt$qh$1@dont-email.me>
<bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>
<261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>
NNTP-Posting-Host: 2001:a61:241e:cc01:713d:219:5d94:710f
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1628753134 10599 2001:a61:241e:cc01:713d:219:5d94:710f (12 Aug 2021 07:25:34 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Thu, 12 Aug 2021 07:25:34 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>
 by: Janis Papanagnou - Thu, 12 Aug 2021 07:25 UTC

On 12.08.2021 09:02, Laurent MANCHON wrote:
> on unix machine i don't like gawk i prefer mawk which is faster than gawk.

Is that true? - I know of some performance tests (done by Andrew Sumner
20+ years ago) where that was actually not the case - some test cases
were faster, some slower -, and since then a lot of optimizations have
been done in GNU Awk (including byte code support).

If you have some test cases I'd be interested to see actual numbers.

> and on windows, compiled program with Tawk v6.7 are faster than gawk.

If speed is a critical issue you may also try awka, an Awk compiler.

Janis

Re: asort function

<1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=855&group=comp.lang.awk#855

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:622a:344:: with SMTP id r4mr2631513qtw.296.1628755829273;
Thu, 12 Aug 2021 01:10:29 -0700 (PDT)
X-Received: by 2002:a25:58d5:: with SMTP id m204mr2974884ybb.85.1628755828993;
Thu, 12 Aug 2021 01:10:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Thu, 12 Aug 2021 01:10:28 -0700 (PDT)
In-Reply-To: <sf2ide$ab7$1@news-1.m-online.net>
Injection-Info: google-groups.googlegroups.com; posting-host=194.167.33.174; posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 194.167.33.174
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com> <6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
<sf0vqt$qh$1@dont-email.me> <bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>
<261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com> <sf2ide$ab7$1@news-1.m-online.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Thu, 12 Aug 2021 08:10:29 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Thu, 12 Aug 2021 08:10 UTC

I think Awka has been discontinued for a long time now (http://awka.sourceforge.net/download.html),
and not sure if it works with the latest versions of gcc.

Re: asort function

<sf2s8c$ndve$1@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=856&group=comp.lang.awk#856

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 10:13:32 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf2s8c$ndve$1@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com> <261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com> <sf2ide$ab7$1@news-1.m-online.net>
Injection-Date: Thu, 12 Aug 2021 10:13:32 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="767982"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 12 Aug 2021 10:13 UTC

In article <sf2ide$ab7$1@news-1.m-online.net>,
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>On 12.08.2021 09:02, Laurent MANCHON wrote:
>> on unix machine i don't like gawk i prefer mawk which is faster than gawk.
>
>Is that true? - I know of some performance tests (done by Andrew Sumner
>20+ years ago) where that was actually not the case - some test cases
>were faster, some slower -, and since then a lot of optimizations have
>been done in GNU Awk (including byte code support).

Historically, it is (has been) definitely true. Historically, mawk was
always considered very fast, and GAWK was originally designed to be
feature-rich and not have limits (which are common attributes/goals of GNU
software) at the expense of being big and not particularly efficient.
Note, incidentally, that bash also fits this profile. I like bash for its
many nice features, but its own man page says that it is too big and too
slow.

However, this situation may have changed over the years. As you say,
effort has gone into making GAWK more runtime efficient.

>> and on windows, compiled program with Tawk v6.7 are faster than gawk.

1) It is unlikely that speed really is an issue. Most people who think it
is (in pretty much all contexts), turn out to be misguided. If you want
efficiency, writing in AWK is probably not what you should be doing in the
first place.

But, that said, it is true (and yes, I am sort of contradicting myself),
TAWK is very very efficient and fast. This is a good reason to use TAWK,
if you can. I think it is indisputable that TAWK is the best/fastest
significant AWK implementation.

>If speed is a critical issue you may also try awka, an Awk compiler.

I don't think awka - or any other so-called "awk compiler" - makes any
claims to making your program run faster. Aren't they all just for
encryption (aka, code security) purposes?

BTW, all this talk by you and your c.l.a friend which are of the strain
"Why don't you just use GAWK like we do?" are misguided. If the OP has and
is using TAWK, he should continue to do so.

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/DanaC

Re: asort function

<sf2se7$ndve$2@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=857&group=comp.lang.awk#857

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 10:16:39 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf2se7$ndve$2@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf0vqt$qh$1@dont-email.me> <bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com> <261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>
Injection-Date: Thu, 12 Aug 2021 10:16:39 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="767982"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 12 Aug 2021 10:16 UTC

In article <261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>,
Laurent MANCHON <manchon.lm@gmail.com> wrote:
>on unix machine i don't like gawk i prefer mawk which is faster than gawk.
>and on windows, compiled program with Tawk v6.7 are faster than gawk.

This. I certainly think that if you have TAWK and are using it, you should
continue to use it. It is clearly the best and the fastest AWK
implementation.

Ignore all the "But you should be using GAWK, because we say so" nonsense
that you are seeing on this forum.

--
"We should always be disposed to believe that which appears to us to be
white is really black, if the hierarchy of the church so decides."

- Saint Ignatius Loyola (1491-1556) Founder of the Jesuit Order -

Re: asort function

<sf2u06$dj4$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=858&group=comp.lang.awk#858

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 12:43:18 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 14
Message-ID: <sf2u06$dj4$1@news-1.m-online.net>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf0n17$m9p6$1@news.xmission.com>
<6a38ebc2-b590-4630-a14a-5db81bf86dbfn@googlegroups.com>
<sf0vqt$qh$1@dont-email.me>
<bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>
<261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>
<sf2ide$ab7$1@news-1.m-online.net>
<1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com>
NNTP-Posting-Host: 2001:a61:241e:cc01:713d:219:5d94:710f
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1628764998 13924 2001:a61:241e:cc01:713d:219:5d94:710f (12 Aug 2021 10:43:18 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Thu, 12 Aug 2021 10:43:18 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
In-Reply-To: <1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com>
 by: Janis Papanagnou - Thu, 12 Aug 2021 10:43 UTC

[ please quote context if posting in Usenet ]

On 12.08.2021 10:10, Laurent MANCHON wrote:
> I think Awka has been discontinued for a long time now (http://awka.sourceforge.net/download.html),
> and not sure if it works with the latest versions of gcc.

It's discontinued, yes. (And I haven't tried to compile it with
the latest gcc.)

But isn't Tawk - that you use on Windows - also discontinued?
(So I've heard, at least, since many years.)

Janis

Re: asort function

<sf2up4$do5$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=860&group=comp.lang.awk#860

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!aioe.org!news.mb-net.net!open-news-network.org!news.bgeserver.de!bgepartei.de!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 12:56:36 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 46
Message-ID: <sf2up4$do5$1@news-1.m-online.net>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<bf57a5bc-993c-4aef-ae48-18f6c5041832n@googlegroups.com>
<261371b2-4ffd-4cf6-8a3e-d654fc6c46c6n@googlegroups.com>
<sf2ide$ab7$1@news-1.m-online.net> <sf2s8c$ndve$1@news.xmission.com>
NNTP-Posting-Host: 2001:a61:241e:cc01:713d:219:5d94:710f
Mime-Version: 1.0
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1628765796 14085 2001:a61:241e:cc01:713d:219:5d94:710f (12 Aug 2021 10:56:36 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Thu, 12 Aug 2021 10:56:36 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
X-Enigmail-Draft-Status: N1110
In-Reply-To: <sf2s8c$ndve$1@news.xmission.com>
 by: Janis Papanagnou - Thu, 12 Aug 2021 10:56 UTC

On 12.08.2021 12:13, Kenny McCormack wrote:
> In article <sf2ide$ab7$1@news-1.m-online.net>,
> Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>> On 12.08.2021 09:02, Laurent MANCHON wrote:
>
>>> and on windows, compiled program with Tawk v6.7 are faster than gawk.
>
> 1) It is unlikely that speed really is an issue. Most people who think it
> is (in pretty much all contexts), turn out to be misguided. If you want
> efficiency, writing in AWK is probably not what you should be doing in the
> first place.

Or applying algorithms with better complexity. (C.f. for example Ben's
hint on an O(N) algorithm, as opposed to an O(N log N) or even an O(N^2)
algorithm like the one the OP posted as workaround.)

>> If speed is a critical issue you may also try awka, an Awk compiler.
>
> I don't think awka - or any other so-called "awk compiler" - makes any
> claims to making your program run faster. Aren't they all just for
> encryption (aka, code security) purposes?

Don't think so. The performance reference hint I gave was from A. Sumner
(the author of awka) and you can inspect that all at awka's Sourceforge
page.

>
> BTW, all this talk by you and your c.l.a friend which are of the strain
> "Why don't you just use GAWK like we do?" are misguided.

You have some misconception here; the two persons who suggested GNU Awk
in this thread were Ed and you.

I mentioned the performance results and pointed out the optimizations
that happened in GNU Awk during the past 20+ years since the performance
tests. (Even those old tests had a comment that it might be outdated by
the actual awk releases tested.)

But the OP's argument is anyway strange, WRT speed, and also WRT using
discontinued software, and with his assumption that Ed and you are not
really aware what median-calculation would require, so it's not really
worth engaging more here in this thread.

Janis

Re: asort function

<sf2vi3$nfnv$2@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=861&group=comp.lang.awk#861

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 11:09:55 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf2vi3$nfnv$2@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf2ide$ab7$1@news-1.m-online.net> <sf2s8c$ndve$1@news.xmission.com> <sf2up4$do5$1@news-1.m-online.net>
Injection-Date: Thu, 12 Aug 2021 11:09:55 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="769791"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 12 Aug 2021 11:09 UTC

In article <sf2up4$do5$1@news-1.m-online.net>,
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
....
>You have some misconception here; the two persons who suggested GNU Awk
>in this thread were Ed and you.

Really? I have repeatedly said "If you are using TAWK and are happy with
it, you should stick with it." I don't recall ever recommending he switch
to GAWK.

Eddie has, of course, certainly done so.

--

"This ain't my first time at the rodeo"

is a line from the movie, Mommie Dearest, said by Joan Crawford at a board meeting.

Re: asort function

<sf30g7$nfnv$3@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=862&group=comp.lang.awk#862

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 11:25:59 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf30g7$nfnv$3@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf2ide$ab7$1@news-1.m-online.net> <1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com> <sf2u06$dj4$1@news-1.m-online.net>
Injection-Date: Thu, 12 Aug 2021 11:25:59 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="769791"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 12 Aug 2021 11:25 UTC

In article <sf2u06$dj4$1@news-1.m-online.net>,
Janis Papanagnou <janis_papanagnou@hotmail.com> wrote:
>[ please quote context if posting in Usenet ]
>
>On 12.08.2021 10:10, Laurent MANCHON wrote:
>> I think Awka has been discontinued for a long time now
>(http://awka.sourceforge.net/download.html),
>> and not sure if it works with the latest versions of gcc.
>
>It's discontinued, yes. (And I haven't tried to compile it with
>the latest gcc.)
>
>But isn't Tawk - that you use on Windows - also discontinued?
>(So I've heard, at least, since many years.)

Yes, but it doesn't matter (in the case of TAWK).

Yes, I know that one of the first commandments of using software is that
you can't use software that isn't being maintained. Your PHB will can your
ass!

And it looks like AWKa fits the mold. Since AWKs is basically a shim
between GAWK and GCC, you'd have to verify that it works with the current
versions of both of those pieces of software. Since it is not being
maintained, it almost certainly isn't compatible with one or both of them.

TAWK is different, though. Since it is:
1) (almost) Perfect
and
2) Entirely standalone
the fact that it is not being maintained is irrelevant.

BTW, I said (almost) above because there is one area where I prefer GAWK.
That is when dealing with files with very long lines - in my work, this
involves lines of several hundred thousands of bytes. TAWK fails badly if
your input lines are too long - and I say "fails badly" because it doesn't
generate error messages; it just generates incorrect results.

There are workarounds, but it is a PIA - and, of course, you have to notice
the incorrect results (and convince yourself that the bug is not in *your*
code) in order to know to deploy the workarounds.

BTW, I don't use TAWK much anymore, because I don't use Windows much
anymore, but when I do use Windows, I tend to use (Cygwin) GAWK, because:
1) The line length problem mentioned above.
2) Compatibility. I can develop on Linux and deploy on Windows.

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/IceCream

Re: asort function

<15741778-6060-4848-8238-564a6af30954n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=863&group=comp.lang.awk#863

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:ac8:57c8:: with SMTP id w8mr3479458qta.153.1628770398960; Thu, 12 Aug 2021 05:13:18 -0700 (PDT)
X-Received: by 2002:a25:d006:: with SMTP id h6mr4171077ybg.519.1628770398774; Thu, 12 Aug 2021 05:13:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Thu, 12 Aug 2021 05:13:18 -0700 (PDT)
In-Reply-To: <sf30g7$nfnv$3@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=194.167.33.174; posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 194.167.33.174
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <sf2ide$ab7$1@news-1.m-online.net> <1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com> <sf2u06$dj4$1@news-1.m-online.net> <sf30g7$nfnv$3@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <15741778-6060-4848-8238-564a6af30954n@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Thu, 12 Aug 2021 12:13:18 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 6
 by: Laurent MANCHON - Thu, 12 Aug 2021 12:13 UTC

--
i don't work with very long lines, but i work with very big text files with million of rows.
In in my opinion the main drawback of all awk's family is the string concatenation, it takes too much time,
and this is what I have noted.
Maybe it's common to all languages, I don't know how C handles it.

Re: asort function

<sf33u7$f94$1@news-1.m-online.net>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=865&group=comp.lang.awk#865

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!news.karotte.org!news.space.net!news.m-online.net!.POSTED!not-for-mail
From: janis_papanagnou@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: asort function
Date: Thu, 12 Aug 2021 14:24:39 +0200
Organization: (posted via) M-net Telekommunikations GmbH
Lines: 16
Message-ID: <sf33u7$f94$1@news-1.m-online.net>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf2ide$ab7$1@news-1.m-online.net>
<1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com>
<sf2u06$dj4$1@news-1.m-online.net> <sf30g7$nfnv$3@news.xmission.com>
<15741778-6060-4848-8238-564a6af30954n@googlegroups.com>
NNTP-Posting-Host: 2001:a61:241e:cc01:713d:219:5d94:710f
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
X-Trace: news-1.m-online.net 1628771079 15652 2001:a61:241e:cc01:713d:219:5d94:710f (12 Aug 2021 12:24:39 GMT)
X-Complaints-To: news@news-1.m-online.net
NNTP-Posting-Date: Thu, 12 Aug 2021 12:24:39 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
In-Reply-To: <15741778-6060-4848-8238-564a6af30954n@googlegroups.com>
 by: Janis Papanagnou - Thu, 12 Aug 2021 12:24 UTC

On 12.08.2021 14:13, Laurent MANCHON wrote:
> --
> i don't work with very long lines, but i work with very big text files with million of rows.
> In in my opinion the main drawback of all awk's family is the string concatenation, it takes too much time,
> and this is what I have noted.

Do you mean arbitrary string value concatenations, or adding strings
to an existing string? The latter, i.e. x = x a b c ..., has in GNU
Awk an optimization that makes it very fast.

Janis

> Maybe it's common to all languages, I don't know how C handles it.
>
>

Re: asort function

<a7bfa7f2-27c8-4d67-a11f-3fc90653e6bfn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=866&group=comp.lang.awk#866

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a37:6387:: with SMTP id x129mr4356713qkb.42.1628771502345;
Thu, 12 Aug 2021 05:31:42 -0700 (PDT)
X-Received: by 2002:a25:2d0:: with SMTP id 199mr4031244ybc.123.1628771502165;
Thu, 12 Aug 2021 05:31:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Thu, 12 Aug 2021 05:31:41 -0700 (PDT)
In-Reply-To: <sf33u7$f94$1@news-1.m-online.net>
Injection-Info: google-groups.googlegroups.com; posting-host=194.167.33.174; posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 194.167.33.174
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<sf2ide$ab7$1@news-1.m-online.net> <1cbe174b-f253-4ad9-86c7-c7e5af9c4531n@googlegroups.com>
<sf2u06$dj4$1@news-1.m-online.net> <sf30g7$nfnv$3@news.xmission.com>
<15741778-6060-4848-8238-564a6af30954n@googlegroups.com> <sf33u7$f94$1@news-1.m-online.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a7bfa7f2-27c8-4d67-a11f-3fc90653e6bfn@googlegroups.com>
Subject: Re: asort function
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Thu, 12 Aug 2021 12:31:42 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Thu, 12 Aug 2021 12:31 UTC

typically this kind of concatenation:
....
if(!(list[i])){list[i]=array[i,j];}
else{list[i]=list[i] SUBSEP array[i,j];}

Use multi-dimensional arrays, Luke! (Was: asort function)

<sf3cmn$nkf6$1@news.xmission.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=868&group=comp.lang.awk#868

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail
From: gazelle@shell.xmission.com (Kenny McCormack)
Newsgroups: comp.lang.awk
Subject: Use multi-dimensional arrays, Luke! (Was: asort function)
Date: Thu, 12 Aug 2021 14:54:15 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf3cmn$nkf6$1@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <15741778-6060-4848-8238-564a6af30954n@googlegroups.com> <sf33u7$f94$1@news-1.m-online.net> <a7bfa7f2-27c8-4d67-a11f-3fc90653e6bfn@googlegroups.com>
Injection-Date: Thu, 12 Aug 2021 14:54:15 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="774630"; mail-complaints-to="abuse@xmission.com"
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
Originator: gazelle@shell.xmission.com (Kenny McCormack)
 by: Kenny McCormack - Thu, 12 Aug 2021 14:54 UTC

In article <a7bfa7f2-27c8-4d67-a11f-3fc90653e6bfn@googlegroups.com>,
Laurent MANCHON <manchon.lm@gmail.com> wrote:
>typically this kind of concatenation:
>...
>if(!(list[i])){list[i]=array[i,j];}
>else{list[i]=list[i] SUBSEP array[i,j];}
>

Well, there's your problem, right there.

If you are using either TAWK or GAWK (which you clearly are), then you
should not be using the old-fashioned SUBSEP-based pseudo-multi-dimensional
arrays. Use real, true multi-dimensional arrays - like a big boy!

--
The randomly chosen signature file that would have appeared here is more than 4
lines long. As such, it violates one or more Usenet RFCs. In order to remain
in compliance with said RFCs, the actual sig can be found at the following URL:
http://user.xmission.com/~gazelle/Sigs/DanQuayle

Re: Use multi-dimensional arrays, Luke! (Was: asort function)

<2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=869&group=comp.lang.awk#869

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:622a:188d:: with SMTP id v13mr4352749qtc.192.1628780644607;
Thu, 12 Aug 2021 08:04:04 -0700 (PDT)
X-Received: by 2002:a25:618f:: with SMTP id v137mr5051607ybb.374.1628780644401;
Thu, 12 Aug 2021 08:04:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!usenet.pasdenom.info!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.awk
Date: Thu, 12 Aug 2021 08:04:04 -0700 (PDT)
In-Reply-To: <sf3cmn$nkf6$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=194.167.33.174; posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 194.167.33.174
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<15741778-6060-4848-8238-564a6af30954n@googlegroups.com> <sf33u7$f94$1@news-1.m-online.net>
<a7bfa7f2-27c8-4d67-a11f-3fc90653e6bfn@googlegroups.com> <sf3cmn$nkf6$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com>
Subject: Re: Use multi-dimensional arrays, Luke! (Was: asort function)
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Thu, 12 Aug 2021 15:04:04 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Thu, 12 Aug 2021 15:04 UTC

--
Sure Tawk can do that ?
--

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor