[Haskell-cafe] dropping hyphens and \n in words
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Sun May 11 12:20:35 EDT 2008
On 2008 May 11, at 11:47, Ivan Amarquaye wrote:
> Now my problem is this...I'm assuming that the hyphen normally comes
> at the end of a sentence like this: "there are so many guys ravis-
> hing our women" and this can be demonstrated in haskell by "\n"
> which places the words or characters following it in a new line like
> input: makeIndex"there are so many guys ravis\nhing our women" and
> output is: ((,[there]),(,[ravis]),(,[hing])) where 1 means
> the first line and 2 the next.
Somewhat unrelated point: breaking between "s" and "h" would be
peculiar for English because they're components of a digraph.
> Now i want to write a function that would take away the hyphen and
> \n from all the words supposed to end on the first line and
> continue on the next and make all appear on the first line like
> this: all words in this form: "chip-\nheater" should become
> "chipheater". hope i can get some guidance on doing this.
Is this homework? http://haskell.org/haskellwiki/Homework_help
Hint: \n may look funny, but it is a character like any other and can
be used in pattern matching.
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe