please help... small problem

hi Is there anyway to cut down this code and to not use auxillary functons, but instead use pattern matching? The code basically splits up a list 'rslis' into a list of lists - but so each word is split up and the integers have been parsed. so.... ["hi ryan 1","hi jeff 2"] becomes [["hi","ryan" 1], ["hi","jeff", 2]].The code is far too long. I don't wanna use premade functions too much... pattern matching is required. Ryan _________________________________________________________________ 100’s of Music vouchers to be won with MSN Music https://www.musicmashup.co.uk

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

2007/11/9, Ryan Bloor
hi
Is there anyway to cut down this code and to not use auxillary functons, but instead use pattern matching?
The code basically splits up a list 'rslis' into a list of lists - but so each word is split up and the integers have been parsed. so.... ["hi ryan 1","hi jeff 2"] becomes [["hi","ryan" 1], ["hi","jeff", 2]]. The code is far too long. I don't wanna use premade functions too much... pattern matching is required.
Hi, Can you show me the code of this - even if long and ugly? The output is illegal AFAIK. (although I'm not haskell expert). Prelude> :t [["hi","ryan", 1], ["hi","jeff", 2]] <interactive>:1:15: No instance for (Num [Char]) arising from the literal `1' at <interactive>:1:15 Possible fix: add an instance declaration for (Num [Char]) In the expression: 1 In the expression: ["hi", "ryan", 1] Cheers, Radek. -- Codeside: http://codeside.org/ Przedszkole Miejskie nr 86 w Lodzi: http://www.pm86.pl/
participants (3)
-
Neil Mitchell
-
Radosław Grzanka
-
Ryan Bloor