From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,32d9aa9d79729b31 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.68.241.162 with SMTP id wj2mr9604998pbc.2.1340745577168; Tue, 26 Jun 2012 14:19:37 -0700 (PDT) Path: l9ni23307pbj.0!nntp.google.com!news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!bloom-beacon.mit.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!.POSTED!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Any easy/build-in construct to extract submatrices from larger matrix? Date: Tue, 26 Jun 2012 17:19:36 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <788af57d-750d-418d-94bb-75c6557e36a9@g4g2000pbn.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 X-Trace: pcls6.std.com 1340745576 12547 192.74.137.71 (26 Jun 2012 21:19:36 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 26 Jun 2012 21:19:36 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:AAJeFvNn8XK1N6p3Ui95cpcl1gQ= Content-Type: text/plain; charset=us-ascii Date: 2012-06-26T17:19:36-04:00 List-Id: Adam Beneschan writes: > you can pass a slice of some other array > > Proc (B (7 .. 23)); > > and the since the elements of the slice are all still contiguous, Proc > could treat the parameter the same as it would any other array--it > wouldn't have to know whether the actual parameter was an entire array > or a slice. That wouldn't be the case with 2-D slices. Some > additional logic in Proc would be needed to deal with non-contiguous > slices, and that additional logic would have to be there in Proc > whether or not a 2-D slice was actually passed to it anywhere. > > I realize that this may not be important to all programmers, and that > they'd rather have the ability to express what they want and not worry > about whether it slows things down ("distributed overhead"). But I > think that being able to generate efficient code was one of the design > principles in Ada 83. Well, efficient code (or more precisely, avoiding distributed overhead) was a design goal of Fortran, too, yet Fortran has multi-dim slices. You have to pass in the "stride" (distance between noncontiguous pieces). Also if the goal was to avoid distributed overhead, why on earth do we have to store millions of copies of the number 1 (the 'First value for almost all Strings)? A complete waste of memory, and also a rich source of bugs. - Bob