Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

"Jesus may love you, but I think you're garbage wrapped in skin." -- Michael O'Donohugh


devel / comp.lang.awk / Re: GAWK: Bug/mis-feature in arraymax.awk

SubjectAuthor
* GAWK: Bug/mis-feature in arraymax.awkKenny McCormack
`* Re: GAWK: Bug/mis-feature in arraymax.awkAndrew Schorr
 +- Re: GAWK: Bug/mis-feature in arraymax.awkKenny McCormack
 `- Re: GAWK: Bug/mis-feature in arraymax.awkKaz Kylheku

1
GAWK: Bug/mis-feature in arraymax.awk

<ss6jtq$3alh8$2@news.xmission.com>

  copy mid

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

  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: GAWK: Bug/mis-feature in arraymax.awk
Date: Tue, 18 Jan 2022 14:47:22 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <ss6jtq$3alh8$2@news.xmission.com>
Injection-Date: Tue, 18 Jan 2022 14:47:22 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="3495464"; 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 - Tue, 18 Jan 2022 14:47 UTC

The GAWK distro contains an example program called arraymax.awk - that
calculates the maximum of a series of input values. However, it uses the
naive way of calculating the max - which fails if all the values are
negative (Tested and verified by taking the sample data file and prefixing
all the numbers with "-"; the program then generates no output).

Perhaps something to fix. Note the correct algorithm in my other post,
where you initialize the max value to the first input arg.

--
If there is anything more pathetic than Dr. Donald Trump, MD, giving out medical
advice, it is the pathetic followers of Dr. Trump trying to implement said advice.

Re: GAWK: Bug/mis-feature in arraymax.awk

<257744db-2aa0-4e4a-8434-7adadb81fdf1n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:ac8:5708:: with SMTP id 8mr22681628qtw.689.1642685488346; Thu, 20 Jan 2022 05:31:28 -0800 (PST)
X-Received: by 2002:a25:a264:: with SMTP id b91mr46768071ybi.58.1642685488058; Thu, 20 Jan 2022 05:31:28 -0800 (PST)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!feeder1.feed.usenet.farm!feed.usenet.farm!tr3.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, 20 Jan 2022 05:31:27 -0800 (PST)
In-Reply-To: <ss6jtq$3alh8$2@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=38.76.0.51; posting-account=n5ws7AoAAADMJDAWfsygCPkNAonhHPfT
NNTP-Posting-Host: 38.76.0.51
References: <ss6jtq$3alh8$2@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <257744db-2aa0-4e4a-8434-7adadb81fdf1n@googlegroups.com>
Subject: Re: GAWK: Bug/mis-feature in arraymax.awk
From: aschorr@telemetry-investments.com (Andrew Schorr)
Injection-Date: Thu, 20 Jan 2022 13:31:28 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 24
 by: Andrew Schorr - Thu, 20 Jan 2022 13:31 UTC

On Tuesday, January 18, 2022 at 9:47:23 AM UTC-5, Kenny McCormack wrote:
> The GAWK distro contains an example program called arraymax.awk - that
> calculates the maximum of a series of input values.

Actually, it's just an inaptly-named sample program to demonstrate some array features,
not a general-purpose max calculator. From the docs:

https://www.gnu.org/software/gawk/manual/html_node/Array-Example.html

The following program takes a list of lines, each beginning with a line
number, and prints them out in order of line number. The line numbers
are not in order when they are first read---instead, they
are scrambled. This program sorts the lines by making an array using
the line numbers as subscripts. The program then prints out the lines
in sorted order of their numbers. It is a very simple program and gets
confused upon encountering repeated numbers, gaps, or lines that don't
begin with a number:
....

So I don't see why it's a bug. It does what it says it does, but I agree that it certainly
does not calculate maximum values in the general case.

Regards,
Andy

Re: GAWK: Bug/mis-feature in arraymax.awk

<ssbv61$3djg2$1@news.xmission.com>

  copy mid

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

  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: GAWK: Bug/mis-feature in arraymax.awk
Date: Thu, 20 Jan 2022 15:30:09 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <ssbv61$3djg2$1@news.xmission.com>
References: <ss6jtq$3alh8$2@news.xmission.com> <257744db-2aa0-4e4a-8434-7adadb81fdf1n@googlegroups.com>
Injection-Date: Thu, 20 Jan 2022 15:30:09 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="3591682"; 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, 20 Jan 2022 15:30 UTC

In article <257744db-2aa0-4e4a-8434-7adadb81fdf1n@googlegroups.com>,
Andrew Schorr <aschorr@telemetry-investments.com> wrote:
>On Tuesday, January 18, 2022 at 9:47:23 AM UTC-5, Kenny McCormack wrote:
>> The GAWK distro contains an example program called arraymax.awk - that
>> calculates the maximum of a series of input values.
>
>Actually, it's just an inaptly-named sample program to demonstrate some array features,
>not a general-purpose max calculator. From the docs:

Agreed - and it is really no big deal. I wasn't even calling it a bug -
just a thing that could be fixed. I'm sure that, in the fullness of time,
someone (on the dev side) will notice it and decide to fix it.

You're right about the name being misleading. But I also want to point out
that when I said that it "calculates the maximum of a series of input values",
that doee not necessarily mean that that is its primary purpose. In this
case, that calculation is merely a step on the way to the actual purpose of
the program (if you see what I mean...)

--
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/InsaneParty

Re: GAWK: Bug/mis-feature in arraymax.awk

<20220122133918.907@kylheku.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: 480-992-1380@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.awk
Subject: Re: GAWK: Bug/mis-feature in arraymax.awk
Date: Sat, 22 Jan 2022 21:39:59 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <20220122133918.907@kylheku.com>
References: <ss6jtq$3alh8$2@news.xmission.com>
<257744db-2aa0-4e4a-8434-7adadb81fdf1n@googlegroups.com>
Injection-Date: Sat, 22 Jan 2022 21:39:59 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="957a0beef15c70c99a6b4dcbe088f552";
logging-data="18496"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/u71LGvFxjwvOZyCbG3EctesIr5KSrRvM="
User-Agent: slrn/1.0.3 (Linux)
Cancel-Lock: sha1:rPYt/L+/Rs8XO3Ws7PZ2CD/IAqI=
 by: Kaz Kylheku - Sat, 22 Jan 2022 21:39 UTC

On 2022-01-20, Andrew Schorr <aschorr@telemetry-investments.com> wrote:
> So I don't see why it's a bug. It does what it says it does, but I agree that it certainly
> does not calculate maximum values in the general case.

I.e. what is written on the box is a bug. The box says there are
Cheerios inside, and by golly, there actually are. But the box should
say Corn Flakes, damn it!

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor