Groups | Search | Server Info | Login | Register


Groups > comp.lang.misc > #11717

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups comp.lang.misc
Subject Re: Algol 68 (or generally) - arbitrarily nested arrays of arrays
Date 28 Dec 2025 14:45:37 GMT
Organization Stefan Ram
Lines 21
Expires 1 Jan 2027 11:59:58 GMT
Message-ID <python-20251228154513@ram.dialup.fu-berlin.de> (permalink)
References <10ilrbc$25ihi$10@dont-email.me> <10ir98e$4b53$1@dont-email.me> <loops-20251228151118@ram.dialup.fu-berlin.de> <algol-20251228152842@ram.dialup.fu-berlin.de> <counting-20251228154105@ram.dialup.fu-berlin.de>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace news.uni-berlin.de 8Fis8f34KTHMVhSvRc0ZCQCZ8hiAxxIxzDMsZUD6DHzvAp
Cancel-Lock sha1:BP0BgSSB3BujQ4Lo3nTuDPAP6M4= sha256:wn3wmDXXbQyJwliMvHWTa6b3Y0GAeRB6zc7iqk76W5E=
X-Copyright (C) Copyright 2025 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the Web, to change URIs of this article into links, and to transfer the body without this notice, but quotations of parts in other Usenet posts are allowed.
X-No-Archive Yes
Archive no
X-No-Archive-Readme "X-No-Archive" is set, because this prevents some services to mirror the article in the web. But the article may be kept on a Usenet archive server with only NNTP access.
X-No-Html yes
Content-Language en
Xref csiph.com comp.lang.misc:11717

Show key headers only | View raw


ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
>import itertools
>import math
>bases =[ 2, 3, 2, 2 ]
>total_product = math.prod( bases )
>ranges =[ range( b ) for b in bases ]
>for digits in itertools.product( *reversed( ranges )):
>    print( *digits )

  "total_product" is not used, so it can be boiled down
  to two lines (plus imports):

import itertools
import math

ranges =[ range( b ) for b in [ 2, 3, 2, 2 ]]
for digits in itertools.product( *reversed( ranges )): print( *digits )

  .

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