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 13:23:06 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!csulb.edu!newshub.sdsu.edu!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 References: 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: <8IWB8.2994$0h6.128758@newsfep1-win.server.ntli.net> Date: Tue, 7 May 2002 21:21:35 +0100 NNTP-Posting-Host: 213.107.24.115 X-Complaints-To: abuse@ntlworld.com X-Trace: newsfep1-win.server.ntli.net 1020802948 213.107.24.115 (Tue, 07 May 2002 21:22:28 BST) NNTP-Posting-Date: Tue, 07 May 2002 21:22:28 BST Organization: ntl Cablemodem News Service Xref: archiver1.google.com comp.lang.ada:23674 Date: 2002-05-07T21:21:35+01:00 List-Id: "Preben Randhol" wrote in message news:slrnadga2g.c0c.randhol+abuse@kiuk0152.chembio.ntnu.no... > On Tue, 7 May 2002 19:24:27 +0100, chris.danx wrote: > > I'm not sure I understand your question as I don't know Haskell and > cannot understand the code. But if you have your whole text in a > string why don't you find the beginning and end position of the words > and then scan the document for them? But probably I'm talking about > something different :-) Yes it is something different. In an FPL you can return a tuple of items from a function just as easily as you can return a single item (I think that FPLs regard them as a single item anyway, they're just easier to use). In the example given previously, the function getWord is declared like this getWord :: String -> (String, String) This means it takes a string and returns a pair of strings as a tuple. If you want to add all the words in the String to a data structure in another function, you can use recursion. Somethings might just be neater if this could be done without fussing with explicit* record types. Chris *explicit in the sense that is defined/declared(? I hate those two words!!!) before it is used in the return area of function.