Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

* dpkg ponders: 'C++' should have been called 'D' -- #Debian


devel / comp.lang.awk / Re: Display Isograms Using Awk and Inverse ANSI

SubjectAuthor
* Display Isograms Using Awk and Inverse ANSIMike Sanders
+* Re: Display Isograms Using Awk and Inverse ANSIJanis Papanagnou
|`* Re: Display Isograms Using Awk and Inverse ANSIMike Sanders
| `* Re: Display Isograms Using Awk and Inverse ANSIJanis Papanagnou
|  +- Re: Display Isograms Using Awk and Inverse ANSIJanis Papanagnou
|  `* Re: Display Isograms Using Awk and Inverse ANSIMike Sanders
|   `* Re: Display Isograms Using Awk and Inverse ANSIJanis Papanagnou
|    `* Re: Display Isograms Using Awk and Inverse ANSIMike Sanders
|     `- Re: Display Isograms Using Awk and Inverse ANSIKpop 2GM
`- OT: Some useful ANSI escapesMike Sanders

1
Display Isograms Using Awk and Inverse ANSI

<ug4rhr$1ekib$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!rocksolid2!news.neodome.net!news.mixmin.net!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkchop@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.awk
Subject: Display Isograms Using Awk and Inverse ANSI
Date: Wed, 11 Oct 2023 00:51:07 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 61
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <ug4rhr$1ekib$1@dont-email.me>
Injection-Date: Wed, 11 Oct 2023 00:51:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6365d68a9dc6c539953d7eaf8117ad";
logging-data="1528395"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19l01Ww17VOXJWq6ywxHUXB"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:yiDwT2XEOZKOCJgw/PsbDFXalL8=
 by: Mike Sanders - Wed, 11 Oct 2023 00:51 UTC

# Michael Sanders 2023
# https://busybox.neocities.org/notes/isogram.txt
# # awk script that displays isograms using inverse ANSI
# escapes (meaning fore & background colors are swapped)
# requires an ANSI capable terminal, rename this file
# and invoke script as:
# # awk -f isogram.awk file
# # isogram test block...
# # aberration lucrative concurrent espouse obfuscate
# garrulous promenade epiphany requiem juxtapose
# languid ephemeral abscond extricate circumvent
# obstinate vivacious corroborate attenuate paragon
# penchant serendipity superfluous immutable mitigate
# aplomb concatenate ethereal diaphanous demagogue
# cogitate pervasive anathema juxtaposition memento
# disparate oscillate ennui perfunctory parabola
# mellifluous recumbent ephemeral sycophant timorous
# voracious quixotic serenade conundrum vicarious
# insipid ornate camaraderie cogent introspection
# sanguine deleterious impeccable extraneous loquacious

BEGIN { print "\nisograms...\n" }

function hilite(str) { return "\033[7m" str "\033[0m" }

function isogram(str, c, x, y) {
y = length(str)
for (x = 1; x <= y; x++) {
c = substr(str, x, 1)
if (index(substr(str, x + 1), c) > 0) return 0 # !isogram
}
return 1 # isogram
}

{
word = ""
line = ""
for (x = 1; x <= length($0); x++) {
c = substr($0, x, 1)
if (c ~ /[[:space:]]/ || x == length($0)) {
if (x == length($0) && c !~ /[[:space:]]/) word = word c
line = (isogram(word) ? line hilite(word) : line word)
if(c ~ /[[:space:]]/) line = line c
word = ""
} else {
word = word c
}
}
print line
}

# eof

--
:wq
Mike Sanders

Re: Display Isograms Using Awk and Inverse ANSI

<ug5lja$1nphk$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: Display Isograms Using Awk and Inverse ANSI
Date: Wed, 11 Oct 2023 10:15:37 +0200
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <ug5lja$1nphk$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Oct 2023 08:15:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3bc14e56cca3059d45446cb2673ed17b";
logging-data="1828404"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+tmxNPM2iJfQYKsvfOg5cV"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:7tjkK+RYTPjLQQvb7YDg5ZUxaYQ=
X-Enigmail-Draft-Status: N1110
In-Reply-To: <ug4rhr$1ekib$1@dont-email.me>
 by: Janis Papanagnou - Wed, 11 Oct 2023 08:15 UTC

A quick glimpse at your code gives the impression that you
are parsing the line character-wise to identify "words".
In Awk it is usually better to use the inherent splitting
procedure and operate on $1, $2, etc. Even for cases where
punctuation and other characters may get into your way you
can just define the FS regular expression so that it fits
your needs. That should make your program much simpler and
also easier to understand and maintain.

Janis

On 11.10.2023 02:51, Mike Sanders wrote:
> # Michael Sanders 2023
> # https://busybox.neocities.org/notes/isogram.txt
> #
> # awk script that displays isograms using inverse ANSI
> # escapes (meaning fore & background colors are swapped)
> # requires an ANSI capable terminal, rename this file
> # and invoke script as:
> #
> # awk -f isogram.awk file
> #
> # isogram test block...
> #
> # aberration lucrative concurrent espouse obfuscate
> # garrulous promenade epiphany requiem juxtapose
> # languid ephemeral abscond extricate circumvent
> # obstinate vivacious corroborate attenuate paragon
> # penchant serendipity superfluous immutable mitigate
> # aplomb concatenate ethereal diaphanous demagogue
> # cogitate pervasive anathema juxtaposition memento
> # disparate oscillate ennui perfunctory parabola
> # mellifluous recumbent ephemeral sycophant timorous
> # voracious quixotic serenade conundrum vicarious
> # insipid ornate camaraderie cogent introspection
> # sanguine deleterious impeccable extraneous loquacious
>
> BEGIN { print "\nisograms...\n" }
>
> function hilite(str) { return "\033[7m" str "\033[0m" }
>
> function isogram(str, c, x, y) {
> y = length(str)
> for (x = 1; x <= y; x++) {
> c = substr(str, x, 1)
> if (index(substr(str, x + 1), c) > 0) return 0 # !isogram
> }
> return 1 # isogram
> }
>
> {
> word = ""
> line = ""
> for (x = 1; x <= length($0); x++) {
> c = substr($0, x, 1)
> if (c ~ /[[:space:]]/ || x == length($0)) {
> if (x == length($0) && c !~ /[[:space:]]/) word = word c
> line = (isogram(word) ? line hilite(word) : line word)
> if(c ~ /[[:space:]]/) line = line c
> word = ""
> } else {
> word = word c
> }
> }
> print line
> }
>
> # eof
>

Re: Display Isograms Using Awk and Inverse ANSI

<ug5sdt$1p59e$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkchop@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.awk
Subject: Re: Display Isograms Using Awk and Inverse ANSI
Date: Wed, 11 Oct 2023 10:12:13 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 28
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <ug5sdt$1p59e$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me> <ug5lja$1nphk$1@dont-email.me>
Injection-Date: Wed, 11 Oct 2023 10:12:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="8b6365d68a9dc6c539953d7eaf8117ad";
logging-data="1873198"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+47qgLCWkoN8u1960OkK9A"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:vtKfYVjMjtYIbJoiAgYjVH5jyfs=
 by: Mike Sanders - Wed, 11 Oct 2023 10:12 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

> A quick glimpse at your code gives the impression that you
> are parsing the line character-wise to identify "words".
> In Awk it is usually better to use the inherent splitting
> procedure and operate on $1, $2, etc. Even for cases where
> punctuation and other characters may get into your way you
> can just define the FS regular expression so that it fits
> your needs. That should make your program much simpler and
> also easier to understand and maintain.

Hi Janis.

Sure enough, you're 100% correct on this in my thinking.
In fact, I'm working now on a variant that does use $1, $2,
etc... One issue I'm groping to understand is how *not* to
destroy the layout of a given file upon output. In other
words, I want the output equal to the input with only
difference being that isograms are inverse color. The only
way I've worked through, so far at least, is to not assume
any file structure other than words...

Its an interesting problem to think about =)

--
:wq
Mike Sanders

Re: Display Isograms Using Awk and Inverse ANSI

<ug6j8g$1ua8a$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: Display Isograms Using Awk and Inverse ANSI
Date: Wed, 11 Oct 2023 18:41:51 +0200
Organization: A noiseless patient Spider
Lines: 54
Message-ID: <ug6j8g$1ua8a$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me> <ug5lja$1nphk$1@dont-email.me>
<ug5sdt$1p59e$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Oct 2023 16:41:52 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="55c20fd18a45876780de4b8a5c9ab74c";
logging-data="2042122"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19RlWYDygIH0PDR6ASR29HM"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:F7SSm/BvsAu5gb0K+15dVppf6NI=
In-Reply-To: <ug5sdt$1p59e$1@dont-email.me>
X-Enigmail-Draft-Status: N1110
 by: Janis Papanagnou - Wed, 11 Oct 2023 16:41 UTC

On 11.10.2023 12:12, Mike Sanders wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>
>> A quick glimpse at your code gives the impression that you
>> are parsing the line character-wise to identify "words".
>> In Awk it is usually better to use the inherent splitting
>> procedure and operate on $1, $2, etc. Even for cases where
>> punctuation and other characters may get into your way you
>> can just define the FS regular expression so that it fits
>> your needs. That should make your program much simpler and
>> also easier to understand and maintain.
>
> Hi Janis.
>
> Sure enough, you're 100% correct on this in my thinking.
> In fact, I'm working now on a variant that does use $1, $2,
> etc... One issue I'm groping to understand is how *not* to
> destroy the layout of a given file upon output. In other
> words, I want the output equal to the input with only
> difference being that isograms are inverse color. The only
> way I've worked through, so far at least, is to not assume
> any file structure other than words...
>
> Its an interesting problem to think about =)

Yes. A solution may also depend on the Awk version you are
allowed to use. With GNU Awk you can preserve the formatting
by using its newer features (array of separators!).

And with standard Awk you can work on patterns and preserve
formatting e.g. with a frame like

function predicate (s) { ...here's your isogram function... }

function escape (s) { return predicate(s) ? "E" s "E" : s }
# replace the two "E" by your ANSI escape code strings

{
out = ""
for (line=$0; match(line, /[[:alpha:]]+/);
line=substr(line,RSTART+RLENGTH)) {
out = out substr(line,1,RSTART-1)
escape(substr(line,RSTART,RLENGTH))
}
out = out line
print out
}

This code specifies the 'alpha' words as entities to consider;
change as desired. (I saw that your code also highlights a '#'
for example; not sure this is intended, though.)

Janis

Re: Display Isograms Using Awk and Inverse ANSI

<ug6jim$1ucop$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: Display Isograms Using Awk and Inverse ANSI
Date: Wed, 11 Oct 2023 18:47:17 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <ug6jim$1ucop$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me> <ug5lja$1nphk$1@dont-email.me>
<ug5sdt$1p59e$1@dont-email.me> <ug6j8g$1ua8a$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 11 Oct 2023 16:47:18 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="55c20fd18a45876780de4b8a5c9ab74c";
logging-data="2044697"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/SMY5dXSFL5es18/YTYRqS"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:wEynvEGiopUwEgxiSbMxn+gCe8w=
In-Reply-To: <ug6j8g$1ua8a$1@dont-email.me>
 by: Janis Papanagnou - Wed, 11 Oct 2023 16:47 UTC

On 11.10.2023 18:41, Janis Papanagnou wrote:
> [...]
>
> {
> out = ""
> for (line=$0; match(line, /[[:alpha:]]+/);
> line=substr(line,RSTART+RLENGTH)) {
> out = out substr(line,1,RSTART-1)
> escape(substr(line,RSTART,RLENGTH))
> }
> out = out line
> print out
> }
>
> [...]

(Sorry, my newsreader splitted two of the long lines.)
The two lines in above code starting at column 1 shall
be on one line:

for (line=$0; match(...); line=substr(...)) {

out = out substr(...) escape(substr(...))

Janis

Re: Display Isograms Using Awk and Inverse ANSI

<ug9fd6$2lcu4$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!paganini.bofh.team!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkchop@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.awk
Subject: Re: Display Isograms Using Awk and Inverse ANSI
Date: Thu, 12 Oct 2023 18:54:30 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 54
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <ug9fd6$2lcu4$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me> <ug5lja$1nphk$1@dont-email.me> <ug5sdt$1p59e$1@dont-email.me> <ug6j8g$1ua8a$1@dont-email.me>
Injection-Date: Thu, 12 Oct 2023 18:54:30 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e437a32b1da05df3e95d49f5a799fcda";
logging-data="2798532"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19+2TZJvzE+mnptBI+8JVc4"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:QF8Bj5Pbu20i//sCklOMppcbUaw=
 by: Mike Sanders - Thu, 12 Oct 2023 18:54 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

> Yes. A solution may also depend on the Awk version you are
> allowed to use. With GNU Awk you can preserve the formatting
> by using its newer features (array of separators!).

Very much for me, I cant always install things I'd like to,
but its okay, I'll work it out =)
> function predicate (s) { ...here's your isogram function... }

Excellent name for a function.
> function escape (s) { return predicate(s) ? "E" s "E" : s }
> # replace the two "E" by your ANSI escape code strings
>
> {
> out = ""
> for (line=$0; match(line, /[[:alpha:]]+/);
> line=substr(line,RSTART+RLENGTH)) {
> out = out substr(line,1,RSTART-1)
> escape(substr(line,RSTART,RLENGTH))
> }
> out = out line
> print out
> }
>
> This code specifies the 'alpha' words as entities to consider;
> change as desired. (I saw that your code also highlights a '#'
> for example; not sure this is intended, though.)

A single char... isogram or not? Probably not really, and then
there's the case of 'mixed' strings as your snippet deals with,
'abc-321'.

But back to the single character issue I'm going with:

function isogram(str, c, x, y) {
y = length(str)
if (y < 2) return 0 # !isogram <-- added this

for (x = 1; x <= y; x++) {
c = substr(str, x, 1)
if (index(substr(str, x + 1), c) > 0) return 0 # !isogram
}
return 1 # isogram
}

Thanks for your input Janis.

--
:wq
Mike Sanders

OT: Some useful ANSI escapes

<ug9s7l$2o7cv$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkchop@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.awk
Subject: OT: Some useful ANSI escapes
Date: Thu, 12 Oct 2023 22:33:25 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 48
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <ug9s7l$2o7cv$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me>
Injection-Date: Thu, 12 Oct 2023 22:33:25 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="63b4ae4903525f007c46645b4eabc11b";
logging-data="2891167"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19x2uF/zf3CF6EELBXLG4OL"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:xq61rLGY82fdt+ZxDaYxN5tAZGY=
 by: Mike Sanders - Thu, 12 Oct 2023 22:33 UTC

Mike Sanders <porkchop@invalid.foo> wrote:

> # requires an ANSI capable terminal...

for your notes:

tags: ANSI, escapes, colors, code

invert fore/background color: "\033[7m" str "\033[0m"

clear screen: "\033[H\033[2J"

hide cursor: "\033[?25l"

show cursor: "\033[?25h"

output to row & column: "\033[<ROW>;<COLUMN>H"

set titlebar (for terminals that support it): \033]0;Your Title Here\007

reset colors: "\033[0m"

foreground colors...

"\033[30mBlack"
"\033[31mRed"
"\033[32mGreen"
"\033[33mYellow"
"\033[34mBlue"
"\033[35mMagenta"
"\033[36mCyan"
"\033[37mWhite"

background colors...

"\033[40mBlack"
"\033[41mRed"
"\033[42mGreen"
"\033[43mYellow"
"\033[44mBlue"
"\033[45mMagenta"
"\033[46mCyan"
"\033[47mWhite"

--
:wq
Mike Sanders

Re: Display Isograms Using Awk and Inverse ANSI

<ugar8f$31ts5$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: janis_papanagnou+ng@hotmail.com (Janis Papanagnou)
Newsgroups: comp.lang.awk
Subject: Re: Display Isograms Using Awk and Inverse ANSI
Date: Fri, 13 Oct 2023 09:22:53 +0200
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <ugar8f$31ts5$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me> <ug5lja$1nphk$1@dont-email.me>
<ug5sdt$1p59e$1@dont-email.me> <ug6j8g$1ua8a$1@dont-email.me>
<ug9fd6$2lcu4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 13 Oct 2023 07:22:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ca60a1ca090bc6cd1be566003f254ebf";
logging-data="3209093"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wsvhGBQt6HJqs+dxrwsED"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:35MLsC3FLP/yxaT3MlG3WfTBW78=
In-Reply-To: <ug9fd6$2lcu4$1@dont-email.me>
 by: Janis Papanagnou - Fri, 13 Oct 2023 07:22 UTC

On 12.10.2023 20:54, Mike Sanders wrote:
> Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
>
>> function predicate (s) { ...here's your isogram function... }
>
> Excellent name for a function.

It's meant as generic name for the code pattern I wanted to show.

>> [...]
>>
>> This code specifies the 'alpha' words as entities to consider;
>> change as desired. (I saw that your code also highlights a '#'
>> for example; not sure this is intended, though.)
>
> A single char... isogram or not? Probably not really, and then
> there's the case of 'mixed' strings as your snippet deals with,
> 'abc-321'.

Oh, my question was more whether a non-alpha character shall be
considered a possible isogram.

>
> But back to the single character issue I'm going with:
>
> function isogram(str, c, x, y) {
> y = length(str)
> if (y < 2) return 0 # !isogram <-- added this
> [...]

That's why I also think a pattern based approach has advantages.

Janis

Re: Display Isograms Using Awk and Inverse ANSI

<ugcnmp$3g1d6$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: porkchop@invalid.foo (Mike Sanders)
Newsgroups: comp.lang.awk
Subject: Re: Display Isograms Using Awk and Inverse ANSI
Date: Sat, 14 Oct 2023 00:34:34 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 10
Sender: Mike Sanders <busybox@sdf.org>
Message-ID: <ugcnmp$3g1d6$1@dont-email.me>
References: <ug4rhr$1ekib$1@dont-email.me> <ug5lja$1nphk$1@dont-email.me> <ug5sdt$1p59e$1@dont-email.me> <ug6j8g$1ua8a$1@dont-email.me> <ug9fd6$2lcu4$1@dont-email.me> <ugar8f$31ts5$1@dont-email.me>
Injection-Date: Sat, 14 Oct 2023 00:34:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7a4b14fe9c3413f52ecd523ddc996f08";
logging-data="3671462"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18L5A51pc0rv2IK0OKXHnYP"
User-Agent: tin/2.6.2-20221225 ("Pittyvaich") (NetBSD/9.3 (amd64))
Cancel-Lock: sha1:o7NYnDZa89r7zKLso/IGDMXgvFg=
 by: Mike Sanders - Sat, 14 Oct 2023 00:34 UTC

Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:

> That's why I also think a pattern based approach has advantages.

Yes, anything the human mind can conceive is valid.

--
:wq
Mike Sanders

Re: Display Isograms Using Awk and Inverse ANSI

<4cf5fa9a-3d6f-410f-8baf-f46499b3d128n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.awk
X-Received: by 2002:ac8:4591:0:b0:415:15f9:c070 with SMTP id l17-20020ac84591000000b0041515f9c070mr68415qtn.6.1698448444754;
Fri, 27 Oct 2023 16:14:04 -0700 (PDT)
X-Received: by 2002:a05:6870:7190:b0:1e9:fbf0:3cdc with SMTP id
d16-20020a056870719000b001e9fbf03cdcmr1758155oah.4.1698448444535; Fri, 27 Oct
2023 16:14:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.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: Fri, 27 Oct 2023 16:14:03 -0700 (PDT)
In-Reply-To: <ugcnmp$3g1d6$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2603:7000:3c3d:41c0:ac80:1475:6079:42f9;
posting-account=n74spgoAAAAZZyBGGjbj9G0N4Q659lEi
NNTP-Posting-Host: 2603:7000:3c3d:41c0:ac80:1475:6079:42f9
References: <ug4rhr$1ekib$1@dont-email.me> <ug5lja$1nphk$1@dont-email.me>
<ug5sdt$1p59e$1@dont-email.me> <ug6j8g$1ua8a$1@dont-email.me>
<ug9fd6$2lcu4$1@dont-email.me> <ugar8f$31ts5$1@dont-email.me> <ugcnmp$3g1d6$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4cf5fa9a-3d6f-410f-8baf-f46499b3d128n@googlegroups.com>
Subject: Re: Display Isograms Using Awk and Inverse ANSI
From: jason.cy.kwan@gmail.com (Kpop 2GM)
Injection-Date: Fri, 27 Oct 2023 23:14:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1931
 by: Kpop 2GM - Fri, 27 Oct 2023 23:14 UTC

if you want an ultra quick ANSI color chart :

jot - 16 231 | mawk ' BEGIN { print (ORS = _)
.. . . . . . . . . . . . . . . . . . . . . _ *= __ = RS RS
} $NF = sprintf("\33[38;5;%dm%3d%.*s%.*s",
.. . . . . . . . . . . . . . . . . . . $_, $_, NR % 6^2 == _, RS,
.. . . . . . . . . . . . . . . . . . . . . . . . NR % 6^3 == _, __)'

the result is a VERY wide table spanning 6 rows, but that's the only way I could get the colors to properly line up with each other without complicated math.

— The 4Chan Teller

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor