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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,bb7cc916bd63ab43 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!13g2000yql.googlegroups.com!not-for-mail From: george.priv@gmail.com Newsgroups: comp.lang.ada Subject: Re: Performance of element access in Vector Date: Thu, 22 Jan 2009 05:52:41 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <0a8baaf0-19f7-40c0-a041-884e93fa7020@w39g2000prb.googlegroups.com> <1fp3pbmn4q3o5.1b0fk6lircbld.dlg@40tude.net> <4c38e681-3996-4ce9-ad33-6f7bd790fdbf@u18g2000pro.googlegroups.com> <49784401$0$31872$9b4e6d93@newsspool3.arcor-online.net> NNTP-Posting-Host: 151.196.71.114 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1232632361 17472 127.0.0.1 (22 Jan 2009 13:52:41 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 22 Jan 2009 13:52:41 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 13g2000yql.googlegroups.com; posting-host=151.196.71.114; posting-account=VnNb3AoAAACTpRtCcTrcjmPX7cs92k1Q User-Agent: G2/1.0 X-HTTP-Via: 1.1 SPARKS X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:3479 Date: 2009-01-22T05:52:41-08:00 List-Id: On Jan 22, 5:01=A0am, Georg Bauhaus wrote: > george.p...@gmail.com schrieb: > > > If you just try to get away from C++ paradigm you can find other ways > > to address these issues with raw arrays. =A0Think in functional > > programming framework for a change. > > I'm curious. =A0Vector algorithms use the STL paradigm specifically, > rather than some C++ paradigm. =A0The STL with its generic algorithms > has a Scheme history (and an Ada one). =A0FP languages tend to start > from sequential access to data, using recursion on the tail of some > list as their model. =A0The STL notions of ::iterator and > ::reverse_iterator, in particular considering their const variants, > suggest the same, to me at least. =A0So I have two questions: > > 1) How does straight forward STL iteration differ from > FP recursion on lists? (Only thing I can think of is > that non-pure languages can use destructive update > of array components, so to speak (tampering in some Ada sense).) > > 2) Can we rely on pure FPL style compilation techniques > (as if there were neither refs nor monads) to achieve > compact representation of lists/arrays in memory, > and little copying? > (I am assuming that memory use is an important criterion > when targetting small capacity hardware.) The issue raised by Maciej was about reading arrays of a-priory unknown size. That will be impossible with C/C++ arrays (not vector<>). I was trying to say that the elements of FP may be helpful and Ada allows to use elements of FP with native array operations. Trying to apply these technique to everything will be impractical. G.