Groups | Search | Server Info | Login | Register
Groups > comp.lang.awk > #10030
| From | Mike Sanders <porkchop@invalid.foo> |
|---|---|
| Newsgroups | comp.lang.awk |
| Subject | Re: nested ternary discovery |
| Date | 2025-10-12 03:47 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <10cf8bv$17hc6$1@dont-email.me> (permalink) |
| References | <10c866d$2lhr4$1@dont-email.me> <10c8j6q$2tqge$1@dont-email.me> <10cdg2t$nu0u$1@dont-email.me> <20251011094656.721@kylheku.com> |
On Sat, 11 Oct 2025 16:58:46 -0000 (UTC), Kaz Kylheku wrote:
Hey Kaz!
Guys you're miles ahead of me, I'm still learning.
Must study your reply more but 'linear' is sticking in my mind.
There is something to that as well as your left/right examples
that I can not yet articulate (its frustrating to recognize
these patterns but lack the vocabulary to describe them - argh!).
At any rate thanks Kaz.
> On 2025-10-11, Mike Sanders <porkchop@invalid.foo> wrote:
>> On Thu, 9 Oct 2025 17:09:13 +0200, Janis Papanagnou wrote:
>>
>>> (Let's call it "cascaded". Nested conditionals would in the general
>>> case - where you'd have another level of conditionals between the
>>> '?' and ':' - look even more complex and be much less readable, in
>>> both variants, conditional statements and conditional expressions.)
>>
>> 'Cascaded' - nice & clear distinction.
>
> It is nesting, but it is right associative. This is nesting:
>
> if (c1) {
> } else {
> if (c2) {
> } else {
> if (c3) {
> }
> }
> }
>
> Its still nesting when we remove the extra braces around the
> alternative ifs:
>
> if (c1) {
> } else
> if (c2) {
> } else
> if (c3) {
> }
>
> The c3 if is a constituent expression (i.e. nested within)
> the c2 if, which is nested within the c1 if.
>
> Because the nesting is right-leaning we can think of it as linear.
> and write it that way/
>
> if (c1) {
> } else if (c2) {
> } else if (c3) {
> }
>
> Same like Lisp lists where we have a right-leaning structure
>
> .
> a .
> b .
> c nil
>
> coresponding to the notation
>
> (a . (b . (c . nil)))
>
> which is preferentially spelled without the dots and extra
> parenteheses as:
>
> (a b c)
>
> and so then we call that a list; and not a nested list.Only this kind of
> object is called a nested list:
>
> (a (b c) d)
>
> The cell structure is nested, and so is the explicit dot notation
> for it. The list isn't nested, because the concept "list" is the name
> for a right-leaning nesting of the cell structure, viewed linearly,
> with an accompanying flat notation.
Back to comp.lang.awk | Previous | Next — Previous in thread | Next in thread | Find similar
nested ternary discovery Mike Sanders <porkchop@invalid.foo> - 2025-10-09 11:27 +0000
Re: nested ternary discovery Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-09 17:09 +0200
Re: nested ternary discovery Mike Sanders <porkchop@invalid.foo> - 2025-10-10 19:38 +0000
Re: nested ternary discovery Mike Sanders <porkchop@invalid.foo> - 2025-10-11 11:46 +0000
Re: nested ternary discovery Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-11 16:58 +0000
Re: nested ternary discovery Mike Sanders <porkchop@invalid.foo> - 2025-10-12 03:47 +0000
Re: nested ternary discovery Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-12 01:54 +0200
Re: nested ternary discovery Mike Sanders <porkchop@invalid.foo> - 2025-10-12 03:49 +0000
Re: nested ternary discovery Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-09 16:59 +0000
Re: nested ternary discovery mack@the-knife.org (Mack The Knife) - 2025-10-10 08:10 +0000
Re: nested ternary discovery Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-10 13:06 +0200
Re: nested ternary discovery Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-10 17:04 +0000
Re: nested ternary discovery mack@the-knife.org (Mack The Knife) - 2025-10-11 17:44 +0000
Re: nested ternary discovery Kaz Kylheku <643-408-1753@kylheku.com> - 2025-10-11 18:46 +0000
Re: nested ternary discovery mack@the-knife.org (Mack The Knife) - 2025-10-13 08:07 +0000
Re: nested ternary discovery Mike Sanders <porkchop@invalid.foo> - 2025-10-10 19:41 +0000
Re: nested ternary discovery Mike Sanders <porkchop@invalid.foo> - 2025-10-11 11:55 +0000
Re: nested ternary discovery Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-12 01:45 +0200
Re: nested ternary discovery dave_thompson_2@comcast.net - 2025-10-12 20:58 -0400
Re: nested ternary discovery Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-10-13 04:30 +0200
csiph-web