From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Path: eternal-september.org!reader02.eternal-september.org!aioe.org!pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org.POSTED!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: advent of code day 11 Date: Sat, 12 Dec 2020 12:27:44 -0800 Organization: Aioe.org NNTP Server Message-ID: <86bleypy67.fsf@stephe-leake.org> References: <86mtykp8yd.fsf@stephe-leake.org> NNTP-Posting-Host: pBWEO6hi52oGFheO/GY5ag.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (windows-nt) X-Notice: Filtered by postfilter v. 0.9.2 Cancel-Lock: sha1:+DZnnqYv1sivCG8T60/8c+UX3cg= Xref: reader02.eternal-september.org comp.lang.ada:60813 List-Id: John Perry writes: > On Friday, December 11, 2020 at 11:08:00 AM UTC-6, Stephen Leake wrote: >> mildly interesting; variation on Conway's Game of Life. > > I thought it would be clearer to use references to switch from one > chart to the other, but I had trouble doing that last night. Now I can > get it this way: > > Source: Chart_Array renames Chart1; > Result: Chart_Array renames Chart2; A 'renames' declaration creates a _static_ name for the object that is the result of the expression; the expression is evaluated once when the 'renames' declaration is evaluated. When the name is used, it is the same as any other object name. > while Changed loop > > Perform_Round( Source => Source , Result => Result , ... ); > declare Tmp: Chart_Array renames Source; 'Tmp' is evaluated each time around the loop, but since the global Source is static, it always has the same value of Chart1. > begin Source := Result; This does not revaluate the expression for global Source; it uses the global Source name to determine where to store a copy of Result. -- -- Stephe