From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on ip-172-31-65-14.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.0 required=3.0 tests=BAYES_40,FREEMAIL_FROM, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Received: by 2002:a05:6214:17c8:b0:635:dff8:e60d with SMTP id cu8-20020a05621417c800b00635dff8e60dmr6919qvb.0.1689997805352; Fri, 21 Jul 2023 20:50:05 -0700 (PDT) X-Received: by 2002:a05:6830:10d8:b0:6b8:8894:e4ac with SMTP id z24-20020a05683010d800b006b88894e4acmr2352384oto.3.1689997805151; Fri, 21 Jul 2023 20:50:05 -0700 (PDT) Path: eternal-september.org!news.eternal-september.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 21 Jul 2023 20:50:04 -0700 (PDT) Injection-Info: google-groups.googlegroups.com; posting-host=98.59.238.112; posting-account=oHOvdQoAAACYgyEBjgPNvKFOGxg8pNns NNTP-Posting-Host: 98.59.238.112 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <1f6ad7f7-3bd3-4094-b037-eac7d352d68dn@googlegroups.com> Subject: memoization in Ada? Hash ADT? From: Kenneth Wolcott Injection-Date: Sat, 22 Jul 2023 03:50:05 +0000 Content-Type: text/plain; charset="UTF-8" X-Received-Bytes: 1591 Xref: news.eternal-september.org comp.lang.ada:65445 List-Id: Hi; I'm working on the Rosetta Code task: "Stirling numbers of the second kind" I have a working recursive solution written in Ada but I'd like to memoize it to cut down on the redundant and duplicative calls (similar to a recursive solution to calculating the Fibonacci sequence). So I think I need a hash ADT (which I've used in Perl) but I've never used in Ada. So I want to preserve the calculation of the Stirling2 for each N and K so I can do a lookup. If this were based on a single unsigned integer, an array would suffice. Maybe a 2d array would suffice? Thanks, Ken Wolcott