Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

A programming language is low level when its programs require attention to the irrelevant.


devel / comp.lang.awk / Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke! (Was: 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
Re: Use multi-dimensional arrays, Luke! (Was: asort function)

<sf3htk$nne5$1@news.xmission.com>

  copy mid

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

  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: Use multi-dimensional arrays, Luke! (Was: asort function)
Date: Thu, 12 Aug 2021 16:23:16 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf3htk$nne5$1@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <a7bfa7f2-27c8-4d67-a11f-3fc90653e6bfn@googlegroups.com> <sf3cmn$nkf6$1@news.xmission.com> <2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com>
Injection-Date: Thu, 12 Aug 2021 16:23:16 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="777669"; 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 16:23 UTC

In article <2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com>,
Laurent MANCHON <manchon.lm@gmail.com> wrote:
>--
>Sure Tawk can do that ?
>--

yes.

--
To most Christians, the Bible is like a software license. Nobody
actually reads it. They just scroll to the bottom and click "I agree."

- author unknown -

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

<24b17405-ad5d-46e9-8d07-46917097b34cn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a37:a0c7:: with SMTP id j190mr5316508qke.418.1628785763236; Thu, 12 Aug 2021 09:29:23 -0700 (PDT)
X-Received: by 2002:a25:30d7:: with SMTP id w206mr5353962ybw.182.1628785760949; Thu, 12 Aug 2021 09:29:20 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.uzoreto.com!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, 12 Aug 2021 09:29:20 -0700 (PDT)
In-Reply-To: <sf3htk$nne5$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e34:efc5:49b0:48d5:2989:5a2d:59f3; posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 2a01:e34:efc5:49b0:48d5:2989:5a2d:59f3
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <a7bfa7f2-27c8-4d67-a11f-3fc90653e6bfn@googlegroups.com> <sf3cmn$nkf6$1@news.xmission.com> <2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com> <sf3htk$nne5$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <24b17405-ad5d-46e9-8d07-46917097b34cn@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 16:29:23 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 5
 by: Laurent MANCHON - Thu, 12 Aug 2021 16:29 UTC

--
i confirm, it works i have changed array[i,j] to array[i][j]
and the concatenation step to:

list[i]=list[i] SUBSEP array[i][j];

Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke! (Was: asort function))

<sf3kl7$nonq$1@news.xmission.com>

  copy mid

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

  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: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke! (Was: asort function))
Date: Thu, 12 Aug 2021 17:09:59 -0000 (UTC)
Organization: The official candy of the new Millennium
Message-ID: <sf3kl7$nonq$1@news.xmission.com>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com> <2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com> <sf3htk$nne5$1@news.xmission.com> <24b17405-ad5d-46e9-8d07-46917097b34cn@googlegroups.com>
Injection-Date: Thu, 12 Aug 2021 17:09:59 -0000 (UTC)
Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4";
logging-data="779002"; 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 17:09 UTC

In article <24b17405-ad5d-46e9-8d07-46917097b34cn@googlegroups.com>,
Laurent MANCHON <manchon.lm@gmail.com> wrote:
>--
>i confirm, it works i have changed array[i,j] to array[i][j]
>and the concatenation step to:
>
> list[i]=list[i] SUBSEP array[i][j];
>

And then what?

I don't know if you've ever really explained what it is you're doing, but
let me just say that whever I see "SUBSEP" in user code, I assume that the
programmer is trying to create a subscript in a pseudo-multi-dimensional
array. If that is the case for you and your code, then I'd argue that you
shouldn't be doing that, since you could be using real-multi-dimensional
arrays instead.

However, sometimes programmers use SUBSEP as a quick-and-dirty separator
for data, arguing that it is more or less guaranteed to never occur in
data, having nothing to do with pseudo-multi-dimensional arrays. This
usually works but is confusing to the reader of the code, since it looks
like array stuff.

Personally, I usually end up using ^A when I need a fake data separator.

Is there any particular reason why you are using SUBSEP in the code above?

--
Mike Huckabee has yet to consciously uncouple from Josh Duggar.

Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke! (Was: asort function))

<f66f3d4c-6078-4d93-817d-8d8ab2e2800an@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:620a:21d8:: with SMTP id h24mr6163628qka.499.1628794910651;
Thu, 12 Aug 2021 12:01:50 -0700 (PDT)
X-Received: by 2002:a25:2f8b:: with SMTP id v133mr6370258ybv.299.1628794910425;
Thu, 12 Aug 2021 12:01:50 -0700 (PDT)
Path: i2pn2.org!rocksolid2!i2pn.org!aioe.org!news.mixmin.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 12:01:50 -0700 (PDT)
In-Reply-To: <sf3kl7$nonq$1@news.xmission.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e34:efc5:49b0:48d5:2989:5a2d:59f3;
posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 2a01:e34:efc5:49b0:48d5:2989:5a2d:59f3
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com> <sf3htk$nne5$1@news.xmission.com>
<24b17405-ad5d-46e9-8d07-46917097b34cn@googlegroups.com> <sf3kl7$nonq$1@news.xmission.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <f66f3d4c-6078-4d93-817d-8d8ab2e2800an@googlegroups.com>
Subject: Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke!
(Was: asort function))
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Thu, 12 Aug 2021 19:01:50 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Thu, 12 Aug 2021 19:01 UTC

--
absolutely, I use SUBSEP as a concatenation separator.
I could have declared SUBSEP=";" in the begin statement for more security.

Re: asort function

<sf65aq$nue$1@dont-email.me>

  copy mid

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

  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: Fri, 13 Aug 2021 11:06:50 -0500
Organization: A noiseless patient Spider
Lines: 36
Message-ID: <sf65aq$nue$1@dont-email.me>
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>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Aug 2021 16:06:50 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="952c972c8d9f3b410f1bb806b19d247d";
logging-data="24526"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/di97JlaJiMStfWprVsBvp"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Cancel-Lock: sha1:FuvORedQb45nXAdA+QRdbunEYio=
In-Reply-To: <15741778-6060-4848-8238-564a6af30954n@googlegroups.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 210813-0, 8/12/2021), Outbound message
 by: Ed Morton - Fri, 13 Aug 2021 16:06 UTC

On 8/12/2021 7:13 AM, Laurent MANCHON wrote:

[When posting please include enough context that your post makes sense
stand-alone - this is usenet, not a forum]

> --
> 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.
>
>

C handles it by requiring you to allocate enough memory up front when
you declare your variables for the maximum that might be required for
that variable. So in C you do something like (pseudo-code):

char x[50] # allocate 50 chars space in memory for x.
x = "foo" # the first 3 chars of x are populated with "foo".
x = x "bar" # the first 6 chars of x are populated with "foobar".

since x already has enough memory to add "bar" to the end but you don't
declare variables in awk so the equivalent is:

x = "foo" # allocate 3 chars space in memory for x and
# populate it with "foo".
x = x "bar" # allocate 6 chars space in memory for x, populate it
# with "foobar", and change the reference for "x" to
# point to the new memory location if required.

It's probably not exactly that simple and I'm sure gawk at least has
some optimizations for it but that gives you idea of why awk has more
work to do than C when concatenating a string to an existing variable -
static memory allocation for it in C vs dynamic memory allocation in awk.

Ed.

Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke! (Was: asort function))

<sf65et$nue$2@dont-email.me>

  copy mid

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

  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: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke!
(Was: asort function))
Date: Fri, 13 Aug 2021 11:09:03 -0500
Organization: A noiseless patient Spider
Lines: 11
Message-ID: <sf65et$nue$2@dont-email.me>
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com>
<sf3htk$nne5$1@news.xmission.com>
<24b17405-ad5d-46e9-8d07-46917097b34cn@googlegroups.com>
<sf3kl7$nonq$1@news.xmission.com>
<f66f3d4c-6078-4d93-817d-8d8ab2e2800an@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Aug 2021 16:09:01 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="952c972c8d9f3b410f1bb806b19d247d";
logging-data="24526"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+zifj0tRZxmdJS9Yhnf1or"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
Cancel-Lock: sha1:ZI6IrR+84eEAwQulwXF0woN1YHE=
In-Reply-To: <f66f3d4c-6078-4d93-817d-8d8ab2e2800an@googlegroups.com>
X-Antivirus-Status: Clean
Content-Language: en-US
X-Antivirus: Avast (VPS 210813-0, 8/12/2021), Outbound message
 by: Ed Morton - Fri, 13 Aug 2021 16:09 UTC

On 8/12/2021 2:01 PM, Laurent MANCHON wrote:
> --
> absolutely, I use SUBSEP as a concatenation separator.
> I could have declared SUBSEP=";" in the begin statement for more security.
>

Please include enough context in your posts so those of us trying to
follow them on usenet know what they're about. See the posts from
everyone else in this thread for examples of that.

Ed.

Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke! (Was: asort function))

<27387192-ff6a-4689-8582-3dda10916ef0n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:a05:620a:b4f:: with SMTP id x15mr3057432qkg.436.1628871897063;
Fri, 13 Aug 2021 09:24:57 -0700 (PDT)
X-Received: by 2002:a25:618f:: with SMTP id v137mr4031285ybb.374.1628871896866;
Fri, 13 Aug 2021 09:24:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!feeder1.cambriumusenet.nl!feed.tweak.nl!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: Fri, 13 Aug 2021 09:24:56 -0700 (PDT)
In-Reply-To: <sf65et$nue$2@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2a01:e34:efc5:49b0:111e:e9da:5864:7656;
posting-account=Wnk9kAoAAABSznUr8dglNh2B_-ufcnK7
NNTP-Posting-Host: 2a01:e34:efc5:49b0:111e:e9da:5864:7656
References: <b0a1d496-2fb2-4e79-bc35-a9f07b2d4f5dn@googlegroups.com>
<2ecbd17e-24b0-427a-ad81-28b05641463dn@googlegroups.com> <sf3htk$nne5$1@news.xmission.com>
<24b17405-ad5d-46e9-8d07-46917097b34cn@googlegroups.com> <sf3kl7$nonq$1@news.xmission.com>
<f66f3d4c-6078-4d93-817d-8d8ab2e2800an@googlegroups.com> <sf65et$nue$2@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <27387192-ff6a-4689-8582-3dda10916ef0n@googlegroups.com>
Subject: Re: Using SUBSEP; why? (Was: Use multi-dimensional arrays, Luke!
(Was: asort function))
From: manchon.lm@gmail.com (Laurent MANCHON)
Injection-Date: Fri, 13 Aug 2021 16:24:57 +0000
Content-Type: text/plain; charset="UTF-8"
 by: Laurent MANCHON - Fri, 13 Aug 2021 16:24 UTC

i think i understood.
in C you have to anticipate the size of the memory you will need. You don't know in advance how many concatenations you have to do.

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor