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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c5f73eda096e667b,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-05-07 11:44:45 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!cox.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 Subject: 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 19:24:27 +0100 NNTP-Posting-Host: 213.107.24.115 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfep1-win.server.ntli.net 1020797079 213.107.24.115 (Tue, 07 May 2002 19:44:39 BST) NNTP-Posting-Date: Tue, 07 May 2002 19:44:39 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:23663 Date: 2002-05-07T19:24:27+01:00 List-Id: Hi, As part of an assignment we have to split text up into words, and check if they're in a document. I'm ok with the assignment I just wondered if there was an Ada like equivalent to tuples that didn't involve defining an explicit record type (say word_and_remaining type)? We did a similar task in Haskell and by passing out more than one item of different types as a single item was very tidy and easy (see below). Some Haskell code for a simple text function > getWord :: String -> (String, String) > getWord [] = ([], []) > getWord (' ':[]) = ([], []) > getWord (x:xs) > | (x == ' ') = ([], trim xs) > | otherwise = ([x] ++ selection, remList) > where (selection, remList) = getWord xs 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. Regards, Chris p.s. please don't post any code specific to cutting up text into words, it could negatively impact ppls marks (and DON'T send me any code privately). p.p.s. this isn't intended as a Haskell is better than Ada post (both are good tools). The intention is to find another way of doing the same task so no language Holy Wars attributed to my post, if you don't mind.