[Haskell-cafe] please help... small problem

Neil Mitchell ndmitchell at gmail.com
Fri Nov 9 16:50:09 EST 2007


Hi

>  Is there anyway to cut down this code and to not use auxillary functons,
> but instead use pattern matching?

You haven't attached any code, but even if you had, I don't think it
would have worked.

> ["hi ryan 1","hi jeff 2"] becomes [["hi","ryan" 1], ["hi","jeff", 2]].

In Haskell lists are collections of elements of the _same_ type. In
your example "hi" and "jeff" are both String's, while 2 is an Integer.
The difference in types means they can't be placed in the same list.

Is this a homework exercise, or are you trying to learn independently?
If its homework, please read the homework help thing
(http://haskell.org/haskellwiki/Homework_help), and if you are trying
to learn on your own, you might want to read a tutorial or two first
(http://en.wikibooks.org/wiki/Haskell)

Thanks

Neil


More information about the Haskell-Cafe mailing list