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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c5f73eda096e667b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-07 14:00:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!colt.net!newspeer.clara.net!news.clara.net!peernews!peer.cwci.net!newspeer1-gui.server.ntli.net!ntli.net!newsfep1-win.server.ntli.net.POSTED!53ab2750!not-for-mail From: "chris.danx" Newsgroups: comp.lang.ada References: <3CD83B55.75FC2B01@easystreet.com> Subject: Re: Neat and tidy solution to following problem? X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: Date: Tue, 7 May 2002 21:56:21 +0100 NNTP-Posting-Host: 213.107.24.115 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfep1-win.server.ntli.net 1020805236 213.107.24.115 (Tue, 07 May 2002 22:00:36 BST) NNTP-Posting-Date: Tue, 07 May 2002 22:00:36 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:23676 Date: 2002-05-07T21:56:21+01:00 List-Id: wrote in message news:3CD83B55.75FC2B01@easystreet.com... > "chris.danx" wrote: > > > > I'm just wondering if there's a way to have something similar in Ada > > 95 like have two items returned from a function but not have to > > declare an explicit type. > > > > You would do this in Ada as a procedure (not a function) with multiple > in out parameters. That's one of two solutions that spring immediately to mind (in fact it's how I've implemented it, and would usually do so). > I'd be interested to know how well recursion in Ada substitutes for > looping (efficiency-wise). Some of the functional languages are not > really high performance, and it would be interesting to see if you could > get about the same level of performance from the same style of coding > using a procedural language. It seems the techniques in compiler construction for procedural/imperative languages are well studied and understood but for functional languages the situation is different. We just haven't gotten clever enough to compile functional languages to similarly efficient code. :) > In your example, for example, our spec might say that words are > never very long (say more than 50 characters or so), so we > wouldn't have to worry about problems with very deep recursions. In this case the length of the strings per line in the file is left unspecified, and also the size of the document. If it's large then there'd probably be a problem with a recursive solution unless the recursion operates in more or less constant space (can't remember what this is called, but iirc it's doable for a variety of problems). Chris