[Haskell-cafe] Re: really difficult for a beginner like me...
saaJamal
aliabbas911 at hotmail.com
Wed Mar 24 07:07:40 EDT 2010
Ivan Amarquaye <amarquaye.ivan <at> hotmail.com> writes:
>
>
> thanks for the tip there....its been four gruesome days and i just don't
seem to make any understanding of how to implement some changes or create some
new functions due to the fact that im so new to Haskell and functional
programming.
>
> For the very first case of allowing hyphenated words to be treated as single
words i manged to successfully do that by adding to the definition of the
splitWords function to also accept characters such as "-" and it worked
perfectly after running it.
>
> The next case posed a headache for me as i have been on it for 3 days now.
>From my understanding, it means in situations where your writing a sentence
and you get to the end of the line while writing a word, you decide to put a
hyphen there and continue on the other line. So the case demands that i allow
sentences that end with hyphens and continue on the next line to drop the
hyphen and be a single word on that same line without having to continue on
the next line so this was how i foresee the input it in hugs:
>
> Input:
> makeIndex "these are the very same stuff they tell each-\nother"
>
> output:
> should be this: [[1]these],[[1]eachother]. 1 indicates they are on the same
line and the others are left out as the index takes words greater than 4
characters and i have been struggling with this since. i tried on several
counts to include in the splitwords function to dropWhile "-" is found in the
words but it turned out an error.I also tried creating a new function to do
that didnt succeed either can anybody help me out in this regard.....
>
U happen to find a way for your problem? I tried a lot for more than a week
now, but cant do it.
More information about the Haskell-Cafe
mailing list