Groups | Search | Server Info | Login | Register


Groups > comp.lang.misc > #11721

Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays

From antispam@fricas.org (Waldek Hebisch)
Newsgroups comp.lang.misc
Subject Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays
Date 2025-12-28 21:43 +0000
Organization To protect and to server
Message-ID <10is8ap$2jg7c$1@paganini.bofh.team> (permalink)
References <10ilrbc$25ihi$10@dont-email.me>

Show all headers | View raw


Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
> Occasionally I had the demand to create arbitrarily nested arrays of
> arrays (similar to the question in [*]). This requires something like
> [][]...[] SOMETYPE and the corresponding nested loops for processing
>   FOR i ...
>     ...
>       FOR j ...
>         FOR k ...
> But these are static definitions and don't scale for arbitrary depth.
> (The dimension/depth of nesting is defined during runtime at start!)
> 
> In the context of another language I had implemented such logic simply
> by linearizing the arrays and the associated array index calculation.
> 
> An alternative approach could be to build the structures recursively
> (with linked data structures) and with a recursive set of functions.

Linearization seem to be best as implementaition.  For typed
interface nice way is to use list (or vectors) as indices.  If a
language has simple way of creating lists you could have code like

   a([1, 2, 3, 4])

for accessing elements.  Concerning iteration, simple in-order
iteration basically needs to implement multiposition counter
with carries at appropriate points.  Or you could expose
undelying linear structure.  For exmple in Lisp there is
ROW-MAJOR-AREF to access elements of possibly multidimensional
array in lineare order and there is ARRAY-ROW-MAJOR-INDEX
to get linear index corresponding to given tuple of indices
(useful when one wants to deal with slices).

-- 
                              Waldek Hebisch

Back to comp.lang.misc | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Algol 68 (or generally) - arbitrarily nested arrays of arrays Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-26 12:25 +0100
  Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Andy Walker <anw@cuboid.co.uk> - 2025-12-28 12:53 +0000
    Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays ram@zedat.fu-berlin.de (Stefan Ram) - 2025-12-28 14:13 +0000
      Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays ram@zedat.fu-berlin.de (Stefan Ram) - 2025-12-28 14:29 +0000
        Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays ram@zedat.fu-berlin.de (Stefan Ram) - 2025-12-28 14:41 +0000
          Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays ram@zedat.fu-berlin.de (Stefan Ram) - 2025-12-28 14:45 +0000
            Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays ram@zedat.fu-berlin.de (Stefan Ram) - 2025-12-28 23:22 +0000
        Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-28 15:53 +0100
    Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-28 15:47 +0100
      Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Andy Walker <anw@cuboid.co.uk> - 2025-12-30 16:29 +0000
        Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2026-01-01 12:21 +0100
          Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays David Brown <david.brown@hesbynett.no> - 2026-01-01 17:18 +0100
  Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays bart <bc@freeuk.com> - 2025-12-28 15:32 +0000
    Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-28 23:48 +0100
    Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-28 22:54 +0000
      Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays bart <bc@freeuk.com> - 2025-12-28 23:07 +0000
        Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Lawrence D’Oliveiro <ldo@nz.invalid> - 2025-12-28 23:29 +0000
  Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays antispam@fricas.org (Waldek Hebisch) - 2025-12-28 21:43 +0000
    Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays Janis Papanagnou <janis_papanagnou+ng@hotmail.com> - 2025-12-28 23:50 +0100

csiph-web