comp.lang.ada
 help / color / mirror / Atom feed
From: "chris.danx" <spamoff.danx@ntlworld.com>
Subject: Re: Neat and tidy solution to following problem?
Date: Tue, 7 May 2002 21:21:35 +0100
Date: 2002-05-07T21:21:35+01:00	[thread overview]
Message-ID: <8IWB8.2994$0h6.128758@newsfep1-win.server.ntli.net> (raw)
In-Reply-To: slrnadga2g.c0c.randhol+abuse@kiuk0152.chembio.ntnu.no


"Preben Randhol" <randhol+abuse@pvv.org> 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.





  reply	other threads:[~2002-05-07 20:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-07 18:24 Neat and tidy solution to following problem? chris.danx
2002-05-07 19:17 ` Preben Randhol
2002-05-07 20:21   ` chris.danx [this message]
2002-05-08  1:11     ` Jeffrey Carter
2002-05-08  8:16       ` Danx
2002-05-07 20:38 ` achrist
2002-05-07 20:56   ` chris.danx
2002-05-25 20:56     ` Robert I. Eachus
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox