Discussion:
HID: LIST list arrays
(too old to reply)
digi_cs
2024-10-17 05:23:53 UTC
Permalink
Hello!

FYI

@include “github.com/digics/UID10/uid.lib”

LIST = hid::get( “LIST” )


An array (A) in AWK can represent a list of unique items with an undefined order.
To introduce the concept of an array with a defined sequence of its indexes (items),
we need to specify this sequence in a subarray A[LIST] as a simple list:

The element A[ LIST ][ "" ] stores the index of the first item in the list:

# items of A: first, next and last:

A[ LIST ][ “” ] = “first”
A[ LIST [ “first” ] = “next”
A[ LIST ][ “next” ] = “last”
A[ LIST ][ “last” [ = “”

A [ “first” ]...
A[ “next” ]...
A[ “last” ]...

Thus, instead of a for-in loop for array A, we use:

i = “”
while ( “” != i = A[ LIST][ i ] )

# process A[ i ]

or

for ( i = “”; “” != i = A[ LIST ][ i ]; )

# process A[ i ]

At the same time, we can still work with the main array in a for-in loop — with one caveat:

for ( i in A )

if ( i in HID )

continue # this is hid (LIST)

else

# process A[ i ]

In case a bidirectional list is needed, another subarray A[LIST][LIST] is created
within the subarray A[LIST], where the items are listed in reverse order,
and the element A[LIST][LIST][""] stores the index of the last item in the list.

best regards)


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from https://www.shemes.com/ =-
Kaz Kylheku
2024-10-18 18:58:21 UTC
Permalink
Post by digi_cs
Hello!
FYI
@include “github.com/digics/UID10/uid.lib”
LIST = hid::get( “LIST” )
I understand you're super excited (and I have been there many times)
but it would be better to slow down and consolidate everything into one
post, with good formatting and no weird character replacements.

Use a test newsgroup to work out posting issues.

I suspect it might be your posting software which is replacing
certain characters with codes like <93> and <94>.

What is that? Decimal 93 and 94 do not correspond to ASCII
quotes, and neither do the hex Unicode points U+0093 and U+0094,
which are control characters.

Find a decent news client. Many people use Mozilla Thunderbird, which is
an e-mail program that wants to be an newsreader when it grows up, but
people seem to do okay with it. I wouldn't use it myself, but I suspect
it could do a better job for you than what you're using now.
Post by digi_cs
--------------= Posted using XXXXXX =----------------
Proper news posting software does not add its own signature
to your article body. It uses X headers to announce its name
and version, which are missing in your post.

Moreover, signatures are set apart by a line containing "-- "
(hyphen, hyphen, space).

The authors must be stupendous ignoramuses, which explains
the <93> stuff.

P.S. I put XXXXX over the software's name in the quote above because my
news server rejects the post otherwise as spam; it thinks I'm posting
something with that software, which is evidently used by spammers.
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @***@mstdn.ca
d***@comcast.net
2024-10-20 10:49:41 UTC
Permalink
On Fri, 18 Oct 2024 18:58:21 -0000 (UTC), Kaz Kylheku
Post by Kaz Kylheku
@include ?github.com/digics/UID10/uid.lib?
LIST = hid::get( ?LIST? )
I understand you're super excited (and I have been there many times)
but it would be better to slow down and consolidate everything into one
post, with good formatting and no weird character replacements.
Use a test newsgroup to work out posting issues.
I suspect it might be your posting software which is replacing
certain characters with codes like <93> and <94>.
What is that? Decimal 93 and 94 do not correspond to ASCII
quotes, and neither do the hex Unicode points U+0093 and U+0094,
which are control characters.
x93 and x94 are the evil 'smart' (double)quotes (left and right) in
Microsoft CP1252, which lots of MSware and imitationware changes
automatically to make your text supposedly prettier. AFAICT web
browsers have conceded to this by treating things declared as 8859-1
as actually 1252 (affecting only C1 = x80 to x9F, little used in true
8859 OR Unicode). x91 and x92 are the similar singlequotes.

Loading...