How to put data from a string to a tuple

Hi, Im self learner in Haskell. And im stuck in a small place which I tried searching in google but couldn't find Proper answer I have some values in a string, Im removing them one by one from the string (word by word) and I want to put them in a tuple. Because it contain Integers and Strings. Can someone help me __________ Information from ESET NOD32 Antivirus, version of virus signature database 4917 (20100305) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com

Consider taking this to the haskell-beginners list.
On Fri, Mar 5, 2010 at 4:32 AM, Pradeep Wickramanayake
Hi,
Im self learner in Haskell. And im stuck in a small place which I tried searching in google but couldn't find Proper answer
I have some values in a string, Im removing them one by one from the string (word by word) and I want to put them in a tuple. Because it contain Integers and Strings.
Could you be more specific? Paste the code you have already, and be clearer about what you are trying to accomplish. Luke

Hi,
Im self learner in Haskell. And im stuck in a small place which I tried searching in google but couldn't find Proper answer
I have some values in a string, Im removing them one by one from the string (word by word) and I want to put them in a tuple. Because it contain Integers and Strings.
Can someone help me
Maybe something like this? pairs :: String -> [(String,Integer)] pairs s = f (words s) [] where f [] acc = reverse acc f (i:[]) acc = reverse ((i,undefined):acc) f (i:v:r) acc = f r ((i,read v):acc) Key points to look at: accumulator (acc with cons : ), recursion (f), pattern matching (i:v:r), undefined (if the data is not pairs).
participants (3)
-
Luke Palmer
-
Pradeep Wickramanayake
-
Tim Attwood