Groups | Search | Server Info | Login | Register
Groups > comp.lang.misc > #11718
| From | Janis Papanagnou <janis_papanagnou+ng@hotmail.com> |
|---|---|
| Newsgroups | comp.lang.misc |
| Subject | Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays |
| Date | 2025-12-28 15:47 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <10irfui$2suuo$1@dont-email.me> (permalink) |
| References | <10ilrbc$25ihi$10@dont-email.me> <10ir98e$4b53$1@dont-email.me> |
On 2025-12-28 13:53, Andy Walker wrote: > On 26/12/2025 11:25, Janis Papanagnou 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!) > > See below! > >> 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. >> Now pondering what to do in Algol 68... > > I don't see how anyone can advise without knowing more about > what the actual, underlying, problem is. Sorry. I thought the abstraction would be sufficiently clear. :-/ (Especially since the Stackoverflow link I posted described it as well. - I admit with a similar abstraction grade, but clear enough for me at least; I've met that task in the past already, so it's not new for me. - I seem to recall that I've done something like that in C++ with template-meta-programming.) > My personal inclination, from > a position of complete ignorance about what you're really trying to do, > would be to go for a recursive solution. Yes, that's an option. - My own thoughts with recursive functions were along using them with recursive (linked) data structures. But that would bloat the simple structure and I was reluctant to take that path. > >> [...] >> Or is there some code pattern [in Algol 68] that would simplify the >> task without muddying the clarity of the algorithms? > > [This is the "See below"!] You say that the depth is determined > at "start". An alternative could be to construct an A68 program of the > right depth "on the fly". A simple program goes through constructing > the right number of nested "FOR" loops, or whatever. [...] Thanks. But Yuck! - I'd prefer static Algol 68 code to introducing another level of software generation with dynamic creation of code. Why I was asking - I probably should have mentioned that explicitly, though I didn't want to restrict possible solutions! - was to get to know whether there's some, say, functional or meta-programming options with Algol 68 that I didn't yet have noticed. Meanwhile I've resorted to the index-linearizing approach, by the way. > > I should add that my advice is worth no more than you’re paying > for it, and also that my charges are tripled over the holiday period. I'm glad that three times 0 is still 0. :-) OTOH, if you're inclined to read Usenet on a Sunday your potential fees might be unjustified anyway. ;-) > Merry New Year! And all the best! Janis
Back to comp.lang.misc | Previous | Next — Previous in thread | Next in thread | Find similar
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