bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete of nested array is in consistent


From: david kerns
Subject: Re: delete of nested array is in consistent
Date: Thu, 16 Apr 2020 16:05:08 -0700

pretty sure gawk still doesn't have "true" multi-dimensional arrays...

A *multidimensional array* is an array in which an element is identified by
a sequence of indices instead of a single index. For example, a
two-dimensional array requires two indices. The usual way (in many
languages, including awk) to refer to an element of a two-dimensional array
named grid is with grid[x,y].

Multidimensional arrays are supported in awk through concatenation of
indices into one string. awk converts the indices into strings (see
section Conversion
of Strings and Numbers
<https://www.gnu.org/software/gawk/manual/html_node/Conversion.html#Conversion>)
and concatenates them together, with a separator between them. This creates
a single string that describes the values of the separate indices. The
combined string is used as a single index into an ordinary, one-dimensional
array. The separator used is the value of the built-in variable SUBSEP.

On Thu, Apr 16, 2020 at 3:31 PM Peng Yu <address@hidden> wrote:

> See below. I'd expect the second one should also print array. Is it a bug?
>
> $ awk -e 'BEGIN { delete a[""]; print typeof(a) }'
> array
> $ awk -e 'BEGIN { delete a[1][""]; print typeof(a[1]) }'
> unassigned
>
> --
> Regards,
> Peng
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]